Skip to main content

JSON Schema compatibility checker for evolving schemas

Project description

jsoncompat

Python bindings for checking compatibility of evolving JSON schemas and generating example values.

Installation

Install from PyPI:

pip install jsoncompat==0.3.0

Usage

import jsoncompat as jsc

# Define old and new schemas as JSON strings
old_schema = '{"type": "string"}'
new_schema = '{"type": "number"}'

# Check compatibility (role: "serializer", "deserializer", or "both").
# Raises ValueError for invalid schemas or unsupported compatibility features.
is_compatible = jsc.check_compat(old_schema, new_schema, jsc.Role.BOTH)
print(is_compatible)

# Generate an example value for a schema
example = jsc.generate_value(old_schema, depth=5)
print(example)

Public Interface

  • check_compat(old_schema_json: str, new_schema_json: str, role: str = "both") -> bool
    • role must be "serializer", "deserializer", or "both".
    • Raises ValueError for invalid schemas or unsupported compatibility features such as non-integral number.multipleOf.
  • generate_value(schema_json: str, depth: int = 5) -> str
    • Returns a JSON string for one generated value accepted by the schema.
    • Raises ValueError when the schema is invalid, known to be unsatisfiable, or generation exhausts its retry budget.
  • Role.SERIALIZER, Role.DESERIALIZER, and Role.BOTH are string constants accepted by check_compat.

Schemas are passed as JSON strings. The bindings are intentionally thin: they parse the strings, call the Rust core APIs, and map Rust errors into ValueError.

Examples

See the basic demo:

License

MIT License. See:

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

jsoncompat-0.3.1-cp313-cp313-win_amd64.whl (2.0 MB view details)

Uploaded CPython 3.13Windows x86-64

jsoncompat-0.3.1-cp313-cp313-win32.whl (1.8 MB view details)

Uploaded CPython 3.13Windows x86

