You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Jakub (Jira)" <ji...@apache.org> on 2023/09/20 13:23:00 UTC

[jira] [Updated] (CAMEL-19888) Preserve openapi tags order while generating api-doc

     [ https://issues.apache.org/jira/browse/CAMEL-19888?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jakub updated CAMEL-19888:
--------------------------

PR: https://github.com/apache/camel/pull/11493

> 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
>   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)