Cerberus v1.0 Release Notes

  • ๐Ÿš€ Released on September 1, 2016.

    โš  .. warning::

    This is a major release which breaks backward compatibility in several
    ways. Don't worry, these changes are for the better. However, if you are
    upgrading, then you should really take the time to read the list of
    `Breaking Changes`_ and consider their impact on your codebase. For your
    convenience, some :doc:`upgrade notes <upgrading>` have been included.
    
    • ๐Ÿ†• New: Add capability to use references in schemas. (Frank Sachsenheim)
    • ๐Ÿ†• New: Support for binary type. (Matthew Ellison)
    • ๐Ÿ†• New: Allow callables for 'default' schema rule. (Dominik Kellner)
    • ๐Ÿ†• New: Support arbitrary types with 'max' and 'min' (Frank Sachsenheim).
    • ๐Ÿ†• New: Support any iterable with 'minlength' and 'maxlength'. Closes :issue:158. (Frank Sachsenheim)
    • ๐Ÿ†• New: 'default' normalization rule. Closes :issue:131. (Damiรกn Nohales)
    • ๐Ÿ†• New: 'excludes' rule (calve). Addresses :issue:132.
    • ๐Ÿ†• New: 'forbidden' rule. (Frank Sachsenheim)
    • ๐Ÿ†• New: 'rename'-rule renames a field to a given value during normalization (Frank Sachsenheim).
    • ๐Ÿ†• New: 'rename_handler'-rule that takes an callable that renames unknown fields. (Frank Sachsenheim)
    • ๐Ÿ†• New: 'Validator.purge_unknown'-property and conditional purging of unknown fields. (Frank Sachsenheim)
    • ๐Ÿ†• New: 'coerce', 'rename_handler' and 'validator' can use class-methods (Frank Sachsenheim).
    • ๐Ÿ†• New: '*of'-rules can be extended by concatenating another rule. (Frank Sachsenheim)
    • ๐Ÿ†• New: Allows various error output with error handlers (Frank Sachsenheim).
    • ๐Ÿ†• New: Available rules etc. of a Validator-instance are accessible as 'validation_rules', 'normalization_rules', 'types', 'validators' and 'coercer' -property. (Frank Sachsenheim)
    • ๐Ÿ†• New: Custom rule's method docstrings can contain an expression to validate constraints for that rule when a schema is validated. (Frank Sachsenheim).
    • New: 'Validator.root_schema' complements 'Validator.root_document'. (Frank Sachsenheim)
    • New: 'Validator.document_path' and 'Validator.schema_path' properties can be used to determine the relation of the currently validating document to the 'root_document' / 'root_schema'. (Frank Sachsenheim)
    • ๐Ÿ†• New: Known, validated definition schemas are cached, thus validation run-time of schemas is reduced. (Frank Sachsenheim)
    • ๐Ÿ†• New: Add testing with Docker. (Frank Sachsenheim)
    • ๐Ÿ†• New: Support CPython 3.5. (Frank Sachsenheim)

    • Fix: 'allow_unknown' inside *of rule is ignored. Closes #251. (Davis Kirkendall)

    • ๐Ÿ›  Fix: unexpected TypeError when using allow_unknown in a schema defining a list of dicts. Closes :issue:250. (Davis Kirkendall)

    • ๐Ÿ›  Fix: validate with 'update=True' does not work when required fields are in a list of subdicts. (Jonathan Huot)

    • ๐Ÿ›  Fix: 'number' type fails if value is boolean. Closes :issue:144. (Frank Sachsenheim)

    • ๐Ÿ›  Fix: allow None in 'default' normalization rule. (Damiรกn Nohales)

    • ๐Ÿ›  Fix: in 0.9.2, coerce does not maintain proper nesting on dict fields. Closes :issue:185.

    • ๐Ÿ›  Fix: normalization not working for valueschema and propertyschema. Closes :issue:155. (Frank Sachsenheim)

    • ๐Ÿ›  Fix: 'coerce' on List elements produces unexpected results. Closes :issue:161. (Frank Sachsenheim)

    • ๐Ÿ›  Fix: 'coerce'-constraints are validated. (Frank Sachsenheim)

    • ๐Ÿ›  Fix: Unknown fields are normalized. (Frank Sachsenheim)

    • ๐Ÿ›  Fix: Dependency on boolean field now works as expected. Addresses :issue:138. (Roman Redkovich)

    • ๐Ÿ›  Fix: Add missing deprecation-warnings. (Frank Sachsenheim)

    • ๐Ÿ“„ Docs: clarify read-only rule. Closes :issue:127.

    • ๐Ÿ“„ Docs: split Usage page into Usage; Validation Rules: Normalization Rules. (Frank Sachsenheim)

    ๐Ÿ’ฅ Breaking Changes

    ๐Ÿš€ Several relevant breaking changes have been introduced with this release. For
    โฌ†๏ธ the inside scoop, please see the :doc:`upgrade notes <upgrading>`.
    
    - ๐Ÿ”„ Change: 'errors' values are lists containing error messages. Previously, they
      were simple strings if single errors, lists otherwise.
      Closes :issue:`210`. (Frank Sachsenheim)
    - ๐Ÿ”„ Change: Custom validator methods: remove the second argument.
      (Frank Sachsenheim)
    - ๐Ÿ”„ Change: Custom validator methods: invert the logic of the conditional clauses
      where is tested what a value is not / has not. (Frank Sachsenheim)
    - ๐Ÿ”„ Change: Custom validator methods: replace calls to 'self._error' with
      'return True', or False, or None. (Frank Sachsenheim)
    - Change: Remove 'transparent_schema_rule' in favor of docstring schema
      validation. (Frank Sachsenheim)
    - ๐Ÿ”„ Change: Rename 'property_schema' rule to 'keyschema'. (Frank Sachsenheim)
    - โšก๏ธ Change: Replace 'validate_update' method with 'update' keywork argument.
      (Frank Sachsenheim)
    - ๐Ÿ”„ Change: The processed root-document of is now available as 'root_document'-
      property of the (child-)Validator. (Frank Sachsenheim)
    - ๐Ÿ”„ Change: Removed 'context'-argument from 'validate'-method as this is set
      upon the creation of a child-validator. (Frank Sachsenheim)
    - ๐Ÿ”„ Change: 'ValidationError'-exception renamed to 'DocumentError'.
      (Frank Sachsenheim)
    - ๐Ÿ”„ Change: Consolidated all schema-related error-messages' names.
      (Frank Sachsenheim)
    - ๐Ÿ”„ Change: Use warnings.warn for deprecation-warnings if available.
      (Frank Sachsenheim)