Forum Discussion

Merryheartiam's avatar
Merryheartiam
New Member
7 months ago

GROUPING CONTROLLERS INTO SEPARATE SWAGGER UI PAGES

scenario:

Suppose I have 5 controllers

Controller A, B,C,D,E respectively.

Each controller above have 4 methods

Total methods in the swagger ui  page =20

Total controllers in swagger ui  page =5

How do I group controller A and B to only appear on a different swagger ui page and then controller C,D,E to also be on a different swagger ui page

In summary how do I achieve this below

Swagger UI Page X ( should have controller A and B, Controller A should have 4 methods, controller B should have 4 methods)

Swagger UI Page Y ( should have controller C , D, E  and Controller C should have 4 methods, controller D should have 4 methods and controller E should have 4 methods). 

Above is my objective.

My setup is

Spring booth 3 , OpenApi 3 and I have used the available @Tag annotation like this below:

@Tag(name = "AUTOMATION", description = "Group 1")
public class AutomationControllerV1 {}

@Tag(name = "AUTOMATION", description = "Group 1")
public class AutomationControllerV2 {}

with the above implementation my result looks like this on the swagger UI page:

AUTOMATION ( controller name for AutomationControllerV1 and AutomationControllerV2)

and this AUTOMATION has 8 methods

in other words the 4 methods from AutomationControllerV1 and AutomationControllerV2 was combined together under the AUTOMATION group 1

 

 

 

 

No RepliesBe the first to reply