Changelog
X.X.X (master)
1.17.8
- Support stringy annotations (in most cases)
1.17.7
- Support
min_lengthvalidation onListField
1.17.6
- Support
typing.Anyin annotations.
1.17.5
- Support field overrides within auto-defined attrs schemas.
1.17.4
- Fix
TimeDeltaFieldto return anErrorinstance instead of raisingTypeErrorwhen trying to validate a value of the wrong type.
1.17.3
- Add support for
datetime.timevia a newTimeFieldfield.
1.17.2
- Add support for unions of
typing.NewTypetypes.
1.17.1
- improve performance on large payloads by caching validator function signature inspections
1.17.0
- Update
DateTimeFieldto supportdatetime.datetimeobjects (not just isoformatted strings) __eq__and__repr__added to delcarativeSchemaclass- 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-
Schemaobjects
1.16.0
- Implement
cleanchausie.FloatFieldfor floating point numbers.
1.15.0
- Implement
cleanchausie.TimezoneFieldfor validating timezones. It returnszoneinfo.ZoneInfoobjects, and it can be autogenerated for fields annotated withdatetime.tzinfo.
1.14.0
- Implement
cleanchausie.TupleFieldfor 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_bridgeto 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
dictannotations on schemas.
1.13.0
- Update
cleanchausie.cleanandcleanchausie.serializeto support field instances (delegating toclean_field/serialize_field)
1.12.2
- Fix bug in
StrFieldwhereNonevalues were not being passed through correctly when validating minimum length.
1.12.1
- Fix bug in
PytzTimezoneFieldwhereNonevalues were not being passed through correctly.
1.12.0
- BREAKING Always run validation functions, even for omitted or explicitly
Nonevalues. Acleanchausie.fields.utils.passthroughdecorator has been added to make it easier to explicitly skip validation forNone/omittedon 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 | Noneinstead ofOptional[str], orstr | OMITTEDinsted ofUnion[str, OMITTED])
1.11.0
- BREAKING refactor
OMITTED/omittedto use a slightly different singleton pattern internally. Notably,omittedshould now be treated as aLiteral, whereOMITTEDis an alias forLiteral[omitted]. Usage should generally look the same, except thatomittedshould be checked for withvalue is omittedinstead 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
DictFieldto be declared functionally and better support types - Removed
make_clean_with_factory, which is no longer very useful sinceSchemaDefinitionnow includes afactoryalready. - Support for mypy 1.2.0
1.9.1
- Updated
SerializablePolymorphicFieldto more explicitly handle cases where it's attempted to serialize not match any of the provided mappings.
1.9.0
- Updated
NestedFieldto support instances ofSchemaDefinitionas well asSchemaclasses. - Updated Auto-definition of
Schema's to supportattrsclasses. They're now automatically defined usingschema_for_attrs_classand will result in attrs class instances as values on validated schemas.
1.8.0
- Add
cleanchausie.cleanandcleanchausie.serializefunctions as the primary interface for using schemas and schema definitions. The next major release will remove theSchema.cleanandSchema.serializemethods.
1.7.0
- Internal refactor of how schema definitions keep track of factory functions
- Breaking change: The definition returned by
schema_def_from_attrs_classnow has a defaultfactoryof the given attrs class (instead of a dict). Socleancalls 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.fieldsinto a module. Any code that imports fromcleanchausie.fieldswill 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
strrepresentation ofSchemainstances - Improved error messages for
StrFieldandDateTimeField
1.4.3
- Added a
cleanchausie.fallbackutility for defaulting to another value when a value isomitted. - Fixed a bug in
Schema.cleansupport for non-dictionary data structures.
1.4.2
- Added support for
NewType-annotated fields.
1.4.1
- Fixed bug in
attrextension where falsy defaults were not omittable
1.4.0
- Added
pytzextension with newPytzTimezoneField - If
pytzis installed,BaseTzInfo-annotated fields will automatically turn intoPytzTimezoneField's
1.3.3
- bugfix: fix schema definition serialization to omit
omittedor missing values and pass throughNonevalues
1.3.2
- bugfix: update
poly_schema_mapping_for_attrsserialization 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
SerializablePolymorphicFieldat the package level (like other fields) - update
poly_schema_mapping_for_attrswith optionalignore_fieldsarg - set minimum attrs version to
22.2.0(required forattr.AttrInstancetype)
1.3.0
- Breaking Change:
schema_for_attrs_classgenerated schemas now return an instance of the Schema, not an instance of the attrs class - Additional optional
ignore_fieldsargument added toschema_for_attrs_class - Added field utility functions
clean_field+serialize_field - Added
SerializablePolymorphicField - Added
make_clean_with_factoryutility for working directly with schema definitions
1.2.1
- The first version released using the automated release process.
1.0.0
Initial release.