-
-
Notifications
You must be signed in to change notification settings - Fork 190
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
Dry::Validation::Contract reports an error for coercible integer strings, but only when a hash field fails validation #682
Comments
you should be using |
@flash-gordon I tried this and I'm still getting the same error:
But this appears to solve the problem:
Is that the correct usage? ( I want to validate that the parameter supplied to hash_field is a hash, but I don't want to run any deeper validation rules on that hash. |
For now, yes, but in 2.0.0 it won't work. |
Thanks, @solnic ! |
This seems to be an issue on |
So after some diving into this, it relates more into
The implementation for the method is in At this point in execution the block is defined in What seem to cause the issue is two-fold: some of the blocks yield a value that's being ignored up in the call chain and also those 2 blocks force an early return. I'm trying to work around the breakage that results from this (2 specs on |
@mereghost wow that's some major investigation right there! 🙇🏻 |
@mereghost Thank you for looking into this! |
Describe the bug
Hello. I'm running into an issue where a Dry::Validation::Contract reports an error for coercible integer strings, but only when a hash field fails validation. I've included some rspec tests below that demonstrate a few successful validation cases and one unexpected failure case .
To Reproduce
Expected behavior
Since string values of
'1'
and'2'
don't fail validation in my earlier tests, I would have expected those values to continue to be coerced properly in the failing test. The validation failure on the hash field seems to interfere with the integer validation.Is it possible that I'm doing something wrong? Or is this a bug? Thank you for taking a look.
My environment
The text was updated successfully, but these errors were encountered: