| 1 |
Metadata-Version: 2.1 |
| 2 |
Name: jsonschema |
| 3 |
Version: 4.17.3 |
| 4 |
Summary: An implementation of JSON Schema validation for Python |
| 5 |
Project-URL: Homepage, https://github.com/python-jsonschema/jsonschema |
| 6 |
Project-URL: Documentation, https://python-jsonschema.readthedocs.io/ |
| 7 |
Project-URL: Issues, https://github.com/python-jsonschema/jsonschema/issues/ |
| 8 |
Project-URL: Funding, https://github.com/sponsors/Julian |
| 9 |
Project-URL: Tidelift, https://tidelift.com/subscription/pkg/pypi-jsonschema?utm_source=pypi-jsonschema&utm_medium=referral&utm_campaign=pypi-link |
| 10 |
Project-URL: Changelog, https://github.com/python-jsonschema/jsonschema/blob/main/CHANGELOG.rst |
| 11 |
Project-URL: Source, https://github.com/python-jsonschema/jsonschema |
| 12 |
Author: Julian Berman |
| 13 |
Author-email: [email protected] |
| 14 |
License: MIT |
| 15 |
License-File: COPYING |
| 16 |
Keywords: data validation,json,jsonschema,validation |
| 17 |
Classifier: Development Status :: 5 - Production/Stable |
| 18 |
Classifier: Intended Audience :: Developers |
| 19 |
Classifier: License :: OSI Approved :: MIT License |
| 20 |
Classifier: Operating System :: OS Independent |
| 21 |
Classifier: Programming Language :: Python |
| 22 |
Classifier: Programming Language :: Python :: 3.7 |
| 23 |
Classifier: Programming Language :: Python :: 3.8 |
| 24 |
Classifier: Programming Language :: Python :: 3.9 |
| 25 |
Classifier: Programming Language :: Python :: 3.10 |
| 26 |
Classifier: Programming Language :: Python :: 3.11 |
| 27 |
Classifier: Programming Language :: Python :: Implementation :: CPython |
| 28 |
Classifier: Programming Language :: Python :: Implementation :: PyPy |
| 29 |
Requires-Python: >=3.7 |
| 30 |
Requires-Dist: attrs>=17.4.0 |
| 31 |
Requires-Dist: importlib-metadata; python_version < '3.8' |
| 32 |
Requires-Dist: importlib-resources>=1.4.0; python_version < '3.9' |
| 33 |
Requires-Dist: pkgutil-resolve-name>=1.3.10; python_version < '3.9' |
| 34 |
Requires-Dist: pyrsistent!=0.17.0,!=0.17.1,!=0.17.2,>=0.14.0 |
| 35 |
Requires-Dist: typing-extensions; python_version < '3.8' |
| 36 |
Provides-Extra: format |
| 37 |
Requires-Dist: fqdn; extra == 'format' |
| 38 |
Requires-Dist: idna; extra == 'format' |
| 39 |
Requires-Dist: isoduration; extra == 'format' |
| 40 |
Requires-Dist: jsonpointer>1.13; extra == 'format' |
| 41 |
Requires-Dist: rfc3339-validator; extra == 'format' |
| 42 |
Requires-Dist: rfc3987; extra == 'format' |
| 43 |
Requires-Dist: uri-template; extra == 'format' |
| 44 |
Requires-Dist: webcolors>=1.11; extra == 'format' |
| 45 |
Provides-Extra: format-nongpl |
| 46 |
Requires-Dist: fqdn; extra == 'format-nongpl' |
| 47 |
Requires-Dist: idna; extra == 'format-nongpl' |
| 48 |
Requires-Dist: isoduration; extra == 'format-nongpl' |
| 49 |
Requires-Dist: jsonpointer>1.13; extra == 'format-nongpl' |
| 50 |
Requires-Dist: rfc3339-validator; extra == 'format-nongpl' |
| 51 |
Requires-Dist: rfc3986-validator>0.1.0; extra == 'format-nongpl' |
| 52 |
Requires-Dist: uri-template; extra == 'format-nongpl' |
| 53 |
Requires-Dist: webcolors>=1.11; extra == 'format-nongpl' |
| 54 |
Description-Content-Type: text/x-rst |
| 55 |
|
| 56 |
========== |
| 57 |
jsonschema |
| 58 |
========== |
| 59 |
|
| 60 |
|PyPI| |Pythons| |CI| |ReadTheDocs| |Precommit| |Zenodo| |
| 61 |
|
| 62 |
.. |PyPI| image:: https://img.shields.io/pypi/v/jsonschema.svg |
| 63 |
:alt: PyPI version |
| 64 |
:target: https://pypi.org/project/jsonschema/ |
| 65 |
|
| 66 |
.. |Pythons| image:: https://img.shields.io/pypi/pyversions/jsonschema.svg |
| 67 |
:alt: Supported Python versions |
| 68 |
:target: https://pypi.org/project/jsonschema/ |
| 69 |
|
| 70 |
.. |CI| image:: https://github.com/python-jsonschema/jsonschema/workflows/CI/badge.svg |
| 71 |
:alt: Build status |
| 72 |
:target: https://github.com/python-jsonschema/jsonschema/actions?query=workflow%3ACI |
| 73 |
|
| 74 |
.. |ReadTheDocs| image:: https://readthedocs.org/projects/python-jsonschema/badge/?version=stable&style=flat |
| 75 |
:alt: ReadTheDocs status |
| 76 |
:target: https://python-jsonschema.readthedocs.io/en/stable/ |
| 77 |
|
| 78 |
.. |Precommit| image:: https://results.pre-commit.ci/badge/github/python-jsonschema/jsonschema/main.svg |
| 79 |
:alt: pre-commit.ci status |
| 80 |
:target: https://results.pre-commit.ci/latest/github/python-jsonschema/jsonschema/main |
| 81 |
|
| 82 |
.. |Zenodo| image:: https://zenodo.org/badge/3072629.svg |
| 83 |
:target: https://zenodo.org/badge/latestdoi/3072629 |
| 84 |
|
| 85 |
|
| 86 |
``jsonschema`` is an implementation of the `JSON Schema |
| 87 |
<https://json-schema.org>`_ specification for Python. |
| 88 |
|
| 89 |
.. code-block:: python |
| 90 |
|
| 91 |
>>> from jsonschema import validate |
| 92 |
|
| 93 |
>>> # A sample schema, like what we'd get from json.load() |
| 94 |
>>> schema = { |
| 95 |
... "type" : "object", |
| 96 |
... "properties" : { |
| 97 |
... "price" : {"type" : "number"}, |
| 98 |
... "name" : {"type" : "string"}, |
| 99 |
... }, |
| 100 |
... } |
| 101 |
|
| 102 |
>>> # If no exception is raised by validate(), the instance is valid. |
| 103 |
>>> validate(instance={"name" : "Eggs", "price" : 34.99}, schema=schema) |
| 104 |
|
| 105 |
>>> validate( |
| 106 |
... instance={"name" : "Eggs", "price" : "Invalid"}, schema=schema, |
| 107 |
... ) # doctest: +IGNORE_EXCEPTION_DETAIL |
| 108 |
Traceback (most recent call last): |
| 109 |
... |
| 110 |
ValidationError: 'Invalid' is not of type 'number' |
| 111 |
|
| 112 |
It can also be used from console: |
| 113 |
|
| 114 |
.. code-block:: bash |
| 115 |
|
| 116 |
$ jsonschema --instance sample.json sample.schema |
| 117 |
|
| 118 |
Features |
| 119 |
-------- |
| 120 |
|
| 121 |
* Partial support for |
| 122 |
`Draft 2020-12 <https://python-jsonschema.readthedocs.io/en/latest/api/jsonschema/validators/#jsonschema.validators.Draft202012Validator>`_ and |
| 123 |
`Draft 2019-09 <https://python-jsonschema.readthedocs.io/en/latest/api/jsonschema/validators/#jsonschema.validators.Draft201909Validator>`_, |
| 124 |
except for ``dynamicRef`` / ``recursiveRef`` and ``$vocabulary`` (in-progress). |
| 125 |
Full support for |
| 126 |
`Draft 7 <https://python-jsonschema.readthedocs.io/en/latest/api/jsonschema/validators/#jsonschema.validators.Draft7Validator>`_, |
| 127 |
`Draft 6 <https://python-jsonschema.readthedocs.io/en/latest/api/jsonschema/validators/#jsonschema.validators.Draft6Validator>`_, |
| 128 |
`Draft 4 <https://python-jsonschema.readthedocs.io/en/latest/api/jsonschema/validators/#jsonschema.validators.Draft4Validator>`_ |
| 129 |
and |
| 130 |
`Draft 3 <https://python-jsonschema.readthedocs.io/en/latest/api/jsonschema/validators/#jsonschema.validators.Draft3Validator>`_ |
| 131 |
|
| 132 |
* `Lazy validation <https://python-jsonschema.readthedocs.io/en/latest/api/jsonschema/protocols/#jsonschema.protocols.Validator.iter_errors>`_ |
| 133 |
that can iteratively report *all* validation errors. |
| 134 |
|
| 135 |
* `Programmatic querying <https://python-jsonschema.readthedocs.io/en/latest/errors/>`_ |
| 136 |
of which properties or items failed validation. |
| 137 |
|
| 138 |
|
| 139 |
Installation |
| 140 |
------------ |
| 141 |
|
| 142 |
``jsonschema`` is available on `PyPI <https://pypi.org/project/jsonschema/>`_. You can install using `pip <https://pip.pypa.io/en/stable/>`_: |
| 143 |
|
| 144 |
.. code-block:: bash |
| 145 |
|
| 146 |
$ pip install jsonschema |
| 147 |
|
| 148 |
|
| 149 |
Extras |
| 150 |
====== |
| 151 |
|
| 152 |
Two extras are available when installing the package, both currently related to ``format`` validation: |
| 153 |
|
| 154 |
* ``format`` |
| 155 |
* ``format-nongpl`` |
| 156 |
|
| 157 |
They can be used when installing in order to include additional dependencies, e.g.: |
| 158 |
|
| 159 |
.. code-block:: bash |
| 160 |
|
| 161 |
$ pip install jsonschema'[format]' |
| 162 |
|
| 163 |
Be aware that the mere presence of these dependencies – or even the specification of ``format`` checks in a schema – do *not* activate format checks (as per the specification). |
| 164 |
Please read the `format validation documentation <https://python-jsonschema.readthedocs.io/en/latest/validate/#validating-formats>`_ for further details. |
| 165 |
|
| 166 |
About |
| 167 |
----- |
| 168 |
|
| 169 |
I'm Julian Berman. |
| 170 |
|
| 171 |
``jsonschema`` is on `GitHub <https://github.com/python-jsonschema/jsonschema>`_. |
| 172 |
|
| 173 |
Get in touch, via GitHub or otherwise, if you've got something to contribute, |
| 174 |
it'd be most welcome! |
| 175 |
|
| 176 |
You can also generally find me on Libera (nick: ``Julian``) in various |
| 177 |
channels, including ``#python``. |
| 178 |
|
| 179 |
If you feel overwhelmingly grateful, you can also `sponsor me |
| 180 |
<https://github.com/sponsors/Julian/>`_. |
| 181 |
|
| 182 |
And for companies who appreciate ``jsonschema`` and its continued support |
| 183 |
and growth, ``jsonschema`` is also now supportable via `TideLift |
| 184 |
<https://tidelift.com/subscription/pkg/pypi-jsonschema?utm_source=pypi-j |
| 185 |
sonschema&utm_medium=referral&utm_campaign=readme>`_. |
| 186 |
|
| 187 |
|
| 188 |
Release Information |
| 189 |
------------------- |
| 190 |
|
| 191 |
v4.17.3 |
| 192 |
======= |
| 193 |
|
| 194 |
* Fix instantiating validators with cached refs to boolean schemas |
| 195 |
rather than objects (#1018). |