-
-
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
implemented except in values validator #1486
Conversation
bb2370d
to
66b80d7
Compare
I don't know how to fix the danger error:
I can't even run danger on my local system:
|
66b80d7
to
5e997b9
Compare
@dblock any feedback? |
The danger problem fixed in #1480. Rebase. |
Overall this looks great. My biggest question is whether it should be
vs.
The latter would be consistent with how we do all options today. |
If I am understanding the difference in what you are suggesting, you are saying that: #1.) However, I don't find this consistent with the currently implementation in terms of tests: eg, https://github.com/ruby-grape/grape/blob/master/spec/grape/validations/validators/values_spec.rb#L26 requires :type, values: { value: ValuesModel.values, message: 'value does not include in values' } https://github.com/ruby-grape/grape/blob/master/spec/grape/validations/validators/values_spec.rb#L33 optional :type, values: { value: -> { ValuesModel.values }, message: 'value does not include in values' }, default: 'valid-type2' If you are interested in seeing values refactored, I can make that change, but the change you are asking is very different (and potentially breaking) to how it currently behaves. I maintain that the current PR is more consistent to how values validator is currently implemented. |
@dblock fixed all errors. This should be good to go unless you want me to refactor values. |
Yes you're totally right @jonmchan. Merging this, looks great. |
This implements the feature requested in #1485 .
Some notes:
except_message
is defined.values:
without thevalue:
key. Please ensure that line 5-8 of values.rb https://github.com/ruby-grape/grape/compare/master...jonmchan:feature/except?expand=1#diff-45b62b4ed0aed7ceff346c347f76570eR8 do not cause any incompatibility issues.values: []
accepts all passed parameters. Previous implementation,values: []
would reject every value. I figure nobody would be trying to create a parameter that would allow no value so I did not bother to maintain this functionality.