Releases: dry-rb/dry-schema
Releases · dry-rb/dry-schema
v1.4.0
Added
-
Support for passing multiple parent schemas. They are inherited from left to right (@ianwhite)
Dry::Schema.define(parent: [parent_a, parent_b, parent_c]) do ... end
-
Improved error messages about missing translations (@skryukov)
-
[experimental] before/after callbacks for schema steps (@skryukov)
Dry::Schema.Params do required(:name).value(:string) optional(:age).value(:integer) before(:value_coercer) do |result| result.to_h.compact end end
Fixed
- Added/fixed support for custom optional types (@flash-gordon)
v1.3.4
v1.3.3
Fixed
- Reject attempts to build a nested schema for array types built on
Dry::Types::Nominal(fixed #171) (@flash-gordon) - Current
I18n.localeis now properly handled when caching message templates (@flash-gordon) - Default processor uses strict types by default, which fixes various cases when
maybeis used with a constructor type (@flash-gordon) - Namespaced messages no longer causes a crash when used with nested schemas (fixed #176) (@solnic)
v1.3.2
Added
- Support for new predicates:
bytesize?,min_bytesize?andmax_bytesize?(@bmalinconico)
v1.3.1
v1.3.0
Added
-
Automatic predicate inferring for constrained types! (@flash-gordon)
Types::Name = Types::String.constrained(min_size: 1) schema = Dry::Schema.define do required(:name).value(Types::Name) end schema.(name: '').errors.to_h # => { name: ["size cannot be less than 1"] }
-
Support for redefining re-used schemas (issue #43) (@skryukov)
Fixed
- Type container is passed down to nested schemas (@flash-gordon)
v1.2.0
Added
- Ability to configure your own type container (@Morozzzko)
Fixed
filledmacro no longer generates incorrect messages for arrays (issue #151) (@solnic)filledmacro works correctly with constructor types (@solnic)filledworks correctly with nested schemas (#149) (@solnic + @timriley)BigDecimaltype is correctly handled by predicate inference (isssue #158) (@solnic)- Works with latest
dry-logicwhich provides the newrespond_to?predicate (#153) (@flash-gordon) - Custom array constructors are no longer discredited by
arraymacro (@solnic)
Changed
v1.1.0
filled macro and it may result in different hint messages in some cases.
Added
config.messages.default_localefor setting default locale (surprise, surprise) (solnic)Configexposespredicatessetting too (solnic)
Fixed
filledmacro behavior results inmust be fillederror messages when appropriate - see PR #141 for more information (issue #134) (solnic)- Filter rules no longer cause keys to be added to input (issue #142) (solnic)
- Filter rules work now with inheritance (solnic)
- Inherited type schemas used by coercion are now properly configured as
laxtype (solnic) Configis now finalized before instantiating schemas and properly dupped when its inherited (flash-gordon + solnic)Config#eql?works as expected (solnic)- Predicates are properly inferred from array with a member type spec, ie
array[:integer]results inarray? + each(:integer?)(issue #140) (solnic)
v1.0.3
Fixed
Object#hashis no longer used to calculate cache keys due to a potential risk of having hash collisions (solnic)- Predicate arguments are used again for template cache keys (solnic)
I18nmessages backend no longer evaluates templates twice (solnic)