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.3.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.3-cp38-cp38-win_amd64.whl (1.6 MB view details)

Uploaded CPython 3.8Windows x86-64

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

Uploaded CPython 3.8

jsonschema_rs-0.3.3-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.3-cp37-cp37m-win_amd64.whl (1.6 MB view details)

Uploaded CPython 3.7mWindows x86-64

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

Uploaded CPython 3.7m

jsonschema_rs-0.3.3-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.3-cp36-cp36m-win_amd64.whl (1.6 MB view details)

Uploaded CPython 3.6mWindows x86-64

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

Uploaded CPython 3.6m

jsonschema_rs-0.3.3-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.3-cp35-cp35m-win_amd64.whl (1.6 MB view details)

Uploaded CPython 3.5mWindows x86-64

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

Uploaded CPython 3.5m

jsonschema_rs-0.3.3-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.3.tar.gz.

File metadata

  • Download URL: jsonschema_rs-0.3.3.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.24.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.3.tar.gz
Algorithm Hash digest
SHA256 e06c524bfe320513fe2bea2ee6a6d64298d65e70b2f1fa76ab43cca0437397d8
MD5 2ace83ca907d08663e9d9e64af9e3290
BLAKE2b-256 95c8b779d4b8f93bf68e53e3f921756a5713417f49d9a9cef151a672c41a4f6b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jsonschema_rs-0.3.3-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.24.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.3-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 1d42cc177ed772ec7b4e56938b6582a6ee7e83d90475fec6cecb6c01bf1d3801
MD5 bafc02adb24f5e4f669c5a1adf24b13c
BLAKE2b-256 b2cb1369536587002d120453a492b9d53a1779b4ee44a3356fbc2f14e2ea7ec9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jsonschema_rs-0.3.3-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.24.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.3-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0243e67066542babc948435d2f98a097dced4980f4bf2a5492790a554f6e7e67
MD5 e03a1f98461ebef13c3f43421039346c
BLAKE2b-256 ea0e3ce78799c6a14eb8dee713df6b4380dd39e968c77dd2d9338121405e371f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jsonschema_rs-0.3.3-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.24.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.3-cp38-cp38-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 bce11eb6eea0ad04d290ff462abf344247d33e64e86aa9a5b9dbb6e07f29c93f
MD5 d5ec79354487cd02d693af173be28351
BLAKE2b-256 f7b3c4c0442c78691f839f0f10a577dab01b6aa79024c9605828e00d497f5d0e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jsonschema_rs-0.3.3-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.24.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.3-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 2d08372d262873ca1bbf091f5b47c16449a105ffaa680a4dabc06d2ac2f4cdce
MD5 3c7eeb941efcabd6612ac9630c14421b
BLAKE2b-256 05f4a4a6ca06340f00a568591f4270b2549f34229da47233583b116649452e48

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jsonschema_rs-0.3.3-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.24.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.3-cp37-cp37m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c9dce1a20173444599f573a92fbdc3a6e17c57ee2744638fa8cb4935e4534258
MD5 4c581aed8cc81647b7ed1aa964f9539b
BLAKE2b-256 b720d37da17e42a77bd4dc75f4337602bc0eb957d42bc4df49372ed3d01d9bd9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jsonschema_rs-0.3.3-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.24.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.3-cp37-cp37m-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 7784dd9a5a1da37317eb771ff4330aae6cfa1b7920515027a267ebc3bd90aa10
MD5 250ed6495f58fc7d791733a21756d29c
BLAKE2b-256 d64b16f98c9c9f41c48fdb2ab17e33c1202e5538264678a31b378a1eab933236

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jsonschema_rs-0.3.3-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.24.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.3-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 3534f8aeacabb2f51bb85a11ed8e5125628220571679f61b555c74651045724f
MD5 5c9ee308a1d09b0a98cedadc79832eed
BLAKE2b-256 c98e9ac2ae5f1a2420fb7485237f4b857d9fe43e06fff00c77c39933a672348e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jsonschema_rs-0.3.3-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.24.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.3-cp36-cp36m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a4e9feb5ab4e12b82a6b0e7625b13e236b8ab2a221769f117c7b166a6ed7706f
MD5 53b2e754b27b3cef83fca6cd462bc95e
BLAKE2b-256 4bc994a7bd1a146268e843fda841af32ac7d6c6eaa5a7d8bf5d02c54048de9b6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jsonschema_rs-0.3.3-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.24.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.3-cp36-cp36m-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 d47197b4d0f8f3fe01b935c1db9db6110ec907d13973b27a343ba933c5647bc0
MD5 80195407d53d304221362e519716006e
BLAKE2b-256 489a6a4477a6b9007d939015ad2e80a4540e8104a7f1527b8f04ffaa63ebcc45

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jsonschema_rs-0.3.3-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.24.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.3-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 35aaf291df2193f46e1565b8f533cbf334119a3a18fd69477b4795951028dc3e
MD5 03d48a391f4a0db41de62e3c68caf732
BLAKE2b-256 f75a7128e68f585f8ede61afa202aa1215d3723e8beba8d31763f5131120cea8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jsonschema_rs-0.3.3-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.24.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.3-cp35-cp35m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4534f61f57880a53ca5885c13e6aa6301ac769a33adb3e57a262bd3ffd45d071
MD5 5f74e10201be8e0d1fdc18c88d82412c
BLAKE2b-256 a0ea72a9a07dc68f3d2c24a2628506b16ad9151b9fd097ef32106bff69de6dbe

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jsonschema_rs-0.3.3-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.24.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.3-cp35-cp35m-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 e436ba3362c2602761bf223af0eaaf88740bac0216c34af59d1f7eacdddbc89d
MD5 5b2a4253d0642903b07b610c39c77c7c
BLAKE2b-256 3729119e8bbaeb1cab9371233daf0bc5771768ef332141c5d4f3d0d42408cf42

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