Skip to content

v1.5.0

Compare
Choose a tag to compare
@solnic solnic released this 11 Mar 13:18
v1.5.0

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