Skip to content

Releases: dry-rb/dry-schema

v1.5.3

21 Aug 08:29
v1.5.3
Compare
Choose a tag to compare

Fixed

  • Key validator works correctly with an array with maybe hash as its member (issue #308 fixed via #309) (@tadeusz-niemiec)

Changed

  • [info extension] small performance improvement in the set visitor (see #305 for more details) (@esparta)

Compare v1.5.2...v1.5.3

v1.5.2

26 Jun 09:03
v1.5.2
Compare
Choose a tag to compare

Fixed

  • Result#{success?,failure?} work as expected when there are only key validation failures (issue #297 fixed via #298) (@adamransom)

Changed

  • Using full option no longer adds a space between the name of a key and the message in case of languages that have no spaces between words (ie Japanese) (issue #161 closed via #292 by @tadeusz-niemiec)

Compare v1.5.1...v1.5.2

v1.5.1

21 May 09:50
v1.5.1
Compare
Choose a tag to compare

Fixed

Compare v1.5.0...v1.5.1

v1.5.0

11 Mar 13:18
v1.5.0
Compare
Choose a tag to compare

Added

  • Support for complex sum types ie value([:integer, array[:integer]) (issue #214) (@solnic)
  • You can now set global config via Dry::Schema.config (issue #205) (@robhanlon22)
  • Default error message for :uuid_v4? predicate (isssue #230) (@solnic)
  • [experimental] you can compose schemas in the DSL using the standard logic operators (issue #231 closed via #245) (@solnic)
  • Hash schema type can now be used with proper keys and predicates inferring. Constructor
    and default types are explicitly not supported (@flash-gordon)
    UserType = Dry::Types['hash'].schema(
      name: 'string',
      email: 'string'
    )
    
    Dry::Schema.define do
      require(:user).hash(UserType)
    end
  • :struct extension which allows using dry-struct classes as source for hash schemas. Note that output will still be presented as plain hashes, returning structs from schemas will require more work, it's planned for next versions (@flash-gordon)
  • :info extension which adds #info method to your schemas which produces a simple hash providing information about keys and types (issue #36 closed via #262) (@solnic)

Fixed

  • maybe macro in JSON schemas no longer converts empty strings to nil.
    This was a bug in dry-types but your code may rely on this behavior. If you still
    require this behavior, we recommend using a custom type (see Advanced -> Custom types in the docs) (@flash-gordon)
  • YAML message backend no longer crashes when load_paths are empty (@robhanlon22)
  • Callbacks can now be inherited from multiple parents (@skryukov)
  • Callbacks work with nested schemas (issue #209) (@solnic)
  • Custom type is respected when defining nested schemas (issue #174 closed via #263) (@solnic)
  • Key map is properly inferred for maybe-hashes (issue #266 fixed via #269) (@solnic)

Changed

  • :i18n message backend delegates interpolation and caching to I18n (issue #211) (@robhanlon22)
  • Raise ArgumentError in DSL if parent DSL configs differ (@robhanlon22)
  • (internal) PredicateInferrer was removed. Dry::Types::PredicateInferrer is a drop-in replacement (@flash-gordon)

Compare v1.4.3...v1.5.0

v1.4.3

08 Jan 14:20
v1.4.3
95c2cfa
Compare
Choose a tag to compare

Added

  • Pattern matching for Dry::Schema::Result objects (@flash-gordon)
    schema = Dry::Schema::Params { required(:name).filled }
    case schema.('name' => 'John')
    in name:
      name # => 'John'
    end
    Try it with monads!
  • Shortcut for nested schemas in value and maybe macros (@waiting-for-dev)
    Dry::Schema.Params do
      required(:address).value(:hash) do
        required(:city).filled     
      end
    end

Fixed

  • Some keyword warnings that slipped into the previous release (@flash-gordon)

Compare v1.4.2...v1.4.3

v1.4.2

19 Dec 08:56
v1.4.2
c3fa27d
Compare
Choose a tag to compare

Fixed

  • I18n messages backend supports procs as text properly (issue #208) (@robhanlon22)
  • I18n messages backend supports message meta-data (issue #210) (@robhanlon22)
  • Fixed keyword warnings from MRI 2.7.0 (@flash-gordon)
  • Array with a member works correctly with maybe (issue #206) (@solnic)

Compare v1.4.1...v1.4.2

v1.4.1

08 Oct 20:52
v1.4.1
1d4cced
Compare
Choose a tag to compare

Fixed

  • Child schemas no longer mutate processing steps of their parent classes (@skryukov)

Compare v1.4.0...v1.4.1

v1.4.0

08 Oct 09:18
v1.4.0
08c6625
Compare
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
Compare
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
Compare
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