-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
cannot write custom validator for required parameter #778
Comments
This smells like a bug. Would be helpful if you could turn this into an RSpec spec in a pull request, please. |
Here some specs - https://github.com/intridea/grape/blob/master/spec/grape/validations_spec.rb#L230 /cc @bwalex PS if we'll skip this condition(single argument) all specs are green. |
* I'm not sure what I was thinking originally, but this obviously breaks the use of custom validators. * Add a spec for ruby-grape#778 whilst on it.
Address #778 - don't restrict options to Hash/Array types
@siemionides things should work now that #799 has been merged. Give that a spin and let us know if it works for you. |
I believe this is fixed, closing. |
strange thing.
in my params block
I'm trying to use custom validator
date_range_proper_order
in order to validate following JSON:so the
from
wouldn't be lower thanto
.Here's the validators code
That works as expected. However, if I change
optional
intorequires
for:date_range
, the Grape won't run and it will throwWhich points directly to the
optional
andrequires
line of code.Why is that? Why cannot I use custom validator for required paramer (a Hash?)
I've created the issue on StackOverflow (http://bit.ly/1oPHxQX) but no help frmo there so far, so I published it in here
The text was updated successfully, but these errors were encountered: