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

namespace param validation doesn't propagate to nested Grape modules #1085

Closed
danielveleba opened this issue Aug 3, 2015 · 3 comments
Closed
Labels

Comments

@danielveleba
Copy link

Not sure if it is a bug or a feature, but I'd welcome if I could declare parameter validation even for nested API modules like below.

For the former code sample the UserId validator doesn't get called, while for the latter it does.
Behaves the same for builtin validators.

params do
  requires :user_id, type: String, user_id: true
end
resource 'user/:user_id' do 
  mount UserProfile
end
params do
  requires :user_id, type: String, user_id: true
end
resource 'user/:user_id' do 
  get '/' do 
  ...
  end
end

Thanks

@dblock
Copy link
Member

dblock commented Aug 3, 2015

I think it's an interesting corner case, mount-kind of inheritance is a bit hard to track, but if you can fix it without breaking anything else I would take it.

@dblock dblock added the bug? label Aug 3, 2015
@rnubel
Copy link
Contributor

rnubel commented Aug 3, 2015

I believe this fails for basically the same reason as #1050. I'd be curious if my patch from that issue also fixes this issue.

@namusyaka
Copy link
Contributor

Closed via #1422
Thanks for reporting the issue, and thanks @rnubel and @plukevdh for your efforts.
Please reopen this issue if you still have a problem.

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

No branches or pull requests

4 participants