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

Raise validation error when optional Hash type parameter is received String type value and exactly_one_of be used #1822

Conversation

woshidan
Copy link
Contributor

Add spec and fixes #1821 .

When String type was given instead of Hash type value, the item in scoped_params becomes String type and will be crashed due to not having any? method.

@dblock
Copy link
Member

dblock commented Nov 21, 2018

Looks good, needs a rubocop -a ; rubocop --auto-gen-config and a CHANGELOG entry. Thanks.

@woshidan
Copy link
Contributor Author

@dblock I've applied a rubocop lint and add a entry to CHANGELOG.md.

@dblock
Copy link
Member

dblock commented Nov 21, 2018

Great branch name! ;)

@dblock dblock merged commit e8acc11 into ruby-grape:master Nov 21, 2018
basjanssen pushed a commit to basjanssen/grape that referenced this pull request Feb 28, 2020
…String type value and exactly_one_of be used (ruby-grape#1822)

* adds test for exactly_one_of validator with nested and optional parmeters

* add check if the parameter responds to any? method in MultipleParamsBase#scope_requires_params to handle nested invalid parameter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants