Skip to content
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

Add ProducesResponseType Description documentation #35009

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

sander1095
Copy link
Contributor

@sander1095 sander1095 commented Mar 19, 2025

The "What's new in .NET 10" release notes mention the new Description property I added, but the .NET 10 OpenAPI docs do not.
This commit adds consistency.

I've added examples for ProducesResponseType and ProducesDefaultResponseType to Minimal API and Controller docs. I know a team member doesn't like ProducesDefault (@mikekistler, dotnet/aspnetcore#58719 (comment) ).

I also know that another team member (@captainsafia , dotnet/aspnetcore#58724 (comment)) would prefer developers to use the endpoint-specific OpenAPI transformers (Which will be released in a future preview) instead of setting the Description for Minimal API's, as they are more extensible.

Therefore, I'd like to discuss the following:

  • Should we choose to NOT showcase code examples for ProducesDefault? This way, we make it clear that it IS possible by mentioning it's existance, but also "discourage" developers from using it by not showing any explicit code examples.
  • I believe it's important to update both the Controllers and Minimal API docs and highlight this new Description property. However, when Support registering OpenApiOperationTransformer via extension method for Minimal APIs aspnetcore#59180 lands in a future preview, I'd propose we update this page and mention that THAT approach is preferred over the Description property in Minimal API scenario's.

Fixes #33974
Fixes #35016


Internal previews

📄 File 🔗 Preview link
aspnetcore/fundamentals/openapi/include-metadata.md aspnetcore/fundamentals/openapi/include-metadata

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
The "What's new in .NET 10" release notes mention the new Description property I added, but the .NET 10 OpenAPI docs do not.

This commit adds consistency
@sander1095
Copy link
Contributor Author

I've had issues with the moniker for .NET 10 in a previous PR. I see the build fails here, and I assume it is for the same reason, as I can't get any useful info about the error in the failed pipeline. I might need some help with that :)

@sander1095
Copy link
Contributor Author

Sidenote: .NET 10 Preview 1's ProducesResponseType now has a Description attribute, but I do not see this in the docs.

When I click on the Version dropdown and select ASP.NET Core 10, it quickly shows "ASP.NET Core in .NET 10.0 Preview` and switches back to NET 9.0. Have the docs not been updated yet?

@guardrex
Copy link
Collaborator

Hello @sander1095 ... The build warnings this morning are appearing on all of our PRs and are unrelated to what you're submitting. A member of our team will file an internal bug report on them.

@guardrex guardrex requested a review from captainsafia March 19, 2025 12:46
@guardrex guardrex closed this Mar 19, 2025
@guardrex guardrex reopened this Mar 19, 2025
@guardrex
Copy link
Collaborator

@captainsafia ... No giant rush, just making sure that you saw the ping on this one.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@guardrex
Copy link
Collaborator

I added a very quick pass to update code spacing and a few other NITs 😈.

@guardrex
Copy link
Collaborator

guardrex commented Mar 25, 2025

Looks like we'll still need a What's New article entry for this in ......

https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/release-notes/aspnetcore-10/includes/openApi.md

Nevermind! ... I see it now. It's in a different file ...

https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/release-notes/aspnetcore-10/includes/responseDescProducesResponseType.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants