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 - v1.0.0.beta2

Published by solnic over 5 years ago

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

dry-validation - v1.0.0.beta1

Published by solnic over 5 years ago

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

dry-validation -

Published by flash-gordon over 5 years ago

v0.13.1 2019-03-22

Changed

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

Compare v0.13.0...v0.13.1

dry-validation -

Published by solnic over 5 years ago

The first round of bug fixes. Thanks for testing <3!

Fixed

  • Errors with nested messages are correctly built (flash-gordon)
  • Messages for nested keys are correctly resolved (solnic)
  • A message for a nested key is resolved when it's defined under errors.rule.%{key} too, but a message under nested key will override it (solnic)

Changed

  • When a message template is not found a more meaningful error is raised that includes both rule identifier and key path (solnic)

Compare v1.0.0.alpha1...v1.0.0.alpha2

dry-validation -

Published by solnic over 5 years ago

Complete rewrite on top of dry-schema.

Added

  • [BREAKING] Dry::Validation::Contract as a replacement for validation schemas (solnic)
  • [BREAKING] New rule DSL with an improved API for setting error messages (solnic)

Compare v0.13.0...v1.0.0.alpha1

dry-validation -

Published by flash-gordon over 5 years ago

v0.12.3 2019-01-29

Changed

  • [internal] dyr-logic was pinned to ~> 0.4.2 (flash-gordon)

Compare v0.12.2...v0.12.3

dry-validation -

Published by flash-gordon over 5 years ago

v0.12.2 2018-08-29

Fixed

  • Use correct key names for rule messages when using i18n (jozzi05)

Compare v0.12.1...v0.12.2

dry-validation -

Published by flash-gordon over 6 years ago

v0.12.1 2018-07-06

Fixed

  • [internal] fixed deprecation warnings (flash-gordon)
dry-validation -

Published by flash-gordon over 6 years ago

v0.12.0 2018-05-31

Changed

  • Code updated to work with dry-types 0.13.1 and dry-struct 0.5.0, these are now minimal supported versions (flash-gordon)
  • [BREAKING] Form was renamed to Params to be consistent with the latest changes from dry-types. You can require 'dry/validation/compat/form' to use the previous names but it will be removed in the next version (flash-gordon)

Compare v0.11.1...v0.12.0

dry-validation - v0.11.0

Published by solnic over 7 years ago

Changed

  • [internal] input processor compilers have been updated to work with new dry-types' AST (GustavoCaso)