Skip to content

Types::Params::*.optional not handling empty string #419

Open
@ermolaev

Description

To Reproduce

Types::Params::Integer.optional[''] # => raise invalid value for Integer(): ""
Types::Optional::Params::Integer[''] # => nil

Types::Params::Date.optional[''] # => raise invalid date
Dry::Types["optional.params.date"] # => Nothing registered with the key "optional.params.date"

Expected behavior

Types::Params::Integer.optional[''] # => nil
Types::Params::Date.optional[''] # => nil

this behavior is confusing, I assumed that Types::Params::Date.optional equivalent Types::Params::Nil | Types::Params::Date

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions