jacobs-json-schema
This package is yet another JSON Schema validator. I wrote it because I needed something small to run in Python 3.5.
Most data validation features are supported without any dependencies (see "Conformance").
Documentation
Is available at Read the Docs.
Usage
Before using this library, the schema dna data must already be parsed into a Python data structure. This can be as simple as using json.loads().
from jacobsjsonschema.draft7 import Validator
schema = { "type": "string" }
validator = Validator(schema)
data = "Hello world"
validator.validate(data)
# Will throw if there are any validation errors
Lazy error reporting is also supported. This means that as much of the data as possible is evaluated, and errors are collected instead of raising an exception.
schema = { "type": "string" }
validator = Validator(schema, lazy_error_reporting=True)
data = "Hello world"
if validator.validate(data):
print("Validated")
else:
for error in validator.get_errors():
print(error)
Conformance
There are two ways of running the validator:
- Passing a JSON-deserialized Python dictionary as the schema. There are no additional external dependencies needed. Straightforward
$refreferences (no usage of$id) within the same schema are supported. - Parse the schema using utility from the
jacobs-json-docpython package, and pass the wrapped schema to the validator. Several external dependencies are required. Full$idand$reffunctionality is supported.
Where "Mostly" is specified, it passes all tests excluding those from ref.json, id.json, defintions.json, refRemote.json and unknownKeyword.json.
| Specification | Standalone | using jacobs-json-doc |
|---|---|---|
| Python Version | 3.7+ | 3.12+ |
| Draft-04 | Mostly | Passes |
| Draft-06 | Mostly | Passes |
| Draft-07 | Mostly | Passes |
| Draft-2019-09 | Untested | 1238/1259 Passed |
| Draft-2020-12 | Untested | 1153/1299 Passed |
License
MIT License. If you modify the source, please publish your modifications.
Metadata
Release files for jacobs-json-schema 0.6.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| jacobs_json_schema-0.6.1.tar.gz | 428.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| jacobs_json_schema-0.6.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 448.9 kB
Release files / jacobs_json_schema-0.6.1.tar.gz
| Download URL | jacobs_json_schema-0.6.1.tar.gz |
|---|---|
| Size | 428.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4411c9176f2ab24232194fcac0a0dc27bdfe2a464bd6b02510a7879f4b620891
|
|
BLAKE2b-256 checksum How to use checksums |
ee9cd9cd2f8f11116e98c20e39375e031b7c3aec3fc6f12581f04c99a66016d6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / jacobs_json_schema-0.6.1-py3-none-any.whl
| Download URL | jacobs_json_schema-0.6.1-py3-none-any.whl |
|---|---|
| Size | 20.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1a4f443a4523dca6e0c17a8243f8127ed61e45b5f7b8b8d2b6de67c6b0963eb4
|
|
BLAKE2b-256 checksum How to use checksums |
3d78ba1e482a596638cf7a9f20f50d1f5d5ea395eded2aa2ca472ccbf7444c6d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|