trailblazer / reform

Form objects decoupled from models.
https://trailblazer.to/2.1/docs/reform.html
MIT License
2.49k stars 184 forks source link

Cast strings to nil without nilify. #531

Closed jcoyne closed 3 years ago

jcoyne commented 3 years ago

Nilify has been deprecated in https://github.com/apotonick/disposable/pull/78

However, the proposed new way of doing this in that PR (e.g. property :unicorn_name, type: Types::Nil | Types::String) does not cast empty strings to nil.

Is there a recommended way to do this now? Or should nillify be undeprecated?

jcoyne commented 3 years ago

It looks like type: Dry::Types["params.nil"] | Dry::Types['string'] is probably the way.