dry-schema
dry-schema copied to clipboard
Key map contains duplicates on inheritance
Describe the bug
When one schema is inherited from another one and redefines some fields, those fields got duplicated in the schema's key_map.
To Reproduce
class Foo < Dry::Schema::Params
define do
required(:foo).filled(:integer)
end
end
class Bar < Foo
define do
required(:foo).filled(:string)
end
end
Foo.new.key_map
#=> #<Dry::Schema::KeyMap["foo"]>
Bar.new.key_map
#=> #<Dry::Schema::KeyMap["foo", "foo"]>
Expected behavior
I would expect the exact list of schema keys in the keymap.
@solnic, @flash-gordon I can even work on the PR fixing this. I just need to know your opinion, folks. Does it look like a bug to you or an intended behavior?
@pyromaniac 💯 that wasn't planned to work like this :)
This was finally fixed in 1.10.5
Thank you so much!