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

[Feature request]: Support for OpenAPI Description in [ProducesResponseType], [Produces], and [ProducesDefaultResponseType] Attributes #3099

Open
sander1095 opened this issue Oct 9, 2024 · 1 comment

Comments

@sander1095
Copy link

Is your feature request related to a specific problem? Or an existing feature?

Currently, in ASP.NET Core, the [ProducesResponseType], [Produces], and [ProducesDefaultResponseType] attributes enrich OpenAPI documentation by specifying response status codes, response types, and content types for controller actions. However, they lack support for OpenAPI's description property, which is vital for providing detailed context about the responses.

For instance, when an API returns a 422 status code, it is beneficial to include a description explaining why the error was triggered, enabling better client-side error handling. Currently, there is no standardized way to annotate response descriptions through these attributes.

Although some libraries (e.g., Swashbuckle) offer custom attributes like [SwaggerResponse] that support descriptions, these attributes are library-specific, potentially leading to compatibility and maintenance issues.

I'm working on dotnet/aspnetcore#55656, which adds Description to these attributes. By introducing support for the Description property within these attributes, we can enrich OpenAPI documentation directly in ASP.NET Core in a library-agnostic way, improving developer experience and simplifying API documentation.

Describe the solution you'd like

Swashbuckle.AspNetCore needs to support this new Description property

Additional context

No response

@martincostello
Copy link
Collaborator

We can consider supporting this once your PR is merged and we start-up a development branch for .NET 10 (probably Februrary/March 2025 once preview 1 ships).

@martincostello martincostello added this to the Future milestone Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants