Closed sdogruyol closed 3 years ago
:bool?
is a predicate, it checks if the value is literally true
or false
. Type names don't end with a question mark:
IndexSchema = Dry::Schema.Params do
optional(:filter).hash do
optional(:template).filled(:bool)
end
end
dry-schema> IndexSchema.('filter' => { 'template' => 'true' })
# => #<Dry::Schema::Result{:filter=>{:template=>true}} errors={} path=[]>
Describe the bug
Type coercion doesn't work for
Dry::Schema.Params
To Reproduce
Here's the following error, template is not cast into boolean
Expected behavior
Type coercion should work by default
My environment