Skip to main content

Fast JSON Schema validation for Python implemented in Rust

Project description

Build Version Python versions License

Fast JSON Schema validation for Python implemented in Rust.

Supported drafts:

  • Draft 7

  • Draft 6

  • Draft 4

There are some notable restrictions at the moment:

  • The underlying crate doesn’t support arbitrary precision integers yet, which may lead to SystemError when such value is used;

  • multipleOf keyword validation may produce false-negative results on some input. See #84 for more details

Installation

To install jsonschema-rs via pip run the following command:

pip install jsonschema-rs

Usage

To check if the input document is valid:

import jsonschema_rs

validator = jsonschema_rs.JSONSchema({"minimum": 42})
validator.is_valid(45)  # True

or:

import jsonschema_rs

validator = jsonschema_rs.JSONSchema({"minimum": 42})
validator.validate(41)  # raises ValidationError

NOTE. This library is in early development.

Performance

According to our benchmarks, jsonschema-rs is usually faster than existing alternatives in real-life scenarios.

However, for single-keyword or boolean schemas it might be slower than fastjsonschema.

Compiled validators (when the input schema is compiled once and reused later)

library

false

{"minimum": 10}

small

big

jsonschema-rs

273.01 ns

263.29 ns

904.38 ns

4.96 ms

fastjsonschema

49.77 ns (x0.18)

130.21 ns (x0.49)

5.7 us (x6.31)

575.66 ms (x115.84)

jsonschema

278.27 ns (x1.01)

2.41 us (x9.15)

75.27 us (x83.23)

1.83 s (x368.47)

Validators are not compiled (jsonschema) or compiled on every validation:

library

false

{"minimum": 10}

small

big

jsonschema-rs

349.74 ns

465.67 ns

6.97 us

5.15 ms

fastjsonschema

62.46 us (x178.59)

112.64 us (x241.9)

1.33 ms (x191.67)

574.5 ms (x111.55)

jsonschema

64.57 us (x184.64)

74.2 us (x159.34)

951.38 us (x136.37)

1.85 s (x360.38)

The bigger the input is the bigger is performance win.

In the examples below, big and small schemas refer to more realistic schemas and input instances. You can take a look at benchmarks in benches/bench.py. Ratios are given against jsonschema-rs.

Python support

jsonschema-rs supports Python 3.5, 3.6, 3.7 and 3.8.

License

