Support mapping <returns> to response description #61920
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #61875.
This pull request enhances the handling of XML comments in OpenAPI operations by introducing support for
<returns>
and<response>
tags. It ensures that these tags are correctly applied to operations with single or multiple response values, improving the generated OpenAPI documentation. Additionally, the changes include updates to tests and snapshots to validate the new behavior.Enhancements to XML Comment Handling:
<returns>
tags to operations with a single response value, setting the response description to the<returns>
content. (src/OpenApi/gen/XmlCommentGenerator.Emitter.cs
,[src/OpenApi/gen/XmlCommentGenerator.Emitter.csR375-R381](https://github.com/dotnet/aspnetcore/pull/61920/files#diff-ccf1c2147f9ea676bdeaf8a0b062fc74276a1a893e4d0a6ef1fb56c96238162fR375-R381)
)Test Updates:
OperationTests.MinimalApis.cs
to include<returns>
and<response>
tags in XML comments for various methods. ([[1]](https://github.com/dotnet/aspnetcore/pull/61920/files#diff-cbc2066e28b3f7018a9c4e5f6f4f59f9127c8e288588fad01a21bd6ebfaafa2eR58)
,[[2]](https://github.com/dotnet/aspnetcore/pull/61920/files#diff-cbc2066e28b3f7018a9c4e5f6f4f59f9127c8e288588fad01a21bd6ebfaafa2eR77-R84)
,[[3]](https://github.com/dotnet/aspnetcore/pull/61920/files#diff-cbc2066e28b3f7018a9c4e5f6f4f59f9127c8e288588fad01a21bd6ebfaafa2eR180)
,[[4]](https://github.com/dotnet/aspnetcore/pull/61920/files#diff-cbc2066e28b3f7018a9c4e5f6f4f59f9127c8e288588fad01a21bd6ebfaafa2eR189)
)<returns>
and<response>
descriptions are correctly reflected in the OpenAPI documentation. ([[1]](https://github.com/dotnet/aspnetcore/pull/61920/files#diff-cbc2066e28b3f7018a9c4e5f6f4f59f9127c8e288588fad01a21bd6ebfaafa2eR242)
,[[2]](https://github.com/dotnet/aspnetcore/pull/61920/files#diff-cbc2066e28b3f7018a9c4e5f6f4f59f9127c8e288588fad01a21bd6ebfaafa2eR294-R298)
)Snapshot Updates:
<returns>
and<response>
handling in OpenAPI documentation. ([[1]](https://github.com/dotnet/aspnetcore/pull/61920/files#diff-91078e9702b9a55fe1478810252bc53840a02f9ec275358e87290d4950643d99R357-R363)
,[[2]](https://github.com/dotnet/aspnetcore/pull/61920/files#diff-6cb2107c6fba63ce6c32d3b4424c02829aa35cef07e10cd61f092e76c1cf2f1aR386-R392)
,[[3]](https://github.com/dotnet/aspnetcore/pull/61920/files#diff-f064ebd886f03280e4efcd140628d796a13e49aaa10f4c20188838a990a37741R476-R482)
,[[4]](https://github.com/dotnet/aspnetcore/pull/61920/files#diff-bda468be16591f7a2a3bf7c0e2e2d046b6782d19671195bec1872d574710f6e7R361-R367)
,[[5]](https://github.com/dotnet/aspnetcore/pull/61920/files#diff-0622f0edd663548006798f175b67c7aae385ff0fedfddc3c088d4cb83804b0d2R379-R385)
,[[6]](https://github.com/dotnet/aspnetcore/pull/61920/files#diff-dd65270661ebbe5d36535c06b2090a880101451ed1e4e9d9ba796348aaeb7945R387-R393)
)