question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How can we control the order of rendering of paths in swagger-ui?

See original GitHub issue

I 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:closed
  • Created 5 years ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
mandeepm91commented, Feb 6, 2019

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!

0reactions
jsdevelcommented, Feb 6, 2019

prs are welcome @mandeepm91

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found