domaindrivendev / Swashbuckle.AspNetCore

Swagger tools for documenting API's built on ASP.NET Core
MIT License
5.25k stars 1.31k forks source link

ProducesDefaultResponseType equivalent for .Net 6 Minimal APIs #2396

Open agilenut opened 2 years ago

agilenut commented 2 years ago

I'm not sure if this feature request goes here or somewhere in dotnet but...

Can we have a Minimal API equivalent to ProducesDefaultResponseType? Something like:

app.MapGet("todos", TodoHandler.Handle)
    .Produces<Todo[]>()
    .ProducesDefault()
    .WithTags("Todos")
    .WithName("GetTodos");

which would result in the default swagger response being ProblemDetails, and

app.MapGet("todos", TodoHandler.Handle)
    .Produces<Todo[]>()
    .ProducesDefault<MyToDoErrors>()
    .WithTags("Todos")
    .WithName("GetTodos");

which would allow you to specify your own default response type.

github-actions[bot] commented 6 months ago

This issue is stale because it has been open for 60 days with no activity. It will be automatically closed in 14 days if no further updates are made.