Reputation: 13
I am using spring boot 2.1.6.RELEASE and swagger 2.9.2, everything is fine except that I want to simplify the content.
First, I want to remove the base URL
under title:
[ Base URL: localhost:7777/ ]
http://localhost:7777/v2/api-docs
And, I want the API blocks
and Models block
to be opened on visiting, not until I click the name.
And, I want the select a spec
list on the top banner to be removed or hidden.
I don't know if there is a way to do these with java API, I can't find any solution other place.
The picture I tried to upload:
Seems that I am not allowed uploading picture yet, don't blame me if the picture above is unavailable.
Upvotes: 0
Views: 785
Reputation: 13
here i find a class helping to configure swagger UI:
springfox.documentation.swagger.web.UiConfiguration
and here is my usage:
@Bean
public UiConfiguration uiConfig() {
return UiConfigurationBuilder.builder()
.deepLinking(false)
.displayOperationId(false)
.defaultModelsExpandDepth(1)
.defaultModelExpandDepth(1)
.defaultModelRendering(ModelRendering.MODEL)
.displayRequestDuration(true)
.docExpansion(DocExpansion.LIST)
.filter(false)
.maxDisplayedTags(null)
.operationsSorter(OperationsSorter.METHOD)
.showExtensions(false)
.tagsSorter(TagsSorter.ALPHA)
.validatorUrl(null)
.build();
}
Upvotes: 1