Skip to content

Skip to set default value unless meets_dependency? - #2097

Merged
dblock merged 2 commits into
ruby-grape:masterfrom
wanabe:default-in-given
Aug 20, 2020
Merged

dblock merged 2 commits into
ruby-grape:masterfrom
wanabe:default-in-given

Conversation

@wanabe

@wanabe wanabe commented Aug 20, 2020

Copy link
Copy Markdown
Contributor

Hello,

Grape::Validations::Base#validate! calls #validate_param! only if @scope.meets_dependency?(val, params) is truthy.
But Grape::Validations::DefaultValidator#validate! ignores the cope dependency now.

It doesn't matter in most cases because of @scope.should_validate?, but this is not the case for an array that contains both matching and non-matching conditions.
So I guess Grape::Validations::DefaultValidator#validate! should the check scope dependency as same as Grape::Validations::Base#validate!.

How about it?

@dblock
dblock merged commit fe6a4a4 into ruby-grape:master Aug 20, 2020
@dblock

dblock commented Aug 20, 2020

Copy link
Copy Markdown
Member

Thanks for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants