2.0.0
Asyncio Validation / Faster synchronous validation / More Flexible Dictionary Validation
All built-in validators now fully compatible with asyncio
. See the docs for more.
Significantly faster than v1.0 -- and 1.5x - 12x faster than Pydantic in (synchronous) benchmarks
RecordValidator
and DictValidatorAny
can now handle any kind of dict key, and whether it's required or not.
Features
asyncio
is supported with.validate_async
methodPredicateAsync
is addedRecordValidator
(andDictValidatorAny
) can now handle any kind of dict key.AlwaysValid
is addedPredicate
s andProcessor
s are allowed more extensively across built-in validators.
Performance
- speed has improved as much as 60x (Koda Validate is now significantly faster than Pydantic)
Breaking Changes
Ok
/Err
/Result
(fromkoda
) ->Valid
/Invalid
/Result
(fromkoda_validate
)dict_validator
->RecordValidator
DictNKeysValidator
s are removed. Instead,RecordValidator
is used.RecordValidator
requires all arguments as keyword-onlyRecordValidator
accepts up-to 16 keyskey
helper is removedmaybe_key
helper is replaced byKeyNotRequired
MapValidator
requires all arguments as keyword-onlyListValidator
requiresPredicate
s to be specified as a keyword argument- the order and number of some
__match_args__
has changed - most validators are no longer dataclasses;
__repr__
s may differ validate_and_map
is deprecated and removed fromkoda_validate
imports.- file structure has changed
- typedefs.py -> base.py
- utils.py -> _internals.py
Maintenance
bench
folder is added for benchmarkspython3.11
added to CIpypy3.9
added to CI- min coverage bumped to 95%
- lots of tests added