You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the unexpected key's value is an array, it is not reported as unexpected. Validation can be marked as successful even.
To Reproduce
$ irbirb(main):001:0> require'dry-schema'=>trueirb(main):002:0> require'dry/schema/version'=>trueirb(main):003:0> Dry::Schema::VERSION=>"1.6.2"irb(main):004:1* schema=Dry::Schema.definedoirb(main):005:1* config.validate_keys=trueirb(main):006:1*
irb(main):007:2* optional(:address).hashdoirb(main):008:1* endirb(main):009:0> end=>#<Dry::Schema::Processor keys=[{:address=>[]}] rules={:address=>"key?(:address) THEN key[addr...irb(main):010:0> schema.call(address: {a: 1})=>#<Dry::Schema::Result{:address=>{}} errors={:address=>{:a=>["is not allowed"]}}>irb(main):011:0> schema.call(address: {a: [1,2,3]})=>#<Dry::Schema::Result{:address=>{}} errors={}>irb(main):012:0> schema.call(address: {a: {b: 1}})=>#<Dry::Schema::Result{:address=>{}} errors={:address=>{:a=>{:b=>["is not allowed"]}}}>irb(main):013:0> schema.call(address: {a: 'zz'})=>#<Dry::Schema::Result{:address=>{}} errors={:address=>{:a=>["is not allowed"]}}>
Expected behavior
It should return #<Dry::Schema::Result{:address=>{}} errors={:address=>{:a=>["is not allowed"]}}> in all cases.
BTW, the nested hash behavior also looks wrong. It should not report that the :b key is out of place, it should do that for the parent structure instead. IOW, I expect all of the cases above to return the same value.
My environment
Affects my production application: YES
Ruby version: 2.7.2
OS: Ubuntu 20.04
The text was updated successfully, but these errors were encountered:
Describe the bug
When the unexpected key's value is an array, it is not reported as unexpected. Validation can be marked as successful even.
To Reproduce
Expected behavior
It should return
#<Dry::Schema::Result{:address=>{}} errors={:address=>{:a=>["is not allowed"]}}>
in all cases.BTW, the nested hash behavior also looks wrong. It should not report that the
:b
key is out of place, it should do that for the parent structure instead. IOW, I expect all of the cases above to return the same value.My environment
The text was updated successfully, but these errors were encountered: