All Versions
65
Latest Version
Avg Release Cycle
60 days
Latest Release
530 days ago
Changelog History
Page 3
Changelog History
Page 3
-
v1.1.0 Changes
June 14, 2019โ Added
- 0๏ธโฃ
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 ofrule(geo: [:lat, :lon])
it would return an array withlat
andlon
(@solnic)
๐ Fixed
- ๐ Passing multiple macro names to
validate
oreach
works correctly (fixed #538 #541) (@jandudulski)
- 0๏ธโฃ
-
v1.1.0-docs
June 17, 2019 -
v1.0.0 Changes
June 10, 2019โ Added
- ๐ Support for defining rules for each element of an array via
rule(:items).each { ... }
(solnic) - Support for parameterized macros via
rule(:foo).validate(my_macro: :some_option)
(solnic) values#[]
is now compatible with path specs (symbol, array with keys or dot-notation) (issue #528) (solnic)value
shortcut for accessing the value found under the first key specified by a rule. ierule(:foo) { value }
returnsvalues[:foo]
(solnic)
๐ Fixed
- 0๏ธโฃ Contract's
config.locale
option was replaced byconfig.messages.default_locale
to avoid conflicts with run-time:locale
option and/or whatever is set viaI18n
gem (solnic) - Macros no longer mutate
Dry::Validation::Contract.macros
when using inheritance (solnic) - Missing dependency on
dry-container
was added (solnic)
๐ Changed
rule
will raiseInvalidKeysError
when specified keys are not defined by the schema (solnic)Contract.new
will raiseSchemaMissingError
when the class doesn't have schema defined (solnic)- ๐ Contracts no longer support
:locale
option in the constructor. UseResult#errors(locale: :pl)
to change locale at run-time (solnic)
- ๐ Support for defining rules for each element of an array via
-
v1.0.0.rc3 Changes
May 06, 2019โ 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)
- [EXPERIMENTAL]
-
v1.0.0.rc2 Changes
May 04, 2019This was yanked on rubygems.org because the bundled gem was missing
config
directory, thus it was not possible to require it. It was fixed inrc3
.โ 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-likeDry::Validation::Values
class, rather thanDry::Schema::Result
. This gives more convenient access to data within rules (solnic) - โก๏ธ Dependency on
dry-schema
was updated to~> 1.0
(solnic)
- ๐ [EXPERIMENTAL] support for registering macros via
-
v1.0.0.rc1 Changes
April 26, 2019โ 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 indry-types 1.0.0
anddry-logic 1.0.0
(solnic) - Dependency on
dry-initializer
was bumped to~> 3.0
(solnic)
-
v1.0.0.beta2 Changes
April 04, 2019โ 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 toMessage
as it is a more generic concept (solnic) - [BREAKING]
ErrorSet
was renamed toMessageSet
for consistency (solnic) - [BREAKING]
:monads
extension wraps entire result objects inSuccess
orFailure
(flash-gordon)
-
v1.0.0.beta1 Changes
March 26, 2019โ Added
- ๐ New API for setting failures
base.failure
for base errors andkey.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
andfull
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 ofErrorSet
now, it's an enumerable, coerible to a hash (solnic) - ๐ [BREAKING]
failure
was removed in favor ofkey.failure
orkey(:foo).failure
(solnic) - ๐ [BREAKING]
Result#to_hash
was removed (flash-gordon)
- ๐ New API for setting failures
-
v1.0.0.alpha2 Changes
March 05, 2019โ 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)
-
v1.0.0.alpha1 Changes
March 04, 2019Complete 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)
- [BREAKING]