Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong route ordering #921

Open
pavelbabin opened this issue Feb 7, 2024 · 3 comments
Open

Wrong route ordering #921

pavelbabin opened this issue Feb 7, 2024 · 3 comments

Comments

@pavelbabin
Copy link

There is wrong ordering of routes.

For example - there is ordering in the resource I've set:

  1. GET users/
  2. GET users/:id
  3. POST users/
  4. POST users/:id/restore
  5. PUT users/:id
  6. DELETE users/:id

But grape-swagger is generating it like this:

  1. GET users/
  2. POST users/
  3. DELETE users/:id
  4. GET users/:id
  5. PUT users/:id
  6. POST users/:id/restore

The fix from #859 doesn't fix it completely. The order is still not the same as it was "declared"

@LeFnord
Copy link
Member

LeFnord commented Mar 3, 2024

mmh "wrong" isn't the right word here, cause it is only a different ordering … /
and this is always a running discussion, see for example here → #859

so if you mean to change it, please provide a PR for that and an explanation, why and what changed, thanks

@dchandekstark
Copy link
Contributor

@pavelbabin I'm not sure that Grape itself makes any guarantees with respect to route order - at least not in the documentation or test suite that I can see. FWIW, I agree that it would be useful to be able to rely on the declared order of routes.

@dblock
Copy link
Member

dblock commented Mar 5, 2024

Grape does mount, evaluate and match routes in the order they are declared in code. It would be nice if someone contributed some statements towards that to the docs ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants