Skip to content

Releases: dry-rb/dry-schema

v1.4.0

08 Oct 09:18
v1.4.0
08c6625

Choose a tag to compare

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

Compare v1.3.4...v1.4.0

v1.3.4

11 Sep 08:49
v1.3.4
06113da

Choose a tag to compare

Fixed

  • Fixed regression where using array? predicate within a block would crach (issue #186) (@skryukov)

Compare v1.3.3...v1.3.4

v1.3.3

14 Aug 08:28
v1.3.3
0d1d706

Choose a tag to compare

Fixed

  • Reject attempts to build a nested schema for array types built on Dry::Types::Nominal (fixed #171) (@flash-gordon)
  • Current I18n.locale is now properly handled when caching message templates (@flash-gordon)
  • Default processor uses strict types by default, which fixes various cases when maybe is used with a constructor type (@flash-gordon)
  • Namespaced messages no longer causes a crash when used with nested schemas (fixed #176) (@solnic)

Compare v1.3.2...v1.3.3

v1.3.2

01 Aug 09:18
v1.3.2
b00b118

Choose a tag to compare

Added

  • Support for new predicates: bytesize?, min_bytesize? and max_bytesize? (@bmalinconico)

Compare v1.3.1...v1.3.2

v1.3.1

08 Jul 18:17
v1.3.1
86c9f3a

Choose a tag to compare

Fixed

  • Result#error? works correctly with nested hashes and arrays (@solnic)
  • :hints extension no longer causes a crash where base messages are generated too (issue #165) (@solnic)

Compare v1.3.0...v1.3.1

v1.3.0

06 Jul 16:18
v1.3.0
b61ffcc

Choose a tag to compare

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)

Compare v1.2.0...v1.3.0

v1.2.0

06 Jul 16:18

Choose a tag to compare

Added

  • Ability to configure your own type container (@Morozzzko)

Fixed

  • filled macro no longer generates incorrect messages for arrays (issue #151) (@solnic)
  • filled macro works correctly with constructor types (@solnic)
  • filled works correctly with nested schemas (#149) (@solnic + @timriley)
  • BigDecimal type is correctly handled by predicate inference (isssue #158) (@solnic)
  • Works with latest dry-logic which provides the new respond_to? predicate (#153) (@flash-gordon)
  • Custom array constructors are no longer discredited by array macro (@solnic)

Changed

  • ⚠️ Fixes related to filled restored pre-1.1.0 behavior of :hints which are again included for empty strings that get turned into nil in params schemas (@solnic)
  • filled no longer uses filter rules to handle empty strings in Params (@solnic)

Compare v1.1.0...v1.2.0

v1.1.0

30 May 09:01
ba171b8

Choose a tag to compare

⚠️ This release fixes behavior of filled macro and it may result in different hint messages in some cases.

Added

  • config.messages.default_locale for setting default locale (surprise, surprise) (solnic)
  • Config exposes predicates setting too (solnic)

Fixed

  • filled macro behavior results in must be filled error 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 lax type (solnic)
  • Config is 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 in array? + each(:integer?) (issue #140) (solnic)

Compare v1.0.3...v1.1.0

v1.0.3

30 May 09:00
v1.0.3
95e3fee

Choose a tag to compare

Fixed

  • Object#hash is 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)
  • I18n messages backend no longer evaluates templates twice (solnic)

Compare v1.0.2...v1.0.3

v1.0.2

12 May 16:28
v1.0.2
951488f

Choose a tag to compare

Fixed

  • Caching message templates uses restricted set of known keys to calculate cache keys (issue #132) (solnic)

Compare v1.0.1...v1.0.2