All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- Fixed "TypeError: no _dump_data is defined for class Proc" error that ocurred when a definition model inherits from another model that uses lambda based definitions
- Fixed Definition::Model inheritance
- Improved performance
- Removed deprecated version of
GreaterThanEqual
definition that had a typo in it (GreaterThenEqual) - Removed deprecated version of
GreaterThan
definition that had a typo in it (GreaterThen) - Removed deprecated version of
LessThanEqual
definition that had a typo in it (LessThenEqual) - Removed deprecated version of
LessThan
definition that had a typo in it (LessThen)
- Definition::Model#eql? returns true when comparing two models with the same content
- A Definition::Initializer mixin that can be used to validate keyword arguments of a class constructor
- Include more information in the internal non-translated error messages. E.g. the max size of a LessThenEqual definition
- Renamed GreaterThen, GreaterThenEqual, LessThen and LessThenEqual to fix typo (Then VS Than) Backwards compatibility is ensured
- The Definition::ValueObject was removed and replaced by Definition:Model which has a nicer DSL and only works with hash data structures. See upgrade notes
- Float coercion: check for nil before coercion
- Lambda definitions can now be failed with custom error messages
- Compatibility with Ruby 3.0
- In some cases errors from nested
Keys
definitions insideOr
definitions got lost when listing the validation errors via theerror_hash
method on the conform result object.
- When no sub-definition of an
Or
conforms, then only the errors of the last definition of theOr
are collected. Previously the errors of all sub-definitions were collected. - Translated error messages have been improved to be more suitable to be used as end user error messages
- The
Keys
definition crashed with an error if the input was not a Hash
- Added include method to Keys Definition that allows to inline other
Keys
Definitions into each other
- added missing require for "pathname"
- Typo in error debug output
- CoercibleValueObject Definition for better nesting of ValueObjects
- Nilable Definition as shortcut for nil OR some other definition
- Option for Keys Definition to ignore unexpected keys
- Error hash was missing some errors in a few cases
ConformResult.error_hash
was empty for Definitions without anyKeys
Definition
- And Definition stops processing after the first failure
- Added support for default values to Keys Definition
- Errors returned from ConformResult were restructured for better debugging and usage
- Added I18n translation support for errors
- Added built in definitions for common usecases (e.g. string length validation)
- Initial release