dry-struct v0.7.0 Release Notes
Release Date: 2019-03-22 // about 5 years ago-
🔄 Changed
- [BREAKING]
Struct.input
was renamedStruct.schema
, henceStruct.schema
returns an instance ofDry::Types::Hash::Schema
rather than aHash
. Schemas are also implementingEnumerable
but they iterate over key types. New API:ruby User.schema.each do |key| puts "Key name: #{ key.name }" puts "Key type: #{ key.type }" end
To get a type by its name use.key
:ruby User.schema.key(:id) # => #<Dry::Types::Hash::Key ...>
- [BREAKING]
transform_types
now passes one argument to the block, an instance of theKey
type. Combined with the new API from dry-types it simplifies declaring omittable keys:ruby class StructWithOptionalKeys < Dry::Struct transform_types { |key| key.required(false) } # or simply transform_types(&:omittable) end
- ⚡️
Dry::Stuct#new
is now more efficient for partial updates (flash-gordon) - ✅ Ruby 2.3 is EOL and not officially supported. It may work but we don't test it.
- [BREAKING]