[
https://issues.apache.org/jira/browse/CAMEL-19888?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claus Ibsen resolved CAMEL-19888.
---------------------------------
Resolution: Fixed
Thanks for reporting and the PR
> Preserve openapi tags order while generating api-doc
> ----------------------------------------------------
>
> Key: CAMEL-19888
> URL: https://issues.apache.org/jira/browse/CAMEL-19888
> Project: Camel
> Issue Type: Improvement
> Components: camel-openapi-java
> Affects Versions: 4.0.0
> Reporter: Jakub
> Priority: Minor
> Fix For: 4.0.1, 4.1.0
>
> Original Estimate: 10m
> Remaining Estimate: 10m
>
> In RestOpenApiReader.class, while aggregating the tags for api-doc, the
> HashMap is used instead of LinkedHashMap, which breaks the original order of
> the tags:
> {code:java}
> if (openApi.getTags() != null) {
> openApi.setTags(new ArrayList<>(
> openApi.getTags()
> .stream()
> .collect(Collectors.toMap(
> Tag::getName,
> Function.identity(),
> (prev, current) -> prev))
> .values()));
> }{code}
> A LinkedHashMap could be used instead:
> {code:java}
> if (openApi.getTags() != null) {
> openApi.setTags(new ArrayList<>(
> openApi.getTags()
> .stream()
> .collect(Collectors.toMap(
> Tag::getName,
> Function.identity(),
> (prev, current) -> prev,
> LinkedHashMap::new)
> .values()));
> } {code}
>
> There is no way of sorting the tags after that, and their order influences,
> for example, the UI of the swagger.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)