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

Searching for helper stops with first possible match #22

Open
To1ne opened this issue Jan 16, 2018 · 1 comment · May be fixed by #21
Open

Searching for helper stops with first possible match #22

To1ne opened this issue Jan 16, 2018 · 1 comment · May be fixed by #21

Comments

@To1ne
Copy link

To1ne commented Jan 16, 2018

We have a route :id/repository/tags and a route :id/repository/tags/:tag_name, both generate the route helper api_v4_projects_repository_tags_path.

Calling api_v4_projects_repository_tags_path(id: 123) returns /api/v4/projects/123/repository/tags, but calling api_v4_projects_repository_tags_path(id: 123, tag_name: 'foo') returns the exact same path. While it actually should return /api/v4/projects/123/repository/tags/foo.

We have the grape endpoint defined get ':id/repository/tags' first and get ':id/repository/tags/:tag_name' below that. If we swap the order, the correct route helper is found and the correct path is returned depending on the parameters.

See the full grape definition here:
https://gitlab.com/gitlab-org/gitlab-ce/blob/547b458e254bdb271d8ff41e62217fa7f3cf9c87/lib/api/tags.rb#L13-40

@To1ne
Copy link
Author

To1ne commented Jan 16, 2018

I gonna try if I can create an PR for this soon.

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

Successfully merging a pull request may close this issue.

1 participant