Fix grape-route-helper route shadowing
What does this MR do?
Fixes a bug on grape-route-helpers gem in which a route with less arguments can shadow another route with more arguments but the same name (example: api_v4_projects_merge_requests_path(id: 1, merge_request_iid: 2)
and api_v4_projects_merge_requests_path(id: 3)
)
Are there points in the code the reviewer needs to double check?
The tests I added depend on existing API routes and so run the risk of breaking if these routes are changed
Why was this MR needed?
I attempted to fix this bug upstream but the project is abandoned. Since it's only a one-line fix I opted to monkey-patch the fix directly inside the pre-existing grape_route_helpers_fix.rb
file.
This bug can be surprising when using grape-route-helpers as you would expect a route with the same name but more params than another to work. Instead though the route ends up shadowed and requires the developer to set a different name explicitly in order to be able to access it.
Screenshots (if relevant)
Does this MR meet the acceptance criteria?
-
Changelog entry added, if necessary -
Documentation created/updated -
API support added -
Tests added for this feature/bug - Review
-
Has been reviewed by UX -
Has been reviewed by Frontend -
Has been reviewed by Backend -
Has been reviewed by Database
-
-
Conform by the merge request performance guides -
Conform by the style guides -
Squashed related commits together -
Internationalization required/considered -
End-to-end tests pass ( package-qa
manual pipeline job)