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

Sort paths by tags/operationId? #45

Closed
af-mikecrowe opened this issue Feb 15, 2022 · 6 comments
Closed

Sort paths by tags/operationId? #45

af-mikecrowe opened this issue Feb 15, 2022 · 6 comments
Assignees

Comments

@af-mikecrowe
Copy link

Is it possible to sort the paths deterministically? I'm thinking by tags then operationId?

@thim81
Copy link
Owner

thim81 commented Feb 15, 2022

Hi @af-mikecrowe

Currently openapi-format sorts the elements within OpenAPI in a certain order, for example as defined in the default

@af-mikecrowe
Copy link
Author

Right -- My question: Is it possible to expand to sort another level down? So, organize paths by Tag + OperationId, etc.

@thim81
Copy link
Owner

thim81 commented Feb 17, 2022

@af-mikecrowe

I have to review the sorting logic, since currently it does 1 sort for all elements on 1 level.

@thim81
Copy link
Owner

thim81 commented Aug 17, 2024

hi @af-mikecrowe

I added the option to sort paths alphabetically or by tag, by passing --sortFile with sortPathsBy: tags
Readme > https://github.com/thim81/openapi-format/tree/119-sort-path?tab=readme-ov-file#openapi-sort-paths
#121

You can play with it at the online playground https://openapi-format-playground.vercel.app/ and select on the left the desired paths ordering.

IMG-2024-08-06 at 11-14-10

Would this solve your use-case?

I considered sorting by "operationId", but it is not required, so what would be the expected behaviour with paths without it?

@thim81
Copy link
Owner

thim81 commented Aug 17, 2024

linked to #119

@thim81 thim81 self-assigned this Aug 17, 2024
@thim81
Copy link
Owner

thim81 commented Sep 10, 2024

Closing the issue.
We added option to sort by tags in release 1.22.0
If you're still experiencing problems, please feel free to reopen this issue or create a new one. Thanks for your contribution!

@thim81 thim81 closed this as completed Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants