RETIRED, further work has moved to Debian project infrastructure
Go to file
Julian Berman b29ae7127e Update copyright. 2013-02-17 15:32:44 -05:00
docs Ouch, never mind. Performance hit. 2013-02-17 14:49:38 -05:00
json Update the test suite. 2013-02-15 16:30:59 -05:00
.gitignore Ignore TODO scribbles. 2012-01-30 22:55:56 -05:00
.travis.yml Think travis has 3.3 now. 2012-12-02 14:12:51 -05:00
CHANGELOG.rst Update readme and changelog 2013-01-13 23:27:38 -05:00
COPYING Update copyright. 2013-02-17 15:32:44 -05:00
MANIFEST.in Add tox and JSON tests. 2012-10-31 22:28:26 -04:00
README.rst ...to the right one 2013-01-13 23:29:40 -05:00
jsonschema.py Ouch, never mind. Performance hit. 2013-02-17 14:49:38 -05:00
perftest Ouch, never mind. Performance hit. 2013-02-17 14:49:38 -05:00
setup.py Correct license. 2013-02-17 20:42:27 +01:00
tests.py Ouch, never mind. Performance hit. 2013-02-17 14:49:38 -05:00
tox.ini Doctest is horrible. 2013-02-17 09:34:50 -05:00

README.rst

jsonschema

jsonschema is an implementation of JSON Schema for Python (supporting 2.6+ including Python 3).

>>> 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'

Features

Release Notes

v0.8.0 introduces full support for JSON references via the RefResolver object. It also removes all of the deprecated code from v0.7.

Other notable fixes are a fix for improper support of uniqueItems for True and False (#34) and any for unknown types (#47).

Notably, there now exists some documentation (woo hoo!). It can be found at:

http://python-jsonschema.readthedocs.org

There are still a few incomplete sections, but it's mostly there. Patches welcome for weak points.

Running the Test Suite

jsonschema uses the wonderful Tox for its test suite. (It really is wonderful, if for some reason you haven't heard of it, you really should use it for your projects).

Assuming you have tox installed (perhaps via pip install tox or your package manager), just run tox in the directory of your source checkout to 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.

Contributing

I'm Julian Berman.

jsonschema is on GitHub.

Get in touch, via GitHub or otherwise, if you've got something to contribute, it'd be most welcome!

You can also generally find me on Freenode (nick: tos9) in various channels, including #python.