Upgraded from version 1.6.1 to 1.7.1 and detected error in my app's tests. Basically, when an empty block is passed, key validation is wrongly validated.
I consider the bug not to be common in most apps, I just happen to have an empty block in case we needed it in the future.
To Reproduce
schema = Dry::Schema.JSON do
config.validate_keys = true
required(:anyOf).array(:hash) do
optional(:some_key)
end
end
schema.({'anyOf' => []})
# => #<Dry::Schema::Result{:anyOf=>[]} errors={} path=[]>
schema = Dry::Schema.JSON do
config.validate_keys = true
required(:anyOf).array(:hash) do
end
end
schema.({'anyOf' => []})
# => #<Dry::Schema::Result{:anyOf=>[]} errors={:anyOf=>["is not allowed"]} path=[]>
Describe the bug
Upgraded from version 1.6.1 to 1.7.1 and detected error in my app's tests. Basically, when an empty block is passed, key validation is wrongly validated.
I consider the bug not to be common in most apps, I just happen to have an empty block in case we needed it in the future.
To Reproduce
Expected behavior
anyOf key should be valid
My environment