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.

The path order in the yml API is not ordered and does not match the path in the UI

See original GitHub issue

Hello,

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:

image

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:

image

image

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:open
  • Created 5 years ago
  • Reactions:2
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
kesuskimcommented, Apr 5, 2019

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.

1reaction
Herrick19commented, Sep 16, 2021

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 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Java SecurityException: signer information does not match
Right click the project. Open [Java Build Path]. Click Order and Export. Then push JUNIT to upper priority.
Read more >
OpenAPI Specification - Version 3.0.3 - Swagger
Each template expression in the path MUST correspond to a path parameter that is included in the Path Item itself and/or in each...
Read more >
Troubleshooting CI/CD - GitLab Docs
The path of the project is in the format my-group/my-project and does not include any folders in the repository. The user running the...
Read more >
Spring Cloud Gateway
By default, the RemoteAddr route predicate factory uses the remote address from the incoming request. This may not match the actual client IP...
Read more >
YAML Ain't Markup Language (YAML™) revision 1.2.2
There are no normative changes from the YAML specification v1.2. ... (2) the path leading from the root to the node and (3)...
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