-
-
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
regression: parameters bound by given
always applied/checked when nested
#1659
Labels
Comments
jnardone
changed the title
regression: "given" checks fail with nested parameters
regression: parameters bound by Jul 13, 2017
given
always applied/checked when nested
Thanks for the great write-up! #1661 should resolve this, and has some explanation as to why it regressed. |
dblock
pushed a commit
that referenced
this issue
Jul 14, 2017
* Repro issue #1659 * [Fix] Handle deeply-nested dependencies with `given`. Behind the scenes, each call to `requires` or other params DSL method pushes an entry onto a flat list of validators. The nesting structure that your parameters can take on is tracked as an up-tree separately on each scope, but that relationship isn't used to traverse the validations. So, when I moved the dependency checking out of `should_validate?` and into the actual validation, the `given` dependency stopped taking effect after you nested parameters more than one level deep underneath. To restore the behavior, I made the validation check recursively upwards to see if it should or should not validate that scope. * Add changelog entry.
Closed via #1661 |
jdurand
pushed a commit
to jdurand/grape
that referenced
this issue
Jan 25, 2019
* Repro issue ruby-grape#1659 * [Fix] Handle deeply-nested dependencies with `given`. Behind the scenes, each call to `requires` or other params DSL method pushes an entry onto a flat list of validators. The nesting structure that your parameters can take on is tracked as an up-tree separately on each scope, but that relationship isn't used to traverse the validations. So, when I moved the dependency checking out of `should_validate?` and into the actual validation, the `given` dependency stopped taking effect after you nested parameters more than one level deep underneath. To restore the behavior, I made the validation check recursively upwards to see if it should or should not validate that scope. * Add changelog entry.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is a regression from 0.19.2 -> 1.0.0
Consider a declaration like:
The parameters for "inner1" / "inner2" should only be applied when the
given
block matches, but in the nested case (like above) the parameter validations are always applied even if they do not match thegiven
criteria.For example, doing a request where
a
isx
, you will get a 400 withinner2[bar] is missing, inner2[bar] is empty
Seems like this must have broken with #1625 @rnubel @avellable ?
The text was updated successfully, but these errors were encountered: