We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi,
when defining multiple groups as:
@Bean public GroupedOpenApi openApiServices() { return GroupedOpenApi.builder() .setGroup("Group Name A") .pathsToMatch("/some/path/pattern/**") .build(); }
it seems to result in an arbitrary ordered list of groups in swagger config, as in example:
"urls": [ { "url": "/sasmd/v3/api-docs/9-Actuator", "name": "9-Actuator" }, { "url": "/sasmd/v3/api-docs/2-Security", "name": "2-Security" }, { "url": "/sasmd/v3/api-docs/1-Other", "name": "1-Other" } ]
I would like as the default behavior to sort the groups by name.
A possible solution would be to change org/springdoc/core/SwaggerUiConfigProperties.java:376 (see: 26d58f2):
org/springdoc/core/SwaggerUiConfigProperties.java:376
swaggerUrls = swaggerUrls.stream().filter(elt -> StringUtils.isNotEmpty(elt.getUrl())).sorted().sorted(Comparator.comparing(SwaggerUrl::getName)).collect(Collectors.toList());
maybe also a "order" attribute on the GroupedOpenApi.builder() would be nice to have.
GroupedOpenApi.builder()
Best, -Stefan
P.S.: if you like the idea and would prefer a pull request, let me know. Thanks.
The text was updated successfully, but these errors were encountered:
Hi @stefan-huettemann,
The groups will be sorted by name (natural order) from the next release. By default, the sort order will be ascending.
If you need to change the order, the following property is introduced:
springdoc.swagger-ui.groups-order=DESC
Sorry, something went wrong.
2369422
I figured out, the sort is based on the name, not on Display-Name. For me, it makes more sense to sort the displayed group name.
For some reason AbstractSwaggerUiConfigProperties.Direction doesn't have public access, so this technique can't be used programmatically.
No branches or pull requests
Hi,
Problem: unsorted groups
when defining multiple groups as:
it seems to result in an arbitrary ordered list of groups in swagger config, as in example:
I would like as the default behavior to sort the groups by name.
Solution
A possible solution would be to change
org/springdoc/core/SwaggerUiConfigProperties.java:376
(see: 26d58f2):Alternatives
maybe also a "order" attribute on the
GroupedOpenApi.builder()
would be nice to have.Best,
-Stefan
P.S.: if you like the idea and would prefer a pull request, let me know. Thanks.
The text was updated successfully, but these errors were encountered: