ruby-grape / grape-swagger

Add OAPI/swagger v2.0 compliant documentation to your grape API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wrong route ordering

pavelbabin opened this issue · comments

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"

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

@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.

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 ;)