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

Skip running param validators inside inactive given blocks (#1433) #1498

Merged
merged 2 commits into from
Sep 22, 2016

Conversation

jlfaber
Copy link
Contributor

@jlfaber jlfaber commented Sep 21, 2016

This should address both the primary issue identified in #1433, which was related to the type coercer, and related issues with allow_blank. In both cases, these validators were being run even when their scopes indicated they should not (since the associated given criterion had not been met).

Joe Faber added 2 commits September 21, 2016 16:18
Demonstrates failures when using given clause for params, especially
when they set allow_blank: false
Move should_validate? check to validator base class so it gets
called for all validators.  This replaces the custom code in
allow_blank, and adds it to validators where it didn't previously
get called (like coerce).
@jlfaber
Copy link
Contributor Author

jlfaber commented Sep 21, 2016

Hat tip to @andrew13nguyen for the UT code that demonstrates multiple type validators for the same parameter. I tweaked it to make the types different just to add another layer of chaos.

@dblock
Copy link
Member

dblock commented Sep 22, 2016

This is some excellent work @jlfaber & @andrew13nguyen. Merging.

@dblock dblock merged commit 5683154 into ruby-grape:master Sep 22, 2016
@jlfaber
Copy link
Contributor Author

jlfaber commented Sep 23, 2016

Thanks @dblock for the merge! Any chance we can get this tagged for release?

@jlfaber jlfaber deleted the bug/1433/given_block_validation branch September 23, 2016 18:17
@dblock
Copy link
Member

dblock commented Sep 23, 2016

We try not to release too often, but I'll queue this up for myself for this/next week. Usually that involves running grape next against a very large API I am looking at over here.

@dblock
Copy link
Member

dblock commented Sep 23, 2016

Of course if @namusyaka @dm1try @marshall-lee @adamgotterer want to cut a release before that go for it!

@namusyaka
Copy link
Contributor

👍 Great job!

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.

3 participants