domaindrivendev / Swashbuckle.AspNetCore

Swagger tools for documenting API's built on ASP.NET Core
MIT License
5.25k stars 1.31k forks source link

Feature request - Custom/Global API Response Attributes #1223

Open Johnthefighter2019 opened 5 years ago

Johnthefighter2019 commented 5 years ago

Implement response “presets” that allow developers to manage and create custom valid responses and descriptions during swagger configuration. These presets could then be invoked by attaching a single attribute to a method.

This is partly influenced by Microsoft's addition of API Conventions referenced in: https://docs.microsoft.com/en-us/aspnet/core/web-api/advanced/conventions?view=aspnetcore-2.2

In addition, response descriptions could also be preset. I understand that descriptions can be built using the xml tag. I am suggesting that this feature could allow for general custom responses written by the developer - once - to apply globally through the simple addition of an attribute.

I have attached a file below depicting a typical use case.

IdealApiConvention.txt

jasonkcarter commented 4 years ago

I would also love to have support for ApiConventionType and ApiConventionMethod attributes added to swashbuckle. They make the code so much more readable.

HunteRoi commented 3 years ago

Any update for this request?