I like a one to one mapping between my controllers and actions, e.g. I have a controller to add an entity, delete an entity, and so on.
I wired up Swagger support for my .NET Core API per Adding Swagger to ASP.NET Core 3.1 Web API (coderjony.com).
When I view the Swagger documentation in the browser, my Controllers are grouped by the Controller Name.
I would really like these Controllers to be grouped under a single heading called Drills.
The first thing I needed to do as add the ApiExplorerSettings
attribute with a value for GroupName
.
In my case, I set GroupName
to Drills
.
Then I added support to my Startup
file to display the groups.
When I rerun my API, I know have my methods grouped together, which makes my API a lot easier to work with.
Thanks for reading, hope it helps you out!
Discover more from Matt Ruma
Subscribe to get the latest posts sent to your email.
amazing. You hold information the rest of the internet does not. Thank you.