summaryrefslogtreecommitdiff
path: root/docs/creating.rst
blob: fc498a10994c9e34a3e79bf3035f48e924e30a7c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
.. _creating-validators:

================================
Creating or Extending Validators
================================

.. currentmodule:: jsonschema

.. autoclass:: ValidatorMixin

.. autofunction:: validates


Creating Validation Errors
--------------------------

Any validating function that validates against a subschema should call
:meth:`ValidatorMixin.descend`, rather than :meth:`ValidatorMixin.iter_errors`.
If it recurses into the instance, or schema, it should pass one or both of the
``path`` or ``schema_path`` arguments to :meth:`ValidatorMixin.descend` in
order to properly maintain where in the instance or schema respsectively the
error occurred.