Fast JSON Schema validation for Python implemented in Rust
Reason this release was yanked:
Not installable source package
Project description
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 Distributions
Built Distributions
File details
Details for the file jsonschema_rs-0.3.1-cp38-cp38-win_amd64.whl
.
File metadata
- Download URL: jsonschema_rs-0.3.1-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | a3c5b794bbe31975f3bbea3449933390b9bcd5c1930afee9ba01f29d1d05a3e9 |
|
MD5 | 5f51e33b29f230dbe046ad1a6ae560ad |
|
BLAKE2b-256 | 92dcc08b6ddcf04b6ba8ff65451aba55900ed3c252cfc97dc2a3a385b5c3f519 |
File details
Details for the file jsonschema_rs-0.3.1-cp38-cp38-manylinux2014_x86_64.whl
.
File metadata
- Download URL: jsonschema_rs-0.3.1-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5bf539e8318ab04ce284c3608d16a71a4f8ad2c93a22fc3b72413e1f1c02663f |
|
MD5 | 25a6094ce8d15a468b1c1c79387019db |
|
BLAKE2b-256 | b7163be0b648371fb9ab839102c1c2b3347380a9d8c3af6faa3a075f9f437528 |
File details
Details for the file jsonschema_rs-0.3.1-cp38-cp38-macosx_10_15_x86_64.whl
.
File metadata
- Download URL: jsonschema_rs-0.3.1-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 295a8f7e70ee090fe906696ca3854ca904dc68f1a68070a8a70cabe0a503e28b |
|
MD5 | 588da8b6e5510a0d3fb2f92b6ddd446a |
|
BLAKE2b-256 | ed8e0fcba833d5fb36968ff9913a66b409518aa47de242ca909b2ce00b212c78 |
File details
Details for the file jsonschema_rs-0.3.1-cp37-cp37m-win_amd64.whl
.
File metadata
- Download URL: jsonschema_rs-0.3.1-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7c2123c0931695e1733501539cc8db9740df0c9a0250e51f27c5e6c3196b9108 |
|
MD5 | 3e0b1e8f7a98681861008ac86408a204 |
|
BLAKE2b-256 | df1d68abecb654fadc5bf7e5397618637e50a1e416aab48cac282e98b248f25d |
File details
Details for the file jsonschema_rs-0.3.1-cp37-cp37m-manylinux2014_x86_64.whl
.
File metadata
- Download URL: jsonschema_rs-0.3.1-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 79d7776a2478f48af5a9da3693e0fd2202b4237626a7acf420b27f0d9a713e68 |
|
MD5 | 698ce98b834ee5d0d91a08fbadb6320f |
|
BLAKE2b-256 | dabfd3a8d8f5294018563d8eeb4e706f9a4e17b0290ff0a018bfffd0ecd48554 |
File details
Details for the file jsonschema_rs-0.3.1-cp37-cp37m-macosx_10_15_x86_64.whl
.
File metadata
- Download URL: jsonschema_rs-0.3.1-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0a4d3b7e1a922e28cca98861bf13fde393b73d3f75b1545f51e163d0b56641ae |
|
MD5 | 0199fcd89190c620c9435c09015fc88c |
|
BLAKE2b-256 | 6d4e1a276617c879477ec0f51f78a37c3094714cfae4d4b96ee4ea8424668efd |
File details
Details for the file jsonschema_rs-0.3.1-cp36-cp36m-win_amd64.whl
.
File metadata
- Download URL: jsonschema_rs-0.3.1-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0c2dce7ea8d7362d5eb0972094f1266fb0c00d7f91b3a5e0de97567f93cb8e25 |
|
MD5 | 3cb06a57de3bd76308a27e8ba0598d34 |
|
BLAKE2b-256 | ec47ecaf55fa9b18999de8730ee807f38c347761930fd4819f3384082cd9cffa |
File details
Details for the file jsonschema_rs-0.3.1-cp36-cp36m-manylinux2014_x86_64.whl
.
File metadata
- Download URL: jsonschema_rs-0.3.1-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 11626920f66bb0c29161177e79b125497a22e01064aa939fd3da4ff3679ba6f3 |
|
MD5 | 64e8e3f4303ca83a2110fce89a220603 |
|
BLAKE2b-256 | cc8339a1a889f090a04fe9635ce94cac90a3d4db6afb75a0a940b056fa78a9f3 |
File details
Details for the file jsonschema_rs-0.3.1-cp36-cp36m-macosx_10_15_x86_64.whl
.
File metadata
- Download URL: jsonschema_rs-0.3.1-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4ac8244ce47227df57cbbefbce5db9236aaf9713e43e81e10758284ed431d379 |
|
MD5 | 9b12a871a04c600286f704cad1e538bc |
|
BLAKE2b-256 | c510de407eb0236f7ec8a212c162a4c80c085b0e341e9ce4f249b9d7750e219a |
File details
Details for the file jsonschema_rs-0.3.1-cp35-cp35m-win_amd64.whl
.
File metadata
- Download URL: jsonschema_rs-0.3.1-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | ddad44f1b15f2ceada80aacc7d50aefe2457dfd4e9c3715c173b706c02352d38 |
|
MD5 | f28d15d1ab1e2095eaa03ef7733555c4 |
|
BLAKE2b-256 | fff303035748483fb5b6ee334f450fa6037b8a1f417897591cf64376dc6d6816 |
File details
Details for the file jsonschema_rs-0.3.1-cp35-cp35m-manylinux2014_x86_64.whl
.
File metadata
- Download URL: jsonschema_rs-0.3.1-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 60cf03bde407f7267c54afc70df8a4fbe5b88bc1609cdbec574872a21b00f040 |
|
MD5 | 5e6565a9fb07ca3ad637536db3461af8 |
|
BLAKE2b-256 | 1b6794a0a776a14c66a672ccfe0b80c058ec523d4a6540b9c797693815065d67 |
File details
Details for the file jsonschema_rs-0.3.1-cp35-cp35m-macosx_10_15_x86_64.whl
.
File metadata
- Download URL: jsonschema_rs-0.3.1-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8b363bedb9e64b15f9b93a9495a2eb18b9e865e8acb35c820e2dd6f26b149e16 |
|
MD5 | 1c56dc48ffbc8642c632ef88906a37da |
|
BLAKE2b-256 | b50dabc95d5491d8ae4b6d38b28f01e9b1f43ba2fe08ad9afed109b0cdfa76ff |