Skip to content

Add description to ProducesResponseTypeAttribute #40836

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

Closed
1 task done
mu88 opened this issue Mar 23, 2022 · 1 comment
Closed
1 task done

Add description to ProducesResponseTypeAttribute #40836

mu88 opened this issue Mar 23, 2022 · 1 comment
Assignees
Labels
old-area-web-frameworks-do-not-use *DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels
Milestone

Comments

@mu88
Copy link

mu88 commented Mar 23, 2022

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe the problem.

When using the ProducesResponseTypeAttribute, the generated OpenAPI doc does only contain a very basic description (Success, etc.). When describing something more elaborate, XML documentation comments have to be used, e. g. /// <response code="200">describe something important</response>. But the value for the code attribute only accepts pure numbers, not enums - I cannot write /// <response code="HttpStatusCode.Success">describe something important</response>. This makes refactoring harder to accomplish.

Describe the solution you'd like

Therefore it would be great to have a property like Description on the ProducesResponseTypeAttribute. This property could be picked up by Swashbuckle/OpenAPI.

The result would look like this: [ProducesResponseType(HttpStatusCode.Ok, "describe something important")]

Additional context

No response

@javiercn javiercn added the old-area-web-frameworks-do-not-use *DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels label Mar 23, 2022
@rafikiassumani-msft rafikiassumani-msft added this to the 7.0-preview4 milestone Mar 31, 2022
@captainsafia
Copy link
Member

@mu88 Thanks for reporting this issue!

Therefore it would be great to have a property like Description on the ProducesResponseTypeAttribute. This property could be picked up by Swashbuckle/OpenAPI.

At the moment, we're not planning on making any changes related to OpenAPI in the response type attributes. A lot of future work in this area is centered around what we are pursuing in #40676.

Now, specifically as it relates to the XML comment, I would recommend filing an issue on the Swashbuckle repo. The logic for XML-based documentation lives in Swashbuckle so your best bet for identifying a fix lives there.

@ghost ghost locked as resolved and limited conversation to collaborators May 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
old-area-web-frameworks-do-not-use *DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels
Projects
None yet
Development

No branches or pull requests

4 participants