Feature Request: Built-in HttpGenerator for FastEndpoints (generate .http files from endpoints/Swagger)
I’d like to propose adding built-in support for generating .http files (JetBrains Rider / VS Code REST Client format) directly from FastEndpoints + FastEndpoints.Swagger. The idea is to provide developers an easy way to auto-generate request collections for testing APIs, similar to how Swagger UI or Postman collections can be generated.
Motivation
- Many .NET developers use Rider or VS Code with .http files for local testing.
- Currently, Swagger/OpenAPI can be exported, but generating .http files requires external tooling or custom scripts.
- A first-class integration in FastEndpoints would simplify workflow: every endpoint could carry its own HttpGen metadata and the library would automatically produce .http files.
Proposal
Introduce a new package, e.g. FastEndpoints.HttpGen, with:
Endpoint metadata extensions (used in Configure()):
Definition
.HttpGenFile("chapters")
.HttpGenAuthProfile("keycloak")
.HttpGenName("CreateChapter")
.HttpGenSaveVar("/id", "chapterId");
OperationProcessor integration with FastEndpoints.Swagger:
- Reads endpoint metadata
- Writes x-httpgen-* vendor extensions into OpenAPI spec
Runtime generator (middleware or CLI):
- Reads Swagger doc
- Generates .http files into Requests/*.http
- Groups by file (e.g. per tag, per auth profile, or explicit HttpGenFile metadata)
Single-line registration in Program.cs:
builder.Services.AddFastEndpointsWithHttpGen(o =>
{
o.DocumentName = "v1";
o.OutputDir = "Requests";
o.GenerateRoutePath = "/__gen/http";
});
Benefits
- Developer convenience: quick local testing without Postman.
- Consistency: requests are generated from the same OpenAPI as Swagger.
- Flexibility: metadata per-endpoint allows different auth profiles, grouping, saving response values as variables.
- Minimal setup: one-line configuration, everything else automatic.
nice idea... we could possibly write our own wrapper for this library which already does the heavy lifting of the actual .http file generation. will look in to that as soon as i can...