The path order in the yml API is not ordered and does not match the path in the UI
See original GitHub issueHello,
I don’t know if this is a bug or en enhancement, but here it is
Description of the issue
Let’s say I want to create an API with four paths:
POST /bar
GET /bar/{id_bar}
POST /foo
GET /foo/{id_foo}
But let’s consider I insert them using the UI in this specific order:
GET /foo/{id_foo}
POST /bar
GET /bar/{id_bar}
POST /foo
The UI is nice and the paths appear sorted, matching what I want:
But, the resulting yml is not ordered and doesn’t match what appears in the UI:
openapi: 3.0.2
info:
title: 'Test API'
version: 1.0.0
paths:
'/foo/{id_foo}': {}
/bar: {}
'/bar/{id_bar}': {}
/foo: {}
Normally, I would not really care about the order of the paths in the raw yml file
But the thing is that ReDoc follows the order of the paths in the yml
So the resulting documentation is not ordered:
This is a problem because once an API starts living, some paths are updated, some are deleted and some are created
This means that the resulting documentation is quickly becoming a garbled mess
What can be done
I have a few ideas, they’re far from perfect but it’s a start
Maybe we can build on them and elaborate
- Always sort the outputted API
Pros: Easy to implement (I think?)
Cons: Users are unable to chose their own ordering - Add an option to sort the paths in the outputted API
Pros: Easy to implement (I think?)
Cons: The user is not able to change the order of individual paths - Modify the UI so that the displayed paths are not ordered,
and add a button to sort everything + buttons to move individual paths up and down Pros: Would solve everything
Cons: Hardest to implement (I think?)
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:6 (2 by maintainers)
Top GitHub Comments
I ran into this issues as well; my observation on this is that APICURIO just appends new definition to current YAML in either when we create new paths; or when we totally replace yaml (for example for individual path if I modify something from ‘source’ tab).
I manually manipulate database to fix this after I modify YAML myself (then update the column), and somehow everything broken up that I have to remove project and restart again.
As @EricWittmann said I think it is best to sort the paths and other lists before handing the content to ReDoc, or we could use another button in ‘source’ tab next to ‘Format’ button (maybe naming as ‘Sort Paths’), that we can handle by ourselves.
I’ve ran in this issue today and I see no one commented since more than 2 years.
Doesn’t seem like a very popular feature request, but add my voice to it 😃