I started using dry-struct master branch to access some of the new behavior for a project, however, there’s some things that are a regression, I feel.
One of my use-cases is to create a Struct to parse and cast URL query params. These are mostly optional, and in the latest released version it is fairly easy to handle with constructor_type :schema
. There’s no simple equivalent in master, I either have to manually set all my attributes with .meta(omittable: true)
or add a .transform_types
hook.
Dry::Types
already allows one to specify a type as .optional
, wouldn’t it perhaps be simpler to have Dry::Struct just use that to indicate if the attribute is required or not?