The Swagger documentation in my project has multiple groups. There is a Docket
for each group and the endpoints (members of each group) are marked with a custom annotation. For example here is the Docket
for authentication group:
@Bean
public Docket authenticationApis() {
return new Docket(DocumentationType.SWAGGER_2)
.groupName("authentication")
.useDefaultResponseMessages(false)
.select()
.apis(RequestHandlerSelectors.withMethodAnnotation(AuthenticationApiGroup.class))
.paths(PathSelectors.any())
.build()
.apiInfo(apiInfo())
.securitySchemes(Collections.singletonList(securityScheme()))
.securityContexts(Collections.singletonList(securityContext()));
}
There is also a (default) Docket
for all available endpoints. The problem is that Swagger UI loads the most top group on default when I am calling the documentation URL .../swagger-ui.html
. In my case it is the authentication group, since the groups are sorted alphabetically. The desired behaviour is that the default group is loaded as the default API group. How could I achieve that?
I have tried to name the default Docket
with the .groupName("all")
so it's the most top group (all < authentication) but this solution is a bit "dirty" and in this case the documentation would have two duplicate groups (all and default).
Springfox 2.9.2
is used in the project.
My quick-and dirty hack:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With