jsoncompat-0.3.1-cp313-cp313-musllinux_1_2_x86_64.whl (2.7 MB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ x86-64

jsoncompat-0.3.1-cp313-cp313-musllinux_1_2_aarch64.whl (2.5 MB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ ARM64

jsoncompat-0.3.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.4 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

jsoncompat-0.3.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.4 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

jsoncompat-0.3.1-cp313-cp313-macosx_11_0_arm64.whl (2.1 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

jsoncompat-0.3.1-cp313-cp313-macosx_10_12_x86_64.whl (2.2 MB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

jsoncompat-0.3.1-cp312-cp312-win_amd64.whl (2.0 MB view details)

Uploaded CPython 3.12Windows x86-64

jsoncompat-0.3.1-cp312-cp312-win32.whl (1.8 MB view details)

Uploaded CPython 3.12Windows x86

jsoncompat-0.3.1-cp312-cp312-musllinux_1_2_x86_64.whl (2.7 MB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ x86-64

jsoncompat-0.3.1-cp312-cp312-musllinux_1_2_aarch64.whl (2.5 MB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ ARM64

jsoncompat-0.3.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.4 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

jsoncompat-0.3.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.4 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

jsoncompat-0.3.1-cp312-cp312-macosx_11_0_arm64.whl (2.1 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

jsoncompat-0.3.1-cp312-cp312-macosx_10_12_x86_64.whl (2.2 MB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

jsoncompat-0.3.1-cp311-cp311-win_amd64.whl (2.0 MB view details)

Uploaded CPython 3.11Windows x86-64

jsoncompat-0.3.1-cp311-cp311-win32.whl (1.8 MB view details)

Uploaded CPython 3.11Windows x86

jsoncompat-0.3.1-cp311-cp311-musllinux_1_2_x86_64.whl (2.7 MB view details)

Uploaded CPython 3.11musllinux: musl 1.2+ x86-64

jsoncompat-0.3.1-cp311-cp311-musllinux_1_2_aarch64.whl (2.5 MB view details)

Uploaded CPython 3.11musllinux: musl 1.2+ ARM64

jsoncompat-0.3.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.4 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

jsoncompat-0.3.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.4 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

jsoncompat-0.3.1-cp311-cp311-macosx_11_0_arm64.whl (2.1 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

jsoncompat-0.3.1-cp311-cp311-macosx_10_12_x86_64.whl (2.2 MB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

File details

Details for the file jsoncompat-0.3.1-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for jsoncompat-0.3.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 62442f2c7fadefe98b08cc71da45e86e2befd747d3aa755bfc171412b533b77d
MD5 3d222976b91719db9f0f96e85766c12d
BLAKE2b-256 ac7d6ec115fc8aa94e2bac87efe32f818362837591eaa30457c30d14fbf239f6

See more details on using hashes here.

File details

Details for the file jsoncompat-0.3.1-cp313-cp313-win32.whl.

File metadata

  • Download URL: jsoncompat-0.3.1-cp313-cp313-win32.whl
  • Upload date:
  • Size: 1.8 MB
  • Tags: CPython 3.13, Windows x86
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: maturin/1.12.6

File hashes

Hashes for jsoncompat-0.3.1-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 5a127c48b8663c5fe29fbd759a1809fa16b833622a1529f7ea2865977334e453
MD5 e9c60ab136475bdb1ebd77a456f69c43
BLAKE2b-256 4b31b23581c38e71f2c1bda27b01f1431b4c7c74cda53d926d2e12a6e9dcf3ec

See more details on using hashes here.

File details

Details for the file jsoncompat-0.3.1-cp313-cp313-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for jsoncompat-0.3.1-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 a30084a5a5cf834ec43860ece69f9d83c03aa1a4ea0c7fec83daa4d15ed5af38
MD5 2fb067825b85064b2ff9eb53c4e5e311
BLAKE2b-256 0f511106570cc03da0922f7193f71f469b488c4fa86a234f9a8d4c37e4d5f0bb

See more details on using hashes here.

File details

Details for the file jsoncompat-0.3.1-cp313-cp313-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for jsoncompat-0.3.1-cp313-cp313-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 637b42adc8d48f939d40240bc603b7f0c64e32fa3730ed9a8bd58b9c013bd050
MD5 43433b5da2269debb87f84b301bb2fcb
BLAKE2b-256 bb56465c772a6eab50bfc47c71ba5aed616d7457febef33d76a58553c9d8efad

See more details on using hashes here.

File details

Details for the file jsoncompat-0.3.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for jsoncompat-0.3.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d3244d438a80fd738111ca5591b50589cf4084f6f3843133f0ee51d7b8998adf
MD5 be8593e663b2dda6799979dd98e7d2d2
BLAKE2b-256 e638bf4affbf4c4951565ab1d2ff9590cb174d04be8ebb1ac0d7fd0b34d3ffe0

See more details on using hashes here.

File details

Details for the file jsoncompat-0.3.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for jsoncompat-0.3.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 5e52d43176fdb1be8e5f4c6a19f9fc814efe904e83a1a95efb5a28eec195a83f
MD5 486496d8efa23b6fa6b3b99ac65b78c7
BLAKE2b-256 5a148fd24b4c47eff9a0e32c01df4972a40e603f744de46590df4712506f2912

See more details on using hashes here.

File details

Details for the file jsoncompat-0.3.1-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for jsoncompat-0.3.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 74ac3b84883584c2c3767b7d72ad55a9d5fc482042fa95c0fa64db1a4134ac0d
MD5 d056f083233a149f1423004c5a1d98f9
BLAKE2b-256 bc1cf61d8874a771b1ae0a1917afaf51abdb19c398f65a62a999f8e7050890dc

See more details on using hashes here.

File details

Details for the file jsoncompat-0.3.1-cp313-cp313-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for jsoncompat-0.3.1-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 2928c04fd91cec35073668f182015ecba9a5049a0d990ced7c16fc91cdf9dea6
MD5 a5f4c25bcab6d296613275e945d07c89
BLAKE2b-256 ae25e004ad0137025c0b40535a44d452bf0b458993e76a9809a7f64e74ae891a

See more details on using hashes here.

File details

Details for the file jsoncompat-0.3.1-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for jsoncompat-0.3.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 37462c7c77f07f80f37c476f417623093397e32cf066c584a8e1772a26cb0e7f
MD5 aaf188d62d7e7c76c95c9186491037ee
BLAKE2b-256 4df506247b76519481d4c927f20631a861dffa1904e8d3e465043634f3784c1b

See more details on using hashes here.

File details

Details for the file jsoncompat-0.3.1-cp312-cp312-win32.whl.

File metadata

  • Download URL: jsoncompat-0.3.1-cp312-cp312-win32.whl
  • Upload date:
  • Size: 1.8 MB
  • Tags: CPython 3.12, Windows x86
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: maturin/1.12.6

File hashes

Hashes for jsoncompat-0.3.1-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 454fca2d56a1dfcd5b7c8f71d9a72fe1e026e5e82924a1fb81b64aa1201ee353
MD5 e1098a7cdb9dd1c24eac4081d51d5dfe
BLAKE2b-256 8ddd5e1a3b6b5985c0e4a503b1fe34d8f56f978caf02457f9f84732000d88392

See more details on using hashes here.

File details

Details for the file jsoncompat-0.3.1-cp312-cp312-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for jsoncompat-0.3.1-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 5b5b31bdf7387691ffafb9670740fa6f02aeca3e3f8a95aaed55098142d9caff
MD5 83309c6dea97b283962d8b81f346682a
BLAKE2b-256 64007497aa0d1f7943c069482fa5cc589316fa8403ea41ed0b5f5733e1822c12

See more details on using hashes here.

File details

Details for the file jsoncompat-0.3.1-cp312-cp312-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for jsoncompat-0.3.1-cp312-cp312-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 45850fa4cb73c962a426142de24792e4c655244aa210f21ff76108c0f9eb8623
MD5 bd773df4becf4929b3f597635199c3e7
BLAKE2b-256 5aa0723cd4b7aa1674b097993f25478a6ae6d452f0ec067341533826320aa288

See more details on using hashes here.

File details

Details for the file jsoncompat-0.3.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for jsoncompat-0.3.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0164849efa1557bf371b6d1f58b23c2c292e4cc973ca86d02d4a5a3dd87656af
MD5 34f4494823faa6efd2c96795293a8706
BLAKE2b-256 e83f02766e1c406f163e9d1031a1671442fba0f35dc2463423d5ac3c79aa3437

See more details on using hashes here.

File details

Details for the file jsoncompat-0.3.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for jsoncompat-0.3.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 190d3d0c68935b7c1e41e38b78b12e70df0848bd91976eb238d745cb519dfd00
MD5 f094a13727087001e22da45067ef4938
BLAKE2b-256 4a97801dff6105934b26d8123023f4e554a2c063fd94a32fcc7a7bd1cc042e5c

See more details on using hashes here.

File details

Details for the file jsoncompat-0.3.1-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for jsoncompat-0.3.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7b857590a7cfaab74f6263ba8e60a2b099135001b94acba2ebf3651631ac2c9c
MD5 cb99691c8fae36ec04510aa48ba19ddb
BLAKE2b-256 93397d225fbabe717212390b5ca04d9352b8a5970cc7e935730c49f810c2af67

See more details on using hashes here.

File details

Details for the file jsoncompat-0.3.1-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for jsoncompat-0.3.1-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 24de7daf06e601179bb177abb15102cb4cf87e5f41087086ff9049c9e0016fea
MD5 567c9012aed84275ae2683cb8b0a66fe
BLAKE2b-256 6a33c9d5b89374e0b9729eb2ff9d30bd35f881ed7e8aba51f5e6e695d60c792f

See more details on using hashes here.

File details

Details for the file jsoncompat-0.3.1-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for jsoncompat-0.3.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 d986fff5bf4df78c9f52f616611fc82291c6253e4ee0bd02008f93ee54b00b11
MD5 5c4ee6f6120d1f2721cc2b23f3ca1226
BLAKE2b-256 d21772d172d8150c4c838969637a042162e5f4a7ad7de2a8aeb57abcf8c6ccdd

See more details on using hashes here.

File details

Details for the file jsoncompat-0.3.1-cp311-cp311-win32.whl.

File metadata

  • Download URL: jsoncompat-0.3.1-cp311-cp311-win32.whl
  • Upload date:
  • Size: 1.8 MB
  • Tags: CPython 3.11, Windows x86
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: maturin/1.12.6

File hashes

Hashes for jsoncompat-0.3.1-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 7caeef7f3201b2999d9a63cfe3df988a2cbe47db7d4c93d7e30bc037181255fb
MD5 7d7b8bf0abb61e441ee3f0003de9ae8e
BLAKE2b-256 2dc6349ca5178ec9ed7e33b2d1a51e1bb52eb315f96a95f391deaf0b7705ca89

See more details on using hashes here.

File details

Details for the file jsoncompat-0.3.1-cp311-cp311-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for jsoncompat-0.3.1-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 143c4e446396d08dd6dea15f631ef2e1176f37da86da2cc1bfa1980c62b8b875
MD5 bb88592e94cd8dc644c0c57f6d3ced5f
BLAKE2b-256 8f4cdc7827ec6f7ed611475e05760b64ac9fae1d6b425596b0d8a157d89a4772

See more details on using hashes here.

File details

Details for the file jsoncompat-0.3.1-cp311-cp311-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for jsoncompat-0.3.1-cp311-cp311-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 88bd3a6e9dee16cf6d5bf8831b9d33af4f39f46b915815e8f74c94d8b2a63852
MD5 329954fa30727b3764ce3a22f018737c
BLAKE2b-256 72a32398e4fea2497030f387d798ae8f6e25a921aaf1f54f47ff6913a14f24f4

See more details on using hashes here.

File details

Details for the file jsoncompat-0.3.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for jsoncompat-0.3.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c949f56fb8d8cbf0eec5fa06c7094dd9e60cd084b132e545a7b18f1ba1a4d8c3
MD5 43cf9aac043954fa59342a730e4f957a
BLAKE2b-256 12d6a62d0643b2700258416e07d5c4ef285da2b418a3be960f9b6369e9e375dc

See more details on using hashes here.

File details

Details for the file jsoncompat-0.3.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for jsoncompat-0.3.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 63f48316c4aab1619f3563f6f220906c9613e0bed65fb1cbf7bc36d666a19a22
MD5 42506c762b4f762dba507ce5a0d77225
BLAKE2b-256 d06cc05f8ff73cb596ba1c731088af78527fbc275c50692fe41e6e6360e7f42f

See more details on using hashes here.

File details

Details for the file jsoncompat-0.3.1-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for jsoncompat-0.3.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 852ca3e725aea19e8ce32bf03c1491127e8ffc5f3b04f3fda2972d7b1c41c50b
MD5 79e4a70f9cea817b16d766ce8c3bf76f
BLAKE2b-256 05ef24b5e89e0ec716179fd4bdc1edfe3a648ac94a8c0e65826a5e4be22d35a6

See more details on using hashes here.

File details

Details for the file jsoncompat-0.3.1-cp311-cp311-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for jsoncompat-0.3.1-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 811c257ad5eea85dc6977dc62bd8927e76efe39c2e07a5f4b2986d86917cf3b2
MD5 e0b8e8a36de8ccd3d5ce6eca12e0c806
BLAKE2b-256 aef425fbcc64c2f65c86e82818cf89821f97093e5595cffc20219b7d4c6d1b99

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