Description
Describe the bug
When creating multiple GroupedOpenApi, the resulting url list via /v3/api-docs/swagger-config
is not ordered corretly. It orders by the name
, but not by the displayName
attribute of the urls.
When using it with Swagger UI the dropdown menu is unordered, although a "groupsOrder" is configured.
To Reproduce
Create two groupedApi with names which are not in the same alphabetical order as the displayNames
:
@Bean
public GroupedOpenApi adminApi() {
return GroupedOpenApi.builder()
.displayName("yyyy - Admin Api")
.group("admin")
.pathsToExclude("/api/v1/**", "/v1/**")
.pathsToMatch("/api/v2/**", "/v2/**")
.build();
}
@Bean
public GroupedOpenApi yellowApi() {
return GroupedOpenApi.builder()
.displayName("aaaa - Yellow Api")
.group("yellow")
.pathsToExclude("/api/v1/**", "/v1/**")
.pathsToMatch("/api/v2/**", "/v2/**")
.build();
}
Now "yyyy - Admin Api" comes first in the list, and "aaaa - Yellow Api" comes second, as "admin" is alphabetically before "yellow".
- What version of spring-boot you are using?
Latest
Expected behavior
I expect to return a ordered list, ordered by the displayName
instead of the name
attribute.
In the above mentioned example, it should come the other way round: "aaaa - Yellow Api" first, "yyyy - Admin Api" second (given same groupsOrder and groupsOrder set to ASC.
Additional context
The relevant line is here:
This line was probably forgotten to change, when "displayName" was introduced, additional to "name"