0.8.0
This release adds two new validators and a handful of new parameters to existing validators.
It also introduces two breaking changes, which in practice shouldn't really affect anyone negatively, and one deprecation of an existing validator parameter. See the changes below.
Added
AllowEmptyString: New wrapper validator that accepts empty strings (by @TomasHalgas). #91DiscardValidator: New validator that discards any input and always returns a predefined value. #94EmailValidatorandRegexValidator: Add parameterallow_emptyto allow empty strings (by @TomasHalgas). #89EmailValidator: Add parametermax_length. #97DecimalValidator: Add parameterroundingto specify rounding mode (with a new default, see "Changed"). #99
Changed
- Breaking change:
AnyOfValidatorandEnumValidatorare now case-sensitive by default. #98- The parameter
case_insensitiveis replaced with a new parametercase_sensitivewhich defaults to True. - The old parameter is still supported for compatibility, but is now deprecated and will be removed in a future version.
- If you have set
case_insensitive=Truebefore, you can simply remove this parameter now as this is the default now.
- The parameter
- Breaking change:
DecimalValidator(and all subclasses) now usesdecimal.ROUND_HALF_UPas default rounding mode. #99- Until now, the rounding mode of the current decimal context was used, which defaults to
decimal.ROUND_HALF_EVEN. - Use the
roundingparameter to change this. To restore the old behavior and use the decimal context, setrounding=None.
- Until now, the rounding mode of the current decimal context was used, which defaults to
Deprecated
AnyOfValidatorandEnumValidator: The parametercase_insensitiveis now deprecated and will be removed in a future version. (See "Changed" above.) #98
Testing
- Fix version incompatibility in test suite. #95
AnyOfValidator: Add unit tests with an empty list for allowed values. #96
New contributors
- @TomasHalgas made their first contributions in #89 and #91.