Skip to main content

jacobs-json-schema

CI Coverage Status Documentation Status

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:

  1. Passing a JSON-deserialized Python dictionary as the schema. There are no additional external dependencies needed. Straightforward $ref references (no usage of $id) within the same schema are supported.
  2. Parse the schema using utility from the jacobs-json-doc python package, and pass the wrapped schema to the validator. Several external dependencies are required. Full $id and $ref functionality 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 Untested
Draft-2020-12 Untested Untested

License

MIT License. If you modify the source, please publish your modifications.

Download files

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

Source Distribution

jacobs_json_schema-0.5.1.tar.gz (373.7 kB view details)

Uploaded Source

Built Distribution

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

jacobs_json_schema-0.5.1-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

Details for the file jacobs_json_schema-0.5.1.tar.gz.

File metadata

  • Download URL: jacobs_json_schema-0.5.1.tar.gz
  • Upload date:
  • Size: 373.7 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for jacobs_json_schema-0.5.1.tar.gz
Algorithm Hash digest
SHA256 b30c7c9ae8e45b1ce4c42d578e75e16901e022f471b8c85db19da26467a7d2f5
MD5 9c2dcb21517ca84ee4e0f6631b985bda
BLAKE2b-256 1d55aa3dad4230a8656951ab3103840f907afa2c2b50fc472624de50eabcde62

See more details on using hashes here.

File details

Details for the file jacobs_json_schema-0.5.1-py3-none-any.whl.

File metadata

  • Download URL: jacobs_json_schema-0.5.1-py3-none-any.whl
  • Upload date:
  • Size: 12.6 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for jacobs_json_schema-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3bf57737b75471384b4af2d1da8ca28af56783ea396137d027f2702ac51824c1
MD5 47ba00b73c63f16f3a3de1626fe12cbd
BLAKE2b-256 7fb84cdd754755ebc610b755fd9aa371968bcf61c71f877fcfb9852bc90296f6

See more details on using hashes here.

Release history Release notifications | RSS feed

0.6.1

2 files

0.6.0

2 files

This release

0.5.1 This release

2 files

0.5.0

2 files

0.4.2

2 files

0.4.1

2 files

0.4.0

2 files

0.3.0

2 files

0.2.2

2 files

0.1.1

2 files

Supported by

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