I am using SwaggerUI for documenting API endpoints. Currently they are grouped by controller name, in one long list. You can then expand each controller to view the operations. Everything standard.
What I would like to do, is group the controllers under common expandable groups.
So for example, you have a Pet group, which can be expanded, to reveal Cat and Dog controllers, which can then in turn be expanded to show their respective operations.
I have tried using Tags to accomplish this, but the best I can get is all operations grouped under one expandable group.
Does anyone know if this is possible with the standard swaggerUI? Or would I need to create custom HTML to accomplish this?
I assume you are using Swashbuckle? What you need is to implement IDocumentFilter. Look in to the tags om the Swagger 2.0 Spec.
From the docs:
DocumentFilter
Post-modify the entire Swagger document by wiring up one or more Document filters.
IDocumentFilter has the following interface:
This gives full control to modify the final SwaggerDocument. You can gain additional context from the provided
SwaggerDocument
(e.g. version) andIApiExplorer
. You should have a good understanding of the Swagger 2.0 spec. before using this option.