{"id":15091377,"url":"https://github.com/christianhelle/httpgenerator","last_synced_at":"2025-05-16T09:05:40.074Z","repository":{"id":207060389,"uuid":"714590129","full_name":"christianhelle/httpgenerator","owner":"christianhelle","description":"Generate .http files from OpenAPI (Swagger) specifications","archived":false,"fork":false,"pushed_at":"2025-05-13T19:16:01.000Z","size":1166,"stargazers_count":98,"open_issues_count":7,"forks_count":9,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-13T20:41:11.776Z","etag":null,"topics":["openapi","openapi-specification","openapi3","rest-client","swagger"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/christianhelle.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"christianhelle","patreon":null,"open_collective":null,"ko_fi":"christianhelle","tidelift":null,"community_bridge":null,"liberapay":"christianhelle","issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":["https://paypal.me/christianhelle","https://buymeacoffee.com/christianhelle"]}},"created_at":"2023-11-05T10:19:39.000Z","updated_at":"2025-05-11T09:25:25.000Z","dependencies_parsed_at":"2024-01-17T01:12:59.088Z","dependency_job_id":"9f4a7232-199b-405d-a4b4-74c9a944aa52","html_url":"https://github.com/christianhelle/httpgenerator","commit_stats":{"total_commits":458,"total_committers":8,"mean_commits":57.25,"dds":0.482532751091703,"last_synced_commit":"c0d48bf2c5f8d447ac2c2ab542beabcdeaa7f0d9"},"previous_names":["christianhelle/httpgenerator"],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christianhelle%2Fhttpgenerator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christianhelle%2Fhttpgenerator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christianhelle%2Fhttpgenerator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christianhelle%2Fhttpgenerator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/christianhelle","download_url":"https://codeload.github.com/christianhelle/httpgenerator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254032089,"owners_count":22002871,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["openapi","openapi-specification","openapi3","rest-client","swagger"],"created_at":"2024-09-25T10:40:41.019Z","updated_at":"2025-05-16T09:05:35.064Z","avatar_url":"https://github.com/christianhelle.png","language":"C#","readme":"\u003c!--toc:start--\u003e\n- [HTTP File Generator](#http-file-generator)\n  - [Installation](#installation)\n  - [Usage](#usage)\n    - [Error Logging, Telemetry, and Privacy](#error-logging-telemetry-and-privacy)\n    - [Visual Studio 2022 Extension](#visual-studio-2022-extension)\n- [](#)\n\u003c!--toc:end--\u003e\n\n[![Build](https://github.com/christianhelle/httpgenerator/actions/workflows/build.yml/badge.svg)](https://github.com/christianhelle/httpgenerator/actions/workflows/build.yml)\n[![Smoke Tests](https://github.com/christianhelle/httpgenerator/actions/workflows/smoke-tests.yml/badge.svg)](https://github.com/christianhelle/httpgenerator/actions/workflows/smoke-tests.yml)\n[![NuGet](https://img.shields.io/nuget/v/httpgenerator?color=blue)](https://www.nuget.org/packages/httpgenerator)\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=christianhelle_httpgenerator\u0026metric=alert_status)](https://sonarcloud.io/summary/new_code?id=christianhelle_httpgenerator)\n[![codecov](https://codecov.io/gh/christianhelle/httpgenerator/graph/badge.svg?token=YeSFnn0bH6)](https://codecov.io/gh/christianhelle/httpgenerator)\n\n# HTTP File Generator\n\nGenerate .http files from OpenAPI specifications\n\n`.http` files were made popular by the Visual Studio Code extension [REST Client](https://marketplace.visualstudio.com/items?itemName=humao.rest-client), which then was adopted by JetBrains IDE's, and later on [Visual Studio 2022](https://marketplace.visualstudio.com/items?itemName=MadsKristensen.RestClient)\n\n## Installation\n\nThis is tool is distrubuted as a .NET Tool on NuGet.org\n\nTo install, simply use the following command\n\n```bash\ndotnet tool install --global httpgenerator\n```\n\n## Usage\n\n```text\nUSAGE:\n    httpgenerator [URL or input file] [OPTIONS]\n\nEXAMPLES:\n    httpgenerator ./openapi.json\n    httpgenerator ./openapi.json --output ./\n    httpgenerator ./openapi.json --output-type onefile\n    httpgenerator https://petstore.swagger.io/v2/swagger.json\n    httpgenerator https://petstore3.swagger.io/api/v3/openapi.json --base-url https://petstore3.swagger.io\n    httpgenerator ./openapi.json --authorization-header Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9c\n    httpgenerator ./openapi.json --azure-scope [Some Application ID URI]/.default\n    httpgenerator ./openapi.json --generate-intellij-tests\n    httpgenerator ./openapi.json --custom-header X-Custom-Header: Value --custom-header X-Another-Header: AnotherValue\n\nARGUMENTS:\n    [URL or input file]    URL or file path to OpenAPI Specification file\n\nOPTIONS:\n                                                                DEFAULT\n    -h, --help                                                                       Prints help information\n    -v, --version                                                                    Prints version information\n    -o, --output \u003cOUTPUT\u003e                                       ./                   Output directory\n        --no-logging                                                                 Don't log errors or collect telemetry\n        --skip-validation                                                            Skip validation of OpenAPI Specification file\n        --authorization-header \u003cHEADER\u003e                                              Authorization header to use for all requests\n        --load-authorization-header-from-environment                                 Load the authorization header from an environment variable or define it in the\n                                                                                     .http file. You can use --authorization-header-variable-name to specify the\n                                                                                     environment variable name\n        --authorization-header-variable-name \u003cVARIABLE-NAME\u003e    authorization        Name of the environment variable to load the authorization header from\n        --content-type \u003cCONTENT-TYPE\u003e                           application/json     Default Content-Type header to use for all requests\n        --base-url \u003cBASE-URL\u003e                                                        Default Base URL to use for all requests. Use this if the OpenAPI spec doesn't\n                                                                                     explicitly specify a server URL\n        --output-type \u003cOUTPUT-TYPE\u003e                             OneRequestPerFile    OneRequestPerFile generates one .http file per request. OneFile generates a\n                                                                                     single .http file for all requests. OneFilePerTag generates one .http file per\n                                                                                     first tag associated with each request\n        --azure-scope \u003cSCOPE\u003e                                                        Azure Entra ID Scope to use for retrieving Access Token for Authorization header\n        --azure-tenant-id \u003cTENANT-ID\u003e                                                Azure Entra ID Tenant ID to use for retrieving Access Token for Authorization\n                                                                                     header\n        --timeout \u003cSECONDS\u003e                                     120                  Timeout (in seconds) for writing files to disk\n        --generate-intellij-tests                                                    Generate IntelliJ tests that assert whether the response status code is 200\n        --custom-header                                                              Add custom HTTP headers to the generated request\n```\n\nRunning the following:\n\n```sh\nhttpgenerator https://petstore.swagger.io/v2/swagger.json\n```\n\nOutputs the following:\n\n```\nHTTP File Generator v0.1.5\nSupport key: mbmbqvd\n\nOpenAPI statistics:\n - Path Items: 14\n - Operations: 20\n - Parameters: 14\n - Request Bodies: 9\n - Responses: 20\n - Links: 0\n - Callbacks: 0\n - Schemas: 67\n\nFiles: 20\nDuration: 00:00:02.3089450\n```\n\nWhich will produce the following files:\n\n```sh\n-rw-r--r-- 1 christian 197121  593 Dec 10 10:44 DeleteOrder.http        \n-rw-r--r-- 1 christian 197121  231 Dec 10 10:44 DeletePet.http\n-rw-r--r-- 1 christian 197121  358 Dec 10 10:44 DeleteUser.http\n-rw-r--r-- 1 christian 197121  432 Dec 10 10:44 GetFindPetsByStatus.http\n-rw-r--r-- 1 christian 197121  504 Dec 10 10:44 GetFindPetsByTags.http  \n-rw-r--r-- 1 christian 197121  371 Dec 10 10:44 GetInventory.http       \n-rw-r--r-- 1 christian 197121  247 Dec 10 10:44 GetLoginUser.http       \n-rw-r--r-- 1 christian 197121  291 Dec 10 10:44 GetLogoutUser.http      \n-rw-r--r-- 1 christian 197121  540 Dec 10 10:44 GetOrderById.http\n-rw-r--r-- 1 christian 197121  275 Dec 10 10:44 GetPetById.http\n-rw-r--r-- 1 christian 197121  245 Dec 10 10:44 GetUserByName.http\n-rw-r--r-- 1 christian 197121  513 Dec 10 10:44 PostAddPet.http\n-rw-r--r-- 1 christian 197121  521 Dec 10 10:44 PostCreateUser.http\n-rw-r--r-- 1 christian 197121  610 Dec 10 10:44 PostCreateUsersWithListInput.http\n-rw-r--r-- 1 christian 197121  464 Dec 10 10:44 PostPlaceOrder.http\n-rw-r--r-- 1 christian 197121  299 Dec 10 10:44 PostUpdatePetWithForm.http\n-rw-r--r-- 1 christian 197121  274 Dec 10 10:44 PostUploadFile.http\n-rw-r--r-- 1 christian 197121  513 Dec 10 10:44 PutUpdatePet.http\n-rw-r--r-- 1 christian 197121  541 Dec 10 10:44 PutUpdateUser.http\n```\n\nIn this example, the contents of `PostAddPet.http` looks like this:\n\n```sh\n@contentType = application/json\n\n#############################################\n### Request: POST /pet\n### Summary: Add a new pet to the store\n### Description: Add a new pet to the store\n#############################################\n\nPOST https://petstore3.swagger.io/api/v3/pet\nContent-Type: {{contentType}}\n\n{\n  \"id\": 0,\n  \"name\": \"name\",\n  \"category\": {\n    \"id\": 0,\n    \"name\": \"name\"\n  },\n  \"photoUrls\": [\n    \"\"\n  ],\n  \"tags\": [\n    {\n      \"id\": 0,\n      \"name\": \"name\"\n    }\n  ],\n  \"status\": \"available\"\n}\n```\n\nand the contents of `GetPetById.http` looks like this:\n\n```sh\n@contentType = application/json\n\n#######################################\n### Request: GET /pet/{petId}\n### Summary: Find pet by ID\n### Description: Returns a single pet\n#######################################\n\n### Path Parameter: ID of pet to return\n@petId = 0\n\nGET https://petstore3.swagger.io/api/v3/pet/{{petId}}\nContent-Type: {{contentType}}\n```\n\nwith the `--generate-intellij-tests` option, the output looks like this:\n\n```sh\n@contentType = application/json\n\n#######################################\n### Request: GET /pet/{petId}\n### Summary: Find pet by ID\n### Description: Returns a single pet\n#######################################\n\n### Path Parameter: ID of pet to return\n@petId = 1\n\nGET https://petstore3.swagger.io/api/v3/pet/{{petId}}\nContent-Type: {{contentType}}\n\n\u003e {%\n    client.test(\"Request executed successfully\", function() {\n        client.assert(\n            response.status === 200, \n            \"Response status is not 200\");\n    });\n%}\n```\n\nHere's an advanced example of generating `.http` files for a REST API hosted on Microsoft Azure that uses the Microsoft Entra ID service as an STS. For this example, I use PowerShell and Azure CLI to retrieve an access token for the user I'm currently logged in with.\n\n```powershell\naz account get-access-token --scope [Some Application ID URI]/.default `\n| ConvertFrom-Json `\n| %{\n    httpgenerator `\n        https://api.example.com/swagger/v1/swagger.json `\n        --authorization-header (\"Bearer \" + $_.accessToken) `\n        --base-url https://api.example.com `\n        --output ./HttpFiles \n}\n```\n\nYou can also use the `--azure-scope` and `azure-tenant-id` arguments internally use `DefaultAzureCredentials` from the `Microsoft.Extensions.Azure` NuGet package to retrieve an access token for the specified `scope`.\n\n```powershell\nhttpgenerator `\n  https://api.example.com/swagger/v1/swagger.json `\n  --azure-scope [Some Application ID URI]/.default `\n  --base-url https://api.example.com `\n  --output ./HttpFiles \n```\n\n### Error Logging, Telemetry, and Privacy\n\nThis tool collects errors and tracks features usages to service called [Exceptionless](https://exceptionless.com/)\n\nBy default, error logging and telemetry collection is enabled but it is possible to **opt-out** by using the `--no-logging` CLI argument. \n\nUser tracking is done anonymously using the **Support key** shown when running the tool and a generated anonymous identity based on a secure hash algorithm of username@host.\n\n```sh\nHTTP File Generator v0.1.5\nSupport key: mbmbqvd\n```\n\nThe support key is just the first 7 characters of the generated anonymous identity\n\n![Exceptionless](https://github.com/christianhelle/httpgenerator/raw/main/images/exceptionless-overview.png)\n\n![Exceptionless](https://github.com/christianhelle/httpgenerator/raw/main/images/exceptionless-exception.png)\n\nThe `--authorization-header` value is **`[REDACTED]`** and the same goes for all personal identifiable information like the IP address, machine name, and file system folders\n\n![Exceptionless](https://github.com/christianhelle/httpgenerator/raw/main/images/exceptionless-environment.png)\n\nIt's important to know that no **support key** will be generated if you opt-out from telemetry collection and that the Exceptionless SDK will be completely disabled.\n\n### Visual Studio 2022 Extension\n\nThis tool is also available as a [Visual Studio 2022 extension](https://marketplace.visualstudio.com/items?itemName=ChristianResmaHelle.HttpGenerator)\n\nFrom the **Tools** menu select **Generate .http files**\n\n![Tools menu](https://github.com/christianhelle/httpgenerator/blob/main/images/vsix_tools.png?raw=true)\n\nThis opens the main dialog which has similar input fields as the CLI tool\n\n![Main dialog](https://github.com/christianhelle/httpgenerator/blob/main/images/vsix_httpgenerator_dialog.png?raw=true)\n\nYou can acquire an Azure Entra ID access token by clicking on the `...` button beside the **Authorization Headers** input field\n\n![Acquire Azure Entra ID access token](https://github.com/christianhelle/httpgenerator/blob/main/images/vsix_azure_entra_id.png?raw=true)\n\nBy default, the **Output folder** is pre-filled with the path of the currently active C# Project in the Solution Explorer, suffixed with **\\HttpFiles**\n\n![Solution explorer](https://github.com/christianhelle/httpgenerator/blob/main/images/vsix_solution_explorer.png?raw=true)\n\nOnce the .http files are generated you can easily open and inspect them\n\n![.http file](https://github.com/christianhelle/httpgenerator/blob/main/images/vsix_http_file.png?raw=true)\n\n#\n\nFor tips and tricks on software development, check out [my blog](https://christianhelle.com)\n\nIf you find this useful and feel a bit generous then feel free to [buy me a coffee ☕](https://www.buymeacoffee.com/christianhelle)\n","funding_links":["https://github.com/sponsors/christianhelle","https://ko-fi.com/christianhelle","https://liberapay.com/christianhelle","https://paypal.me/christianhelle","https://buymeacoffee.com/christianhelle","https://www.buymeacoffee.com/christianhelle"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchristianhelle%2Fhttpgenerator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchristianhelle%2Fhttpgenerator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchristianhelle%2Fhttpgenerator/lists"}