'How to remove controller list from Swagger UI
I'm using springfox-swagger-ui 2.8.0 which ships with Swagger UI 3.7.0.
I want to get rid of the controller list in front of the api documentation page, pretty useless for me (every tab is empty).
I've already tried to annotate the controller class with @ApiIgnore, but of course this removes the rest api documentation as well, which I need.
Basically, I want to remove this:
while keeping this:
I digged through online docs, GitHub issues, StackOverflow questions, Google... nothing. Am I the only with this request?
Solution 1:[1]
Add the attribute description to @Api
:
For example:
@Api(value = "Test API Controller", produces = MediaType.APPLICATION_JSON_VALUE, tags = {"test-api-controller"}, description = "Testing API")
Solution 2:[2]
Try this attribute on the controller
[ApiExplorerSettings(IgnoreApi = true)]
Solution 3:[3]
on springfox v3.0 tried almost every annotations and finally
@ApiIgnore annotation works.
Don't know why @Api(hidden=true) doesn't work.
import springfox.documentation.annotations.ApiIgnore;
@ApiIgnore
@Responsebody
public Object ...{}
Solution 4:[4]
I expected the hidden
attribute will work but it doesn't. I also tried to set description
and also doesn't work.
Another solution is to use the tag
in the @Api can help you temporarily hide this rest-controllers list and categorize your APIs in different tags.
Solution 5:[5]
springfox api version 2.9.2
works with the below example by adding on a controller class
@Api(value = "Test API Controller", tags = {"test-api-controller"}, description = "Testing API")
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Vinay Prajapati |
Solution 2 | Victor Oniagba |
Solution 3 | |
Solution 4 | Tran Ho |
Solution 5 |