rapi-doc / RapiDoc

RapiDoc -WebComponent for OpenAPI Spec
https://rapidocweb.com
MIT License
1.61k stars 271 forks source link

Feature Request: Add `sort-components`-attribute #977

Closed Maschga closed 4 days ago

Maschga commented 7 months ago

Hi, I use RapiDocs in render-style="focused" and I have activated show-components.

To sort items like requests or tags, there are the attributes sort-tags and sort-endpoints-by. However, there is no attribute that sorts components/schemas alphabetically. This would be a great help for the user if a documentation uses several components - in my case there are 60 randomly arranged ones.

Is it possible to add an attribute like sort-components?

Many thanks in advance! Maschga

wparad commented 7 months ago

Why not presort the tags and schemas in your spec, then doesn't it come out by default exactly as you have it?

Maschga commented 7 months ago

Hi, That would be possible but with 60 components it is a lot of manual effort to sort them. In addition, the question then arises as to why this feature should exist for tags and endpoints. After all, these can also be sorted manually.

wparad commented 7 months ago

Hi, That would be possible but with 60 components it is a lot of manual effort to sort them. In addition, the question then arises as to why this feature should exist for tags and endpoints. After all, these can also be sorted manually.

:shrug:, I don't honestly know, realistically there are so many different ways things can be sorted that it can be often a mistake to attempt to sort them.

I will say that we run a fork and we do automatically sort schema for components alphabetically. I guess we decided here, there is only one correct sort order.

Maschga commented 7 months ago

Alphabetical sorting will be used by the majority of users. The developers of Rapidoc will also have had this in mind for the "sort-tags" attribute:

To list tags in alphabetic order, otherwise tags will be ordered based on how it is specified under the tags section in the in the spec.

Link