Is there any way to hide the controller name in the swagger-ui.
My class is like this. I do not want my controller name on the ui.
@Api(tags = {"group"})
public class MyControllerName {}
I did check some existing answers. for ex: How to remove controller list from Swagger UI did not help at all.
CodePudding user response:
Create Docket
bean and assign to it custom ApiInfo
object, in this way:
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.basePackage("com.example.controller"))
.paths(PathSelectors.ant("/foos/*"))
.build()
.apiInfo(apiInfo());
}
private ApiInfo apiInfo() {
return new ApiInfo(
"My REST API",
"Some custom description of API.",
"API TOS",
"Terms of service",
new Contact("John Doe", "www.example.com", "[email protected]"),
"License of API", "API license URL", Collections.emptyList());
}
CodePudding user response:
This sould be good feature request to springfox team. If you need to customize the swagger-UI you should be doing it on your own.
Maybe the below steps are useful for someone.
- Go to https://github.com/swagger-api/swagger-ui
- Download the latest code
- customize whatever you want to customize
- package either as a web jar or as resources in your application
- create resource handler mapping if required