Releases: seandstewart/typical
Ignore Member Descriptors in Tagged Unions
When determining whether a Union of types has a tag which may be used in deserialization, member descriptors should not be considered valid.
Additionally, drop usage of guard_recursion()
in the slotted()
decorator.
Expand Support for Email
The previous regex was missing support for certain ASCII characters which should be allowed.
This adds support for those characters.
v2.1
What's in the Box
Bugfixes
- Lazy reprs eval to False, so we should check for a None when deciding on the error message at Constraints validation failure.
- Optional fields for recursive types were not properly reflected when generating the JSON Schema.
- Fields marked with
...
for default are no longer considered nullable when generating the JSON Schema, but are still optional. - Objects are named after their type rather than their field when generating the JSON Schema (#130) (breaking change)
- Structured Tuples were not properly validated or deserialized (#138)
Features
- Adds validation and deserialization for Literal types (#87). Docs
- Adds support for Tagged Unions (#72). See the caveats in (#133). Docs
- Adds
typic.environ
for typed get/set access of environment variables, and lazy evaluation of defaults for Settings, with clearer error messaging. Docs - Adds support for
datetime.time
anddatetime.timedelta
. - Small optimizations for Object and Array constraint validation.
Fix Recursive Types within Containers
Types with recursion nested under containers failed to resolve correctly and caused a RecursionError as a result.
This release resolves #136
Fix Optional Dependency Declaration
pytest-benchmark
was declared as optional, but not marked for which extra it belonged to, which caused it to be listed as a required package in the final setup.py. This has been resolved.
Python3.9 Support
This release includes a few patches to ensure support for Python3.9.
Patch Support for ClassVars with Mutable Defaults
This release adds support for ClassVars with mutable defaults by ignoring them when calculating the hash for a resolved annotation.
Patch Invalid References for Unions
Patch Regression with JSON Schemas for Formatted String Fields
This fixes a regression handling the format
field in JSON Schema objects caused by more strict handling of given values on serialization.
This regression prevented any JSON Schemas with a special format from successfully running validation (resolves #21 )
Additional Improvements to Recursion Prevention
- Use a stack for recursion prevention in SchemaBuilder and clean up unused paths.
- Use a stack for recursion prevention in Constraints factory.
- Properly handle ClassVar Parameter mocking.