-
-
Notifications
You must be signed in to change notification settings - Fork 97
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
Tags are sorted in 'random' order in OpenAPI. #882
Comments
I wonder if this is more the responsibility of the OpenAPI UI generator instead? I think the current implementation keeps the paths in the order they are passed to the call to |
As far as I can see the Would you be open for a PR? I can make something locally and confirm I can ensure an user defined order (defaulting to just a String |
This is the piece of code (in
|
Right, the Do you think it would be enough to just keep the order in which the endpoints are passed to the |
The original order would be good enough for me (we just pass it alphabetically ourselves). So what is your proposal? Use |
Yes, sorry if that was not clear, but if keeping the original insertion order works for you that would be a simple solution (we could make it more sophisticated in the future if needed). So yes, you will have to use a |
NP :) I still think we might misunderstand each other. To be clear, we need a PR in endpoints4s to make this possible. The Map implementation in the Shall I make a PR? I think it is just a one-liner |
I thought we could change the implementation of |
Yes, I think so too, I will try 😄 |
Currently the endpoints documentation contains a map of tag name to PathItem:
Since this uses a map underneath the tags appear random in the resulting openAPI (see for example https://otm5.opentripmodel.org/, which is btw a nice example of what endpoints4s can achieve!). This order also changes if a new tag is added since Maps are unordered in their keys.
I think it would be quite nice if we can sort the keys, for example alphabetically, so it looks a little more tight. I would also be willing to implement this feature myself.
My suggestion would be to add an optional 'sorting' to the OpenApi class that is used when present.
The text was updated successfully, but these errors were encountered: