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

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.0-cp313-cp313-win_amd64.whl (2.0 MB view details)

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13Windows x86

jsoncompat-0.3.0-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.0-cp313-cp313-musllinux_1_2_aarch64.whl (2.5 MB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ ARM64

jsoncompat-0.3.0-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.0-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.0-cp313-cp313-macosx_11_0_arm64.whl (2.1 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.13macOS 10.12+ x86-64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12Windows x86

jsoncompat-0.3.0-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.0-cp312-cp312-musllinux_1_2_aarch64.whl (2.5 MB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ ARM64

jsoncompat-0.3.0-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.0-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.0-cp312-cp312-macosx_11_0_arm64.whl (2.1 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.12macOS 10.12+ x86-64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11Windows x86

jsoncompat-0.3.0-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.0-cp311-cp311-musllinux_1_2_aarch64.whl (2.5 MB view details)

Uploaded CPython 3.11musllinux: musl 1.2+ ARM64

jsoncompat-0.3.0-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.0-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.0-cp311-cp311-macosx_11_0_arm64.whl (2.1 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

jsoncompat-0.3.0-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.0-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for jsoncompat-0.3.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 63c323cb10cbec4172f4f4990cf6e2b33ecf2dd610e9b278267b87fb3fb9cb1d
MD5 ae9f72d45aef8ba8e5adc12cb5ec26db
BLAKE2b-256 9b2cdd04bb6d8730045a4d980da2193aef05a6d2ebd4255f940201e21004fc25

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jsoncompat-0.3.0-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.0-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 4c5f6be3b43f6db2915d3540b14468de700c7d49856c044065992ada0728548f
MD5 7786c298f57b5d249fa1e4ab4198a8b0
BLAKE2b-256 f1405561fb79df2243215d68beebd6dcb3b755fcb6391dcb1fe32e84513e7e2b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jsoncompat-0.3.0-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 f917e8744378c5588067ffb1ccf2bf6f4acbffdd272e7a84e0286888594d0c6b
MD5 6ab2318bfdf51b070b1eeeab9adee0b8
BLAKE2b-256 bdb88c227ee01ea3487d0a5b649c9052a6449bca2378f375501f1f72e0db5bf8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jsoncompat-0.3.0-cp313-cp313-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 a4a9e8cf22a2c764b5950dda7ad555e41fada9d03e074deecd9a1a9d5f4e4ba3
MD5 0b02b5b884ddbc2f99baa519c52e2f8f
BLAKE2b-256 7c16cb145575d02932c76426e485bb15138d9dbb00b19ee8ed84a69c79f80172

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jsoncompat-0.3.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8da09f1d17295c4a661a84390d5f735479734c3c5e3b46d6467046160eb0162a
MD5 353061100f7535825a4267794c30ff2d
BLAKE2b-256 9962ebc2cc4a13abc95a2f0abe0dbf971a527a83494a4e74efdcc63078d0c26e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jsoncompat-0.3.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ab5df16e1a2d878095ab5c9c37a88d2a7e7a35264d8c1704ebe3393a7c3cb912
MD5 4d8159d5eb163629d06a7707784c68b8
BLAKE2b-256 1216bedb7bab07564b570fc37519ebc4d3c54fdce04eaf310c91233b54ab6d06

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jsoncompat-0.3.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6910a530942a354287017e9673857692af5bc0a2591031961f3e57557f67def4
MD5 f0ca244a186212cbd7a38da315b7d9df
BLAKE2b-256 be936732ef448cc8ecaeda1daf82e759ec88bd0714a67390da2780942e67b00f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jsoncompat-0.3.0-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 0bcf479b40258db620f20f118965ba35982203aa8f9bd8a7bf579895a2bbeb40
MD5 680f38cf63c6e4d4208dba1d29876d8e
BLAKE2b-256 c787098265a1dcee0f11df739106b6045a0c3efaa2417d1aa74b3dad7706ac78

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jsoncompat-0.3.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 3930771904ecad72b9f7622198fb61766a7f4987cea216fe65fa0bb1222e6a47
MD5 ec1345f2f41d6080891651736180fb22
BLAKE2b-256 6c9b957d729d64238ef8331d6671a6d4f7f09aac06dc524f1d21dcfd8b766087

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jsoncompat-0.3.0-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.0-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 dfa16cd8d9019157a5153d2828dea432221a8a8e7d50619a872e4865c53d0f21
MD5 98b20acbf4d4b7f5a3c6c8a5e666ac24
BLAKE2b-256 985c231f242e21a38545a0636b37bad9dd6bae5fb29fab985eaffd787fa0a5bd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jsoncompat-0.3.0-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 e20e2cedf928e6c5ec04018cb6100cde1fc4b9cc70819b4adfbed95cfd39f92c
MD5 d1d011b51183a293cfca4576cfe8a3a7
BLAKE2b-256 19df0288f8772eb5d938b97536ab4a974e139b29276084278d15ef493ecf79ed

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jsoncompat-0.3.0-cp312-cp312-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 6bea6cc933b61d2ed90f087b0fab28fb8e40537e233378d0dc70e56c1a3e24c3
MD5 18f212a50c4ab4316ec643475c510a46
BLAKE2b-256 8ab14f1b7e8064ab44c7536b48812ffc8d66b9f5dd45762f773bf3169768c5a6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jsoncompat-0.3.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8edd1bfddccdead146de78abd387bb3923a6d66f8aa3472c0cf9032b3288d9b6
MD5 21dcdd86a45e6626d7d15bb5f8c29e42
BLAKE2b-256 9050772807afb48edcaa328716e57096a3f251122c1a0242708374a0a6e59236

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jsoncompat-0.3.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 90fabc3b87939a795ee2e153f175a4a5bc335844facc2a7219f4b0720ff950a4
MD5 4988fd6445b79bf677863bc090162810
BLAKE2b-256 68eb42bd729898f352bfb4ecfbbd297e78119ded3c28629a34e6c47f5c53e33b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jsoncompat-0.3.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4e6b0059c9d9a6441ea9017a323fb97da70feaba576ed019165511ece45a9885
MD5 87c7739e75d975046e18b485bd7b82cd
BLAKE2b-256 c687f1df64ff1bbaa1cd840c68c81ebcb969e0b3f6a01af53efbaa6365bd02f4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jsoncompat-0.3.0-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 7b14088d497026650d0dbce7cc569e7060b4d3e4dd866093c25715984585c987
MD5 3448def1601c1e8a156b82eb072cd7bc
BLAKE2b-256 4cea4198f78221295021042728077d2e0b8895039746cbf7fcd97d748b0104c8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jsoncompat-0.3.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 b248cb7b7d2cb640fd471247ad1e30e338e20227781e2bb07314036128abf21b
MD5 abdd9585b216411aae2ce7493485720c
BLAKE2b-256 487ac02154a1a1919dff699e870ac640acf154271f9f1f9d677e4a34ee49b62a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jsoncompat-0.3.0-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.0-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 da4ce6c97f67ea0ab08cad261f0c648510aca9fe13c9d8a84170c189cbb03422
MD5 8ac162df3c81e532226c88b2399adfda
BLAKE2b-256 44e58763562b253f8027af6a7d58e0dd64f5d707368cce416a9c232ae7b983ac

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jsoncompat-0.3.0-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 20db37614b0637e7a9e2ae2da8e123b8f69a24909de0be6aba0c2723a34de86a
MD5 e84797378ba3995012c11c15de9f5ed8
BLAKE2b-256 a01fd181922b96af79d125bb679a7292f2918161cc0fabc777829fb91627c9c2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jsoncompat-0.3.0-cp311-cp311-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 55991ea9323624e422172fa52a7b7bfaf9516326c6c8ac13e3dcfa517861c61c
MD5 55adf42cec2d7931f9d3e6643527d0c7
BLAKE2b-256 d9e5d3ad2030cc5b1811e714ae12042a33bac84722ac26cd43ba2894e5ca48d2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jsoncompat-0.3.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 045face8e261b8fa7e7f0051ab575a1472be25fb54fdeb687a5276628d0c83b1
MD5 78a731a837930d57bf90949511221731
BLAKE2b-256 dbae08ee9a60a5ec8bfb40108fa163f5d08b607d93953c1ad5f8961e7e516b57

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jsoncompat-0.3.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d47cc0fd5cc7716d6e5668210110d6eabb756923fe3b91b4621fd1f1414a7f96
MD5 f6593c5d2a3551409f33eb7514919166
BLAKE2b-256 2d68b4eb417ef43f09e7aaf6fa4ed9d495b5d99ad2882a2eb4cff5f511540b9e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jsoncompat-0.3.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d57f275b129e0116f2b700887713512be71cf5936476537b0d8a1540fd88dac7
MD5 4ba41eeea57a1c208b746e56fde1923f
BLAKE2b-256 d000d96bae2e4607f701a87f843ecb74aaf45df01d4f31c4e863c5e46bccf860

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jsoncompat-0.3.0-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 b38ce2306e06e42d0894870a49c8981db9cd23ef742d5031acf2cca1c8c08b16
MD5 b66e2c1f52ce7b90159203e13fd2e629
BLAKE2b-256 ae085fcaffc3cc81e8a366397f4912c3386a07665818547b18d8fb89f970a9d4

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