-
-
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
Don't fail even if invalid type value is provided #1249
Conversation
@@ -14,6 +14,7 @@ | |||
|
|||
* [#1216](https://github.com/ruby-grape/grape/pull/1142): Fix JSON error response when calling `error!` with non-Strings - [@jrforrest](https://github.com/jrforrest). | |||
* [#1225](https://github.com/ruby-grape/grape/pull/1225): Fix `given` with nested params not returning correct declared params - [@JanStevens](https://github.com/JanStevens). | |||
* [#1249](https://github.com/ruby-grape/grape/pull/1249): Don't fail even if invalid type value is provided - [@namusyaka](https://github.com/namusyaka). | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should specify the scope, it's only related to the params with default
validator
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Force pushed. @dm1try How about this? |
end | ||
subject.post '/optional_hash_without_default_outer_params' do | ||
{ zone: params[:phone][:zone] } | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can remove this declarition and put the expectations to this context
it 'does not fail even if invalid params are provided' do
expect { post '/optional_hash_without_default', optional_hash_without_default: '5678' }.not_to raise_error
expect(last_response.status).to eq(400)
expect(last_response.body).to eq({ error: 'optional_hash_without_default is invalid' }.to_json)
end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, thanks!! Fixed.
@namusyaka looks good to me, |
Don't fail even if invalid type value is provided
This fixes #1245