-
Notifications
You must be signed in to change notification settings - Fork 15
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
Sorting by tags? #119
Comments
Can you give me an example of what would the tags look like and the expected result? Or share your playground? |
Simply put - these 2 endpoints are out of order. The tags for the first path are alphabetically after the tags for the second. I'd want all of the paths sorted by the |
@jnardone That sounds like a logical use-case, let me explore some options. |
hi @jnardone I'm working on extending openapi-format to allow the sorting of the paths by alphabet or by tag name. How would you envision configuring the order of paths by ...? My idea was to add "sortPaths" property to be passed along via |
A follow-up question, since "Tags" can have multiple items, the sorting can only be applied by one 1 Tag item. |
That is what I’ve been doing manually, taking the first action (get, post, etc) and the first tag of that. On Aug 1, 2024, at 6:15 AM, Thim ***@***.***> wrote:
@jnardone
A follow-up question, since "Tags" can have multiple items, the sorting can only be applied by one 1 Tag item.
I would propose to take the 1ste item, or do you have other use-cases in mind?
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***>
|
hi @jnardone I added the option to sort paths alphabetically or by tag, by passing Would this solve your use-case? |
hi @jnardone We just release 1.22.0 of openapi-format, which includes the option to sort paths alphabetically or by tag. |
You can play with it at the online playground https://openapi-format-playground.vercel.app/ and select on the left the desired paths ordering. |
@thim81 this looks great. One question, not sure of the right answer. Should tags be sorted with respect to case, or not? Should "API" be before "Aaa"? Personally I think it should be case-insensitive but I can see it both ways. |
That is a difficult question, since there might be personnel preferences involved. openapi-format strives for consistency, so currently it will sort like this: "API", "Aaa", "Zebra", "aaa", "zebra" Which means:
Other options could be:
|
hi @jnardone Curious if you had some input on the above options? |
Honestly I see it both ways. To me tags are more case-insensitive so to me I'd want API to be after "Amount" for example but I'm hesitant to say that there should only be one way to do it. I guess I'd rather have it as an option but as a developer I know that all of these choices get complicated. |
@miriamgreis, wonder which type of ordering you would expect with cased elements? |
@thim81 I'm not sure. I guess I would also prefer case-insensitive as it seems to be more user-friendly. But on the other hand lots of tools use case-sensitive sorting due to the technical implementation. I'm not sure it's really worth changing it or offering different possibilities. Most viewers also display the tags in the order they appear in the OpenAPI file. It might make sense to consider sorting the paths in the order of the global tags instead of alphabetically by tags. Because tag order might have a relevance as people want to show more general operations first and specialised ones later, so it's probably not necessarily alphabetically. |
The viewer I use groups items by tag; I would like to take my definition file and sort it by the tags value for each path.
Is that possible using this tool? I played around with the online sandbox and could not figure out a way.
The text was updated successfully, but these errors were encountered: