I have the following route mapped in a Mininal API application:
app.MapGet("api/test", async Task<Results<PushStreamHttpResult, NotFound>> (bool fail) => {
if (fail) return TypedResults.NotFound();
return TypedResults.Stream(stream => WriteToStream(stream), "text/plain");
}).WithSummary("Test Streaming results");
async Task WriteToStream(Stream stream) {
// do the writing... not needed for sample code
}
I didn't find a way to generate the proper documentation for this TypedResults type in swagger/OpenAPI UI and schemas. I can do this for other result types:
app.MapGet("api/thisworks", async Task<
Results<
Ok<ApiResult>,
BadRequest<ApiResult>,
NotFound<ApiResult>>> () => { ... }
Which produces proper documentation for the many return types like this for example:
Is there a way to automatically achieve the same with TypedResults.Stream / PushStreamHttpResult ?


PushStreamHttpResult?.Producesextension method.