dry-validation

Validation library with type-safe schemas and rules

MIT License

Downloads
66.6M
Stars
1.3K
Committers
77

Bot releases are hidden (Show)

dry-validation - 1.6.0

Published by solnic almost 4 years ago

Added

  • You can now pass a key name or path to rule_error? predicate (issue #658 closed via #673) (@moofkit)
  • You can now pass initial context object to Contract#call (issue #674 via #675) (@pyromaniac)

Fixed

  • Checking key? within a rule no longer crashes when value is nil or an empty string (issue #670 fixed via #672) (@alexxty7)

Compare v1.5.6...v1.6.0

dry-validation -

Published by solnic about 4 years ago

Fixed

  • Dependency on dry-schema was bumped to >= 1.5.1. This time for real (@solnic)

Compare v1.5.5...v1.5.6

dry-validation -

Published by solnic about 4 years ago

Fixed

  • Dependency on dry-schema was bumped to >= 1.5.2 (see #666 for more info) (@artofhuman)

Compare v1.5.4...master

dry-validation -

Published by solnic about 4 years ago

Added

  • You can now pass any key or a path to the rule's key? helper (see #664 for more info) (@alassek)

Fixed

  • Full messages work correctly with rule failures now (issue #661 fixed via #662) (@stind)
  • Providing a custom message template for array errors works correctly (issue #663 fixed via #665) (@tadeusz-niemiec)

Compare v1.5.3...v1.5.4

dry-validation -

Published by solnic about 4 years ago

Added

  • You can now access current value's index via rule(:foo).each do |index:| (issue #606 done via #657) (@mrbongiolo)

Fixed

  • Using .each(:foo) works as expected when there are errors related to other keys (issue #659 fixed via #660) (@solnic)

Changed

  • Result#error? is now a public API and it takes into consideration both schema and rule errors (issue #655 fixed via #656) (@PragTob)

Compare v1.5.2...v1.5.3

dry-validation -

Published by solnic over 4 years ago

Fixed

  • key? predicate in rules no longer crashes when the rule path points to a non-existent array value (issue #653 fixed via #654) (@solnic)
    Compare v1.5.1...v1.5.2
dry-validation -

Published by solnic over 4 years ago

Fixed

  • dry-monads no longer required for the :hints extension (@schokomarie)
  • Using full: true option works as expected with custom rule messages (issue #618 fixed via #651) (@sirfilip)
  • Using locale: ... option works as expected with hints (issue #589 fixed via #652) (@sirfilip)

Compare v1.5.0...v1.5.1

dry-validation -

Published by solnic over 4 years ago

Added

  • schema_error? rule helper (@waiting-for-dev)
  • rule_error? rule helper (@waiting-for-dev)

Changed

  • dry-schema dependency was bumped to ~> 1.5 (@solnic)
  • [internal] KeyMap patches have been removed since dry-schema now provides required functionality (@solnic)

Compare v1.4.2...v1.5.0

dry-validation -

Published by flash-gordon almost 5 years ago

Added

  • Pattern matching on result values (@flash-gordon)

Fixed

  • List tokens are correctly interpolated as a comma-separated list in rule messages (see #611) (@waiting-for-dev)
  • Warnings about delegated keywords (@flash-gordon)

Compare v1.4.0...v1.4.1

dry-validation -

Published by solnic almost 5 years ago

Added

  • Support for multi-schema inheritance (@ianwhite)

Fixed

  • Keyword warnings reported by Ruby 2.7 (@flash-gordon)
  • Fixed an issue where MessageSet would be marked as empty too early (@ianwhite)
  • Messages are correctly generated when there are errors for both an array and one or more of its elements (see #599) (@Bugagazavr)

Changed

  • A meaningful exception is raised when failure options are not valid (@MatElGran)
  • [internal] improved performance in Contract.ensure_valid_keys (@grzegorz-jakubiak)
  • [internal] fixed keyword warnings on MRI 2.7.0 (@flash-gordon)

Compare v1.3.1...v1.4.0

dry-validation -

Published by solnic about 5 years ago

Added

  • Support for setting an external schema (that can be extended too) (fixed #574) (@solnic)

Fixed

  • Using a hash spec to define rule keys with more than one value is properly handled by rule guard now (fixed #576) (@solnic)

Changed

  • values within rules uses Hash#fetch_values internally now, which improves performance (@esparta)

Compare v1.2.1...v1.3.0

dry-validation -

Published by solnic over 5 years ago

Fixed

  • Defining an abstract contract class that has no schema no longer crashes (issue #565) (@solnic)
  • Fixed an issue where Rule#each would crash when the value is not an array (issue #567) (@solnic)
  • Fixed an issue where guarding a rule would crash when keys are missing in the input (issue #569) (@solnic)
  • Added missing "pathname" require (issue #570) (@solnic)

Compare v1.2.0...v1.2.1

dry-validation -

Published by solnic over 5 years ago

Added

  • New extension :predicates_as_macros (@waiting-for-dev)

Fixed

  • Guarding rules for nested keys works correctly (issue #560) (@solnic)

Changed

  • dry-schema dependency was bumped to >= 1.3.1 (@solnic)

Compare v1.1.1...v1.2.0

dry-validation -

Published by solnic over 5 years ago

Fixed

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

Compare v1.1.0...v1.1.1

dry-validation -

Published by solnic over 5 years ago

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

  • Passing multiple macro names to validate or each works correctly (fixed #538 #541) (@jandudulski)

Compare v1.0.0...v1.1.0

dry-validation -

Published by solnic over 5 years ago

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

dry-validation -

Published by solnic over 5 years ago

Fixed

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

Compare v0.13.1...v0.13.2

dry-validation -

Published by solnic over 5 years ago

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

dry-validation - v1.0.0.rc2 (YANKED)

Published by solnic over 5 years ago

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

dry-validation -

Published by solnic over 5 years ago

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