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

Empty hashes not detected by validate_keys is true #349

Open
patodevilla opened this issue Apr 13, 2021 · 0 comments
Open

Empty hashes not detected by validate_keys is true #349

patodevilla opened this issue Apr 13, 2021 · 0 comments

Comments

@patodevilla
Copy link

patodevilla commented Apr 13, 2021

Describe the bug

When setting validate_keys as true, empty hashes are being ignored by the validator

To Reproduce

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"]}>

Expected behavior

Unexpected key hello should be in the errors hash regardless of the key's value

My environment

  • Affects my production application: YES
  • Ruby version: ruby-2.5.7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant