Changelog
X.X.X (master
)
1.17.8
- Support stringy annotations (in most cases)
1.17.7
- Support
min_length
validation onListField
1.17.6
- Support
typing.Any
in annotations.
1.17.5
- Support field overrides within auto-defined attrs schemas.
1.17.4
- Fix
TimeDeltaField
to return anError
instance instead of raisingTypeError
when trying to validate a value of the wrong type.
1.17.3
- Add support for
datetime.time
via a newTimeField
field.
1.17.2
- Add support for unions of
typing.NewType
types.
1.17.1
- improve performance on large payloads by caching validator function signature inspections
1.17.0
- Update
DateTimeField
to supportdatetime.datetime
objects (not just isoformatted strings) __eq__
and__repr__
added to delcarativeSchema
class- Add support for
UnionField
, and unions in general - Minor typings fixup on
URLField
(specifically on options) - Add documentation for all field types
1.16.2
- Fix serialization of individual items within a list field
- Fix serialization of individual items within a tuple field
1.16.1
- Fix nested serialization of non-
Schema
objects
1.16.0
- Implement
cleanchausie.FloatField
for floating point numbers.
1.15.0
- Implement
cleanchausie.TimezoneField
for validating timezones. It returnszoneinfo.ZoneInfo
objects, and it can be autogenerated for fields annotated withdatetime.tzinfo
.
1.14.0
- Implement
cleanchausie.TupleField
for validating tuples either of a fixed length with a specified type for each element, or of variable length with a single type for all elements. Annotation-based fields now support both varieties.
1.13.3
- Expose
cleanchausie.ext.cleancat.cleancat_field_bridge
to allow explicit support for cleancat fields.
1.13.2
- Fix typing bug that made it difficult to reuse polymorphic schema mappings
1.13.1
- Fix bug that failed to parse bare
dict
annotations on schemas.
1.13.0
- Update
cleanchausie.clean
andcleanchausie.serialize
to support field instances (delegating toclean_field
/serialize_field
)
1.12.2
- Fix bug in
StrField
whereNone
values were not being passed through correctly when validating minimum length.
1.12.1
- Fix bug in
PytzTimezoneField
whereNone
values were not being passed through correctly.
1.12.0
- BREAKING Always run validation functions, even for omitted or explicitly
None
values. Acleanchausie.fields.utils.passthrough
decorator has been added to make it easier to explicitly skip validation forNone
/omitted
on reusable fields .
1.11.2
- Add support for trimmed strings within
StrField
(asStrField(trim=True)
)
1.11.1
- Add support for new-style unions (e.g.
str | None
instead ofOptional[str]
, orstr | OMITTED
insted ofUnion[str, OMITTED]
)
1.11.0
- BREAKING refactor
OMITTED
/omitted
to use a slightly different singleton pattern internally. Notably,omitted
should now be treated as aLiteral
, whereOMITTED
is an alias forLiteral[omitted]
. Usage should generally look the same, except thatomitted
should be checked for withvalue is omitted
instead ofisinstance(value, OMITTED)
.omitted
(the literal) is also no longer fasly.
1.10.0
- Internal refactors to support better type safety and type checking within the library and test cases.
- Refactored
DictField
to be declared functionally and better support types - Removed
make_clean_with_factory
, which is no longer very useful sinceSchemaDefinition
now includes afactory
already. - Support for mypy 1.2.0
1.9.1
- Updated
SerializablePolymorphicField
to more explicitly handle cases where it's attempted to serialize not match any of the provided mappings.
1.9.0
- Updated
NestedField
to support instances ofSchemaDefinition
as well asSchema
classes. - Updated Auto-definition of
Schema
's to supportattrs
classes. They're now automatically defined usingschema_for_attrs_class
and will result in attrs class instances as values on validated schemas.
1.8.0
- Add
cleanchausie.clean
andcleanchausie.serialize
functions as the primary interface for using schemas and schema definitions. The next major release will remove theSchema.clean
andSchema.serialize
methods.
1.7.0
- Internal refactor of how schema definitions keep track of factory functions
- Breaking change: The definition returned by
schema_def_from_attrs_class
now has a defaultfactory
of the given attrs class (instead of a dict). Soclean
calls with a resulting schema definition will now return an attrs class instance instead of a dictionary. For previous behavior add a kwarg:factory=dict
.
1.6.0
- Added expanded docs + github-pages-based publishing
- Maybe Breaking Refactored
cleanchausie.fields
into a module. Any code that imports fromcleanchausie.fields
will need to be updated to either import fromcleanchausie
, or from the more specific module a field was moved to (e.g.cleanchausie.fields.types.x
).
1.5.0
Nothing breaking is included in this release, but the updated error messages
for StrField
and DateTimeField
may break unit tests.
- Added support for auto-defining nested fields based on a Schema class's type annotations.
- Improved the
str
representation ofSchema
instances - Improved error messages for
StrField
andDateTimeField
1.4.3
- Added a
cleanchausie.fallback
utility for defaulting to another value when a value isomitted
. - Fixed a bug in
Schema.clean
support for non-dictionary data structures.
1.4.2
- Added support for
NewType
-annotated fields.
1.4.1
- Fixed bug in
attr
extension where falsy defaults were not omittable
1.4.0
- Added
pytz
extension with newPytzTimezoneField
- If
pytz
is installed,BaseTzInfo
-annotated fields will automatically turn intoPytzTimezoneField
's
1.3.3
- bugfix: fix schema definition serialization to omit
omitted
or missing values and pass throughNone
values
1.3.2
- bugfix: update
poly_schema_mapping_for_attrs
serialization to use the parsed schema definition. This now applies cleanchausie's serialization logic to every field (not justattrs.asdict
, which doesn't serialize enums) - bugfix: add serialization function to DateTimeField that uses
.isoformat()
1.3.1
- Add default serialize-by-value logic to enum fields
- re-export
SerializablePolymorphicField
at the package level (like other fields) - update
poly_schema_mapping_for_attrs
with optionalignore_fields
arg - set minimum attrs version to
22.2.0
(required forattr.AttrInstance
type)
1.3.0
- Breaking Change:
schema_for_attrs_class
generated schemas now return an instance of the Schema, not an instance of the attrs class - Additional optional
ignore_fields
argument added toschema_for_attrs_class
- Added field utility functions
clean_field
+serialize_field
- Added
SerializablePolymorphicField
- Added
make_clean_with_factory
utility for working directly with schema definitions
1.2.1
- The first version released using the automated release process.
1.0.0
Initial release.