Hi,
I noticed some weird behavior. As far as I understood
-
config.hash_type determines which Dry::Type::Hash schema will be used such as symbolized,weak, … (http://dry-rb.org/gems/dry-types/hash-schemas/)
-
config.type_specs determines whether during input processing an automatic coercion is done or needs to be explicitly stated (http://dry-rb.org/gems/dry-validation/type-specs/)
However the hash_type settings only seems to work when the type_specs settings is enabled. As shown in the example below the symbolized type seems to be ignored…
require 'dry-validation'
a = Dry::Validation.Schema do
configure do
config.hash_type = :symbolized
config.input_processor = :sanitizer
config.type_specs = true
end
required(:test, :string) { filled? }
end
puts a.call({'test' => 'kljkl', 'whatever' => 'jkll'}).errors
===> {}
while
require 'dry-validation'
a = Dry::Validation.Schema do
configure do
config.hash_type = :symbolized
config.input_processor = :sanitizer
end
required(:test, :string) { filled? }
end
puts a.call({'test' => 'kljkl', 'whatever' => 'jkll'}).errors
===> {:test=>["is missing"]}
Is this intended behavior?