timriley on add-0-19-0-changelog
Expand on CHANGELOG (compare)
timriley on add-0-19-0-changelog
Add changelog entry for 0.19.0 Expand on CHANGELOG (compare)
timriley on default-settings-for-component-dirs
timriley on master
Allow custom system-wide defaul… (compare)
timriley on default-settings-for-component-dirs
Allow defaults to be configured… Move loader setting to componen… Apply default config regardless… and 6 more (compare)
timriley on default-settings-for-component-dirs
Use public dry-configurable APIs (compare)
timriley on default-settings-for-component-dirs
Add extra tests (compare)
solnic on master
Cast identifier to String durin… Merge pull request #169 from ad… (compare)
User.new(schema.call(some_data_from_api))
<= just this
UserSchema = Dry::Validation.JSON do
required(:created_at).value(:date_time?)
end
class User < Dry::Struct
attribute :created_at, Types::Strict::DateTime
end
user_attrs = UserSchema.(user_data)
User.new(user_attrs)
DateOrNil = Types::Strict::Date.optional.constructor { |v|
v == '' ? nil : Types::Json::Date[v]
}
schema = Dry::Validation.JSON do
configure { config.type_specs = true }
required(:date, DateOrNil).maybe(:date?)
end
irb(main):038:0> schema.(date: '')
=> #<Dry::Validation::Result output={:date=>nil} errors={}>
irb(main):039:0> schema.(date: '2010-10-12')
=> #<Dry::Validation::Result output={:date=>#<Date: 2010-10-12 ((2455482j,0s,0n),+0s,2299161j)>} errors={}>