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
Unexpected error when hash validation fails #325
Comments
An interesting thing this bug occurs only when
|
That's an interesting bug, thanks for the report! What if you use different key names? |
It does not depend on the name of the keys, I got it with completely different keys, in the example I used them for clarity :) |
After a little research I found interesting place dry-schema/lib/dry/schema/macros/value.rb Line 46 in f67d54e
At this point call So if I write Hope this helps! |
@bitberry-dev hmm ok, thanks! I'll take a look |
@solnic is this bug already reported? It appears empty hashes are not detected by schema = Dry::Schema.JSON do
config.validate_keys = true
end
schema.({hello: {}})
=> #<Dry::Schema::Result{} errors={}>
schema.({hello: 1})
=> #<Dry::Schema::Result{} errors={:hello=>["is not allowed"]}> |
Hello, Piotr! I found a bug
Describe the bug
In
Params
processor when validation for a key with hash value fails then we get another error for a key with integer value (string containing integer).To Reproduce
Expected behavior
The last test should return only one error for hash
Your environment
P.S. Great gem btw, thank you for your work
The text was updated successfully, but these errors were encountered: