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 using a custom type for example: ExpirationDate = Types::DateTime.constructor { |value| value.to_time.round.to_datetime }
The constructor does not apply to nested hashes in a schema:
ExpirationDate=Types::DateTime.constructor{ |value| value.to_time.round.to_datetime}NestedCustomTypeHash=Dry::Schema.definedorequired(:foo).hashdorequired(:bar).value(ExpirationDate)endendresult=NestedCustomTypeHash.call(foo: {bar: '2021-11-11T00:00:00+00:00'})# result.errors.to_h => {:foo=>{:bar=>["must be a date time"]}}
To Reproduce
I've reproduced it in this PR: #395 but could not figure out how to get the spec to pass
flash-gordon
changed the title
Nested Hash schema with Custom Type constructor not constructing the right type.
Nested Hash schema with Custom Type constructor not constructing the right type
Jan 28, 2022
Describe the bug
When using a custom type for example:
ExpirationDate = Types::DateTime.constructor { |value| value.to_time.round.to_datetime }
The constructor does not apply to nested hashes in a schema:
To Reproduce
I've reproduced it in this PR: #395 but could not figure out how to get the spec to pass
Expected behavior
My environment
The text was updated successfully, but these errors were encountered: