Skip to content

Releases: dry-rb/dry-validation

v1.1.1

24 Jun 08:01
v1.1.1
c94def6
Compare
Choose a tag to compare

Fixed

  • Rule#each works with array values from nested hashes (@mustardnoise)

Compare v1.1.0...v1.1.1

v1.1.0

14 Jun 11:04
v1.1.0
Compare
Choose a tag to compare

Added

  • key? method available within rules, that can be used to check if there's a value under the rule's default key (refs #540) (@solnic)
  • value supports hash-based path specifications now (refs #547) (@solnic)
  • value can read multiple values when the key points to them, ie in case of rule(geo: [:lat, :lon]) it would return an array with lat and lon (@solnic)

Fixed

Compare v1.0.0...v1.1.0

v1.0.0

10 Jun 08:57
Compare
Choose a tag to compare

This release is a complete rewrite on top of dry-schema that uses contract classes to define schema and validation rules. It's not backward-compatible. This release addressed over 150 known issues, including bugs and missing features.

See the list of all addressed issues as well as issues that were moved to dry-schema and addressed there.

✨ Release highlights ✨

  • New Dry::Validation::Contract API for defining contract classes with schemas and validation rules
  • Improved message backends with support for key and base messages, and arbitrary meta-data (like error codes etc.)
  • Support for defining rules for array elements ie rule(:items).each { ... }
  • Support for macros that encapsulate common rule logic
  • Built-in :acceptance macro

Compare v0.13.3...v1.0.0

v0.13.2

12 May 16:15
v0.13.2
ade413b
Compare
Choose a tag to compare

Fixed

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

Compare v0.13.1...v0.13.2

v1.0.0.rc3

06 May 10:41
v1.0.0.rc3
5928554
Compare
Choose a tag to compare
v1.0.0.rc3 Pre-release
Pre-release

Added

  • [EXPERIMENTAL] Validation.register_macro for registering global macros (solnic)
  • [EXPERIMENTAL] Contract.register_macro for registering macros available to specific contract classes (solnic)
  • Dry::Validation.Contract shortcut for quickly defining a contract and getting its instance back (solnic)
  • New configuration option config.locale for setting the default locale (solnic)

Fixed

  • config/errors.yml are now bundled with the gem, rc2 was broken because of this (solnic)

Compare v1.0.0.rc2...v1.0.0.rc3

v1.0.0.rc2 (YANKED)

04 May 18:18
v1.0.0.rc2
4370a8a
Compare
Choose a tag to compare
v1.0.0.rc2 (YANKED) Pre-release
Pre-release

This was yanked on rubygems.org because the bundled gem was missing config directory, thus it was not possible to require it. It was fixed in rc3.

Added

  • [EXPERIMENTAL] support for registering macros via Dry::Validation::Macros.register(:your_macro, &block) (solnic)
  • [EXPERIMENTAL] :acceptance as the first built-in macro (issue #157) (solnic)

Fixed

  • Passing invalid argument to failure will raise a meaningful error instead of crashing (solnic)

Changed

  • In rule validation blocks, values is now an instance of a hash-like Dry::Validation::Values class, rather than Dry::Schema::Result. This gives more convenient access to data within rules (solnic)
  • Dependency on dry-schema was updated to ~> 1.0 (solnic)

Compare v1.0.0.rc1...v1.0.0.rc2

v1.0.0.rc1

26 Apr 13:03
v1.0.0.rc1
331d5a9
Compare
Choose a tag to compare
v1.0.0.rc1 Pre-release
Pre-release

Added

  • :hints extension is back (solnic)
  • Result objects have access to the context object which is shared between rules (flash-gordon)

Fixed

  • Multiple hint messages no longer crash message set (flash-gordon)
  • Contract#inspect no longer crashes (solnic)

Changed

  • Dependency on dry-schema was bumped to ~> 0.6 - this pulls in dry-types 1.0.0 and dry-logic 1.0.0 (solnic)
  • Dependency on dry-initializer was bumped to ~> 3.0 (solnic)

Compare v1.0.0.beta2...v1.0.0.rc1

v1.0.0.beta2

04 Apr 10:06
v1.0.0.beta2
bc3377f
Compare
Choose a tag to compare
v1.0.0.beta2 Pre-release
Pre-release

Added

  • Support for arbitrary meta-data in failures, ie:

    class NewUserContract < Dry::Validation::Contract
      params do
        required(:login).filled(:string)
      end
    
      rule(:login) do
        key.failure(text: 'is taken', code: 123) unless db.unique?(values[:login])
      end
    end

    Now your error hash will include { login: [{ text: 'is taken', code: 123 }] } (solnic + flash-gordon)

Changed

  • [BREAKING] Error was renamed to Message as it is a more generic concept (solnic)
  • [BREAKING] ErrorSet was renamed to MessageSet for consistency (solnic)
  • [BREAKING] :monads extension wraps entire result objects in Success or Failure (flash-gordon)

Compare v1.0.0.beta1...v1.0.0.beta2

v1.0.0.beta1

26 Mar 12:09
v1.0.0.beta1
da398d0
Compare
Choose a tag to compare
v1.0.0.beta1 Pre-release
Pre-release

Added

  • New API for setting failures base.failure for base errors and key.failure for key errors (solnic)
  • Support for base errors associated with a key even when child keys have errors too (solnic)
  • Support for base errors not associated with any key (solnic)
  • Result objects use ErrorSet object now for managing messages (solnic)
  • Nested keys are properly handled when generating messages hash (issue #489) (flash-gordon + solnic)
  • Result objects support locale and full options now (solnic)
  • Ability to configure top_namespace for messages, which will be used for both schema and rule localization (solnic)
  • Rule blocks receive a context object that you can use to share data between rules (solnic)

Changed

  • [BREAKING] Result#errors returns an instance of ErrorSet now, it's an enumerable, coerible to a hash (solnic)
  • [BREAKING] failure was removed in favor of key.failure or key(:foo).failure (solnic)
  • [BREAKING] Result#to_hash was removed (flash-gordon)

Compare v1.0.0.alpha2...v1.0.0.beta1

v0.13.1

22 Mar 17:47
v0.13.1
10a27b3
Compare
Choose a tag to compare

v0.13.1 2019-03-22

Changed

  • dry-types was locked to ~> 0.14.0 (flash-gordon)

Compare v0.13.0...v0.13.1