How can we control the order of rendering of paths in swagger-ui?
See original GitHub issueI have my paths directory structure as follows:
├── cities.js
├── auth
│ └── login.js
├── users
└── profile.js
When this gets rendered in swagger-ui, the paths can appear in some random sequence. I want to somehow make sure that all the paths related to auth are displayed first, then users paths and then cities paths. Is there any way I can configure this in express-openapi ?
Issue Analytics
- State:
- Created 5 years ago
- Comments:12 (7 by maintainers)
Top Results From Across the Web
Configuration - Swagger Documentation
Controls how the model is shown when the API is first rendered. (The user can always switch the rendering for a given model...
Read more >Swagger UI: How to custom sort resources - Stack Overflow
In render function, line 21766 of swagger-ui.js file (v2.2.6): // Workaround: alphabetically ordered tags this.api.apisArray.sort(function ...
Read more >Reverse order of properties <paths> and <components> in ...
The issue (swagger-api/swagger-ui#3325) regarding recursive rendering goes several years back. Would a behavior change be possible, ...
Read more >Using OpenAPI and Swagger UI - Quarkus
Controls how the model is shown when the API is first rendered. Environment variable: QUARKUS_SWAGGER_UI_DEFAULT_MODEL_RENDERING. Show more.
Read more >Swagger UI tutorial | Documenting APIs - Idratherbewriting.com
Demo of Swagger UI rendering an OpenWeatherMap OpenAPI specification ... In order to view a local OpenAPI file (rather than an OpenAPI file ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
My bad. It seems swagger-ui is honoring the ordering of tags. However, we are not. I checked the code and it seems we are constructing the tags array at root level as and when a new tag is encountered at the operation level.
https://github.com/kogosoftwarellc/open-api/blob/db057fece86cb9f49097c2ff9bdaabc634cc7d97/packages/openapi-framework/index.ts#L321
And the resulting JSON does not take into consideration the
tags
array at root level if we provide that in api doc. I should probably open a different issue for that and raise a PR for the same. Thanks!prs are welcome @mandeepm91