Swashbuckle.AspNetCore icon indicating copy to clipboard operation
Swashbuckle.AspNetCore copied to clipboard

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

Open sander1095 opened this issue 4 months ago • 5 comments

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 https://github.com/dotnet/aspnetcore/issues/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

sander1095 avatar Oct 09 '24 09:10 sander1095