-
Notifications
You must be signed in to change notification settings - Fork 25.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OpenAPI response descriptions can be set using ProducesResponseType in .NET 10 #33974
Comments
@sander1095 Thanks for creating this tracking issue. This is very cool and will be well received I'm sure. |
Thanks @Rick-Anderson ! Thanks so much for that nice comment! |
Can/will this work with the extension methods as well? eg. builder.MapPost("/", X())
.Produces("description here"); |
Hi @A-Stapleton ! Thanks for your question. I created dotnet/aspnetcore#58724 for this, but this likely won't be implemented at this moment, based on my discuss with @captainsafia . As I understand it, the team's vision is to use transformers instead which will reduce coupling between your endpoints and OpenAPI metadata. dotnet/aspnetcore#59180 was created to make transformers more easy to use for specific endpoints, which can result in a similar looking result compared to So, what can you do at this moment? Well:
If you would still like to be able to use an overload in the Produces method, let your voice be heard in dotnet/aspnetcore#58724 😄 |
Description
The document says:
This is true for .NET 9, but for .NET 10 I've implemented dotnet/aspnetcore#55656 which allows a developer to set the response description for both controllers and minimal API like so:
Controllers:
Minimal API:
The page should be updated to reflect these new possibilities.
This is only relevant for .NET 10, but I thought it'd be worth creating this issue already so it can be tracked!
PS: I'm currently working on creating an API proposal for dotnet/aspnetcore#57963 which might then also add other options for minimal API's in .NET 10: dotnet/aspnetcore#58724
Page URL
https://learn.microsoft.com/en-us/aspnet/core/fundamentals/openapi/aspnetcore-openapi?view=aspnetcore-9.0&tabs=visual-studio%2Cminimal-apis
Content source URL
https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/fundamentals/openapi/aspnetcore-openapi.md
Document ID
27bad30c-e0b4-10fb-b202-a29d4f8fad24
Article author
@captainsafia
The text was updated successfully, but these errors were encountered: