-
Notifications
You must be signed in to change notification settings - Fork 250
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
Generated sidebar order is not as expected #199
Comments
Hi @thomasheartman, thanks so much for the detailed issue. I think "sorting the sidebar before finishing up" makes the most sense, and should be easy to implement. My guess is that it's a combination of async and un-ordered objects that's the root cause, but we'll make sure. |
@sserrata Thanks for the quick follow-up! And glad that it seems easier than expected 😁 If you can sort alphabetically, then that solves my problem for now, but I had a thought that it might make the most sense for the order to be the same as the spec. That way, the creators have full control. But I'm not sure I'm convinced myself 😅 I'll leave how to solve it up to you; just thought I'd mention that as a point of view |
Hi @thomasheartman, after discussing internally we also determined it would be best to maintain the natural order of the tags in the OpenAPI spec. I just pushed a couple of changes to implement this and will merge after a bit more testing. |
|
Fantastic! Thanks for the quick turnaround on this 🙌🙌 I'll see if I can't take it for a spin tomorrow 😁 And yeah, I think you landed on the right decision I regards to the ordering. We already sort ours, so it's the same for us, but this way, it is more flexible. Good work 💯 |
Just wanted to mention that I took 0.0.0-420 for a spin and i seems to work perfectly here 🙋🏼 Thanks again for the help with it! 🙌🏼 Do you know roughly when it'd be released as a full version? And now that we're talking about ordering, I had a look at the order of operations under each tag and started wondering about how they're ordered. From what I can tell, this ordering depends on the order in which the operations appear in the spec. It also seems consistent with Swagger UI's ordering. I think this is probably the right way to do it, but it wasn't immediately obvious how that ordering happens, so that might be worth noting in the docs. |
Thanks for the feedback. The change introduced another regression bug that manifests when using I'm finalizing the testing for the new bug and should have something out soon. That said, we should also have a new release out by end of day today. |
Oh, interesting; I did not know about x-displayName! Thanks for the heads up 😄 And nice! I see 1.1.5 is out and that the predefined ordering functionality is included. Amazing; thanks again! 🙏🏼 |
Describe the bug
When using this package to generate a sidebar from an openapi spec (grouping by tags), the order of the items in the sidebar does not match the order of the tags in the spec, nor are they listed alphabetically (or in some other, easily recognizable format)
Note: It may be that I've just missed the setting for this, but I couldn't find anything relating to 'sorting' in the readme. If this can be done today, please point me to the right place in the docs☺️
Expected behavior
The generated sidebar should have the tags listed in one of three ways:
Current behavior
The order appears random.
Possible solution
I haven't had a look at the code yet, so I don't know what causes it, but if the code is asynchronous, that may be a cause. I suggest sorting the sidebar before finishing up. I would expect one of the three options mentioned above.
Steps to reproduce
Spec with tags
Note: the tags section specifically looks like this:
docusaurus.config.js
sidebars.js
entryScreenshots
Generated sidebar order in rendered docusaurus:
Swagger UI's order of the same tags:
Context
I would like the categories to be sorted alphabetically so that it makes it easier to find what you're looking for. I can imagine cases where you want a different sort order or a different specific order, but my use case is for alphabetic sort specifically.
Your Environment
Edit
Accidentally submitted before I finished typing it up.
The text was updated successfully, but these errors were encountered: