Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove controller list from Swagger UI

Tags:

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:

Controller list to remove/hide

while keeping this:

REST api docs to keep

I digged through online docs, GitHub issues, StackOverflow questions, Google... nothing. Am I the only with this request?

like image 846
think01 Avatar asked May 08 '18 08:05

think01


People also ask

How do I remove models from Swagger UI?

To hide the "Models" section, add defaultModelsExpandDepth: -1 to the Swagger UI configuration code in your index. html . Note the option name uses plural Model*s* not Model . Swagger UI also has many other configuration options that control API documentation rendering.

How do I hide the action method in Swagger?

By adding this attribute on a controller or action and specifying IgnoreApi = true , it gets hidden from auto-generated documentation. However, this user has to apply this to around 80 controllers.


1 Answers

Try this attribute on the controller

[ApiExplorerSettings(IgnoreApi = true)]

like image 184
Victor Oniagba Avatar answered Sep 25 '22 17:09

Victor Oniagba