The code in this project is licensed under MIT license. By contributing to jsonschema-rs, you agree that your contributions will be licensed under its MIT license.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jsonschema_rs-0.3.2.tar.gz (9.4 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

jsonschema_rs-0.3.2-cp38-cp38-win_amd64.whl (1.6 MB view details)

Uploaded CPython 3.8Windows x86-64

jsonschema_rs-0.3.2-cp38-cp38-manylinux2014_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.8

jsonschema_rs-0.3.2-cp38-cp38-macosx_10_15_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.8macOS 10.15+ x86-64

jsonschema_rs-0.3.2-cp37-cp37m-win_amd64.whl (1.6 MB view details)

Uploaded CPython 3.7mWindows x86-64

jsonschema_rs-0.3.2-cp37-cp37m-manylinux2014_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.7m

jsonschema_rs-0.3.2-cp37-cp37m-macosx_10_15_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.7mmacOS 10.15+ x86-64

jsonschema_rs-0.3.2-cp36-cp36m-win_amd64.whl (1.6 MB view details)

Uploaded CPython 3.6mWindows x86-64

jsonschema_rs-0.3.2-cp36-cp36m-manylinux2014_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.6m

jsonschema_rs-0.3.2-cp36-cp36m-macosx_10_15_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.6mmacOS 10.15+ x86-64

jsonschema_rs-0.3.2-cp35-cp35m-win_amd64.whl (1.6 MB view details)

Uploaded CPython 3.5mWindows x86-64

jsonschema_rs-0.3.2-cp35-cp35m-manylinux2014_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.5m

jsonschema_rs-0.3.2-cp35-cp35m-macosx_10_15_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.5mmacOS 10.15+ x86-64

File details

Details for the file jsonschema_rs-0.3.2.tar.gz.

File metadata

  • Download URL: jsonschema_rs-0.3.2.tar.gz
  • Upload date:
  • Size: 9.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for jsonschema_rs-0.3.2.tar.gz
Algorithm Hash digest
SHA256 ca30c5ef09c11af8ecd87be28ca8a4cdca416c3e5730a70b87db6bd5a040831e
MD5 c90bb2c6c2a5a49df51bc2cf4239c766
BLAKE2b-256 e9a8f907b24a1e901593affd4c42b8c7c01f0ea4fffa2583e81b4e930da81c18

See more details on using hashes here.

File details

Details for the file jsonschema_rs-0.3.2-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: jsonschema_rs-0.3.2-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 1.6 MB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for jsonschema_rs-0.3.2-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 51102df99cf39698876664d0a5dea26cac99194b6369eda532698da0b3781b09
MD5 26feb5f893bac13daa309d541ec6bf69
BLAKE2b-256 85e67737f51b2ca89284f4cd5297fa38ee2a435250bd2ea8039f5c19678705c6

See more details on using hashes here.

File details

Details for the file jsonschema_rs-0.3.2-cp38-cp38-manylinux2014_x86_64.whl.

File metadata

  • Download URL: jsonschema_rs-0.3.2-cp38-cp38-manylinux2014_x86_64.whl
  • Upload date:
  • Size: 4.3 MB
  • Tags: CPython 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for jsonschema_rs-0.3.2-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 315f2578b3209881fbedb9391d44a8e765649a6389508a7fe814216539a84f10
MD5 08da11cf2d27f987f7ae2930cf9666ec
BLAKE2b-256 6be4845f1e954573ee682bdcf92ead0995ef9bcb4e33e8a835eb7948a98f9e81

See more details on using hashes here.

File details

Details for the file jsonschema_rs-0.3.2-cp38-cp38-macosx_10_15_x86_64.whl.

File metadata

  • Download URL: jsonschema_rs-0.3.2-cp38-cp38-macosx_10_15_x86_64.whl
  • Upload date:
  • Size: 1.7 MB
  • Tags: CPython 3.8, macOS 10.15+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for jsonschema_rs-0.3.2-cp38-cp38-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 734e854e5e04fce0ba7515cb4cafb30342d16761e0854ae2decdde657e5cb038
MD5 3e92d6ce6885f93cfd2423e49f2bb489
BLAKE2b-256 78bc8cc24e5a06229dfb1fd2399543095fefc5f7dba5853e927a7d387d76d7f8

See more details on using hashes here.

File details

Details for the file jsonschema_rs-0.3.2-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: jsonschema_rs-0.3.2-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 1.6 MB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for jsonschema_rs-0.3.2-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 a830cef1a3a5fabc7f8e0697e26341e0f5cd8015da3bf274c24f7791bb8cbd4a
MD5 320be57b40b98a381da073f7b2cd1d50
BLAKE2b-256 1b5cbb97b6bb29f6c83aafef27d6dcb0979f1976f0ae95de59f134eab37e9743

See more details on using hashes here.

File details

Details for the file jsonschema_rs-0.3.2-cp37-cp37m-manylinux2014_x86_64.whl.

File metadata

  • Download URL: jsonschema_rs-0.3.2-cp37-cp37m-manylinux2014_x86_64.whl
  • Upload date:
  • Size: 4.3 MB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for jsonschema_rs-0.3.2-cp37-cp37m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 11835df5e57dcb375a0d7a20d91472f3310a589ae22788632170aa36a717b2f2
MD5 9d13a08c21b8fc035abc9d361d38d02a
BLAKE2b-256 1dd3962b4cce62470d6f17761cef3de9c3b1cd9438ee0a628d2bedb75e0b682e

See more details on using hashes here.

File details

Details for the file jsonschema_rs-0.3.2-cp37-cp37m-macosx_10_15_x86_64.whl.

File metadata

  • Download URL: jsonschema_rs-0.3.2-cp37-cp37m-macosx_10_15_x86_64.whl
  • Upload date:
  • Size: 1.7 MB
  • Tags: CPython 3.7m, macOS 10.15+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for jsonschema_rs-0.3.2-cp37-cp37m-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 5f07c2578335149e36fba5b0d8a91cc998ec83f100fe2840eec72dba67bd704d
MD5 794f58b7314b0a9d11f90798ab5c4ccf
BLAKE2b-256 a15683de54463dd4b1973de6e734381120d9b35d9b097bdc144d8dc0ab09eccd

See more details on using hashes here.

File details

Details for the file jsonschema_rs-0.3.2-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: jsonschema_rs-0.3.2-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 1.6 MB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for jsonschema_rs-0.3.2-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 62134aa6ca49b859eb340873bab9e358e8716eac7d7cabc7053a42b3fae80ce6
MD5 66f017227cdc6c933ca6405837fba6eb
BLAKE2b-256 cf777e79cb112daa17777f851a9c75c2b67c3accd1d7c1eed7ec425118ece2a1

See more details on using hashes here.

File details

Details for the file jsonschema_rs-0.3.2-cp36-cp36m-manylinux2014_x86_64.whl.

File metadata

  • Download URL: jsonschema_rs-0.3.2-cp36-cp36m-manylinux2014_x86_64.whl
  • Upload date:
  • Size: 4.3 MB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for jsonschema_rs-0.3.2-cp36-cp36m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ef023902126480e20c2fdf91fc7f47c7714b769b5d11130a3f34d8d2a82f9cca
MD5 232aad8078040e3eeb8316b25be35619
BLAKE2b-256 44ea1ee72df08d9f5308ce58cb04de938b9ed38525c48dc0af50c083dd7c2eea

See more details on using hashes here.

File details

Details for the file jsonschema_rs-0.3.2-cp36-cp36m-macosx_10_15_x86_64.whl.

File metadata

  • Download URL: jsonschema_rs-0.3.2-cp36-cp36m-macosx_10_15_x86_64.whl
  • Upload date:
  • Size: 1.7 MB
  • Tags: CPython 3.6m, macOS 10.15+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for jsonschema_rs-0.3.2-cp36-cp36m-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 ec1d7d4662d42bc5f41eef1d4550e1ff927b3e4e06cc83653820b333220b0759
MD5 414627cae4d130fdfcc32c06c286ca1b
BLAKE2b-256 17fc7c4cb40280a504353d077f0099eefe7dbe126a5efd692c934fbe84e9cb3b

See more details on using hashes here.

File details

Details for the file jsonschema_rs-0.3.2-cp35-cp35m-win_amd64.whl.

File metadata

  • Download URL: jsonschema_rs-0.3.2-cp35-cp35m-win_amd64.whl
  • Upload date:
  • Size: 1.6 MB
  • Tags: CPython 3.5m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for jsonschema_rs-0.3.2-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 6a9e4b2f8544e538feeb3eaf32e2de611d573f0979ede0f42a3d00915466b407
MD5 3b789943b319e7ae0ba02c5202bceb84
BLAKE2b-256 37435905314d548d94c292932f1cbb5b12da80bc6c071be7d8d3b602b4228aa2

See more details on using hashes here.

File details

Details for the file jsonschema_rs-0.3.2-cp35-cp35m-manylinux2014_x86_64.whl.

File metadata

  • Download URL: jsonschema_rs-0.3.2-cp35-cp35m-manylinux2014_x86_64.whl
  • Upload date:
  • Size: 4.3 MB
  • Tags: CPython 3.5m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for jsonschema_rs-0.3.2-cp35-cp35m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 adc4ec3eb3defd1782f753f78d99ffb1bccb24e9fc3a33e14a850b4d34a6e911
MD5 02770395cde20f9b681127e66c789b91
BLAKE2b-256 d54836efc87ea1e25cb6f58be3e532724a822cb92b94f62b862ee81008dad0b0

See more details on using hashes here.

File details

Details for the file jsonschema_rs-0.3.2-cp35-cp35m-macosx_10_15_x86_64.whl.

File metadata

  • Download URL: jsonschema_rs-0.3.2-cp35-cp35m-macosx_10_15_x86_64.whl
  • Upload date:
  • Size: 1.7 MB
  • Tags: CPython 3.5m, macOS 10.15+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for jsonschema_rs-0.3.2-cp35-cp35m-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 afa567101072f7d086c67e0bd1d41e11e3e6ba5e95729b301e54a6986d35f94b
MD5 e070de70c26a01fbcb8bb195bc9cc1ce
BLAKE2b-256 c3f841260cf3e61e5aecf320c88208b4b97ba17de8395e596eb74c63eeafbd85

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page