Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GroupedApi orders by displayName instead of name #2576

Open
juocal opened this issue Apr 18, 2024 · 0 comments
Open

GroupedApi orders by displayName instead of name #2576

juocal opened this issue Apr 18, 2024 · 0 comments

Comments

@juocal
Copy link

juocal commented Apr 18, 2024

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"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant