debian-python-jsonschema/README.rst

105 lines
3.4 KiB
ReStructuredText
Raw Normal View History

2015-06-06 01:25:53 +02:00
.. image:: https://img.shields.io/pypi/v/jsonschema.svg
:target: https://pypi.python.org/pypi/jsonschema
.. image:: https://travis-ci.org/Julian/jsonschema.svg?branch=master
2015-04-07 14:01:34 +02:00
:target: https://travis-ci.org/Julian/jsonschema
2015-06-06 01:25:53 +02:00
.. image:: https://img.shields.io/pypi/l/jsonschema.svg
:target: https://pypi.python.org/pypi/jsonschema
2015-04-07 14:01:34 +02:00
==========
jsonschema
==========
2012-11-30 03:07:25 +01:00
``jsonschema`` is an implementation of `JSON Schema <http://json-schema.org>`_
for Python (supporting 2.6+ including Python 3).
2012-12-02 19:58:06 +01:00
.. code-block:: python
>>> from jsonschema import validate
>>> # A sample schema, like what we'd get from json.load()
>>> schema = {
... "type" : "object",
... "properties" : {
... "price" : {"type" : "number"},
... "name" : {"type" : "string"},
... },
... }
>>> # If no exception is raised by validate(), the instance is valid.
>>> validate({"name" : "Eggs", "price" : 34.99}, schema)
>>> validate(
... {"name" : "Eggs", "price" : "Invalid"}, schema
... ) # doctest: +IGNORE_EXCEPTION_DETAIL
Traceback (most recent call last):
...
ValidationError: 'Invalid' is not of type 'number'
2012-02-09 20:16:32 +01:00
Features
--------
* Full support for
2013-12-16 01:05:47 +01:00
`Draft 3 <https://python-jsonschema.readthedocs.org/en/latest/validate/#jsonschema.Draft3Validator>`_
**and** `Draft 4 <https://python-jsonschema.readthedocs.org/en/latest/validate/#jsonschema.Draft4Validator>`_
of the schema.
2012-02-09 20:16:32 +01:00
2013-12-16 01:05:47 +01:00
* `Lazy validation <https://python-jsonschema.readthedocs.org/en/latest/validate/#jsonschema.IValidator.iter_errors>`_
that can iteratively report *all* validation errors.
2012-02-09 20:16:32 +01:00
2012-02-24 17:12:55 +01:00
* Small and extensible
2012-02-09 20:16:32 +01:00
2013-12-16 01:05:47 +01:00
* `Programmatic querying <https://python-jsonschema.readthedocs.org/en/latest/errors/#module-jsonschema>`_
2012-12-02 03:12:39 +01:00
of which properties or items failed validation.
2012-02-09 20:16:32 +01:00
2012-06-06 01:27:26 +02:00
Release Notes
-------------
2015-06-05 14:36:57 +02:00
Version 2.5.0 is mainly a performance release. The interface for `RefResolver`
was extended to add methods that improve performance on CPython.
Support for custom `RefResolver` objects with the legacy interface should *not*
be affected. If you notice something amiss please file an issue ticket.
2013-03-04 00:17:23 +01:00
Running the Test Suite
----------------------
If you have ``tox`` installed (perhaps via ``pip install tox`` or your
package manager), running``tox`` in the directory of your source checkout will
run ``jsonschema``'s test suite on all of the versions of Python ``jsonschema``
supports. Note that you'll need to have all of those versions installed in
order to run the tests on each of them, otherwise ``tox`` will skip (and fail)
the tests on that version.
Of course you're also free to just run the tests on a single version with your
favorite test runner. The tests live in the ``jsonschema.tests`` package.
2013-04-12 14:47:27 +02:00
Community
---------
2013-10-04 04:56:49 +02:00
There's a `mailing list <https://groups.google.com/forum/#!forum/jsonschema>`_
for this implementation on Google Groups.
2013-04-12 14:47:27 +02:00
Please join, and feel free to send questions there.
2013-04-27 00:21:02 +02:00
2012-06-06 01:27:26 +02:00
Contributing
------------
2012-02-09 20:16:32 +01:00
2012-02-24 17:12:55 +01:00
I'm Julian Berman.
2012-06-06 01:27:26 +02:00
``jsonschema`` is on `GitHub <http://github.com/Julian/jsonschema>`_.
2012-02-09 20:16:32 +01:00
2012-02-24 17:12:55 +01:00
Get in touch, via GitHub or otherwise, if you've got something to contribute,
it'd be most welcome!
2012-02-09 20:16:32 +01:00
2012-02-24 17:12:55 +01:00
You can also generally find me on Freenode (nick: ``tos9``) in various
channels, including ``#python``.
2013-10-04 04:55:32 +02:00
If you feel overwhelmingly grateful, you can woo me with beer money on
2013-10-04 04:58:15 +02:00
`Gittip <https://www.gittip.com/Julian/>`_ or via Google Wallet with the email
in my GitHub profile.