pyjsg (Python JSON Schema Grammar interpreter) is a library that allows defining JSON schemas as Python classes and validating data against these generated structures. It provides tools to convert JSON Schema definitions into Python objects, facilitating type-safe data handling and validation within Python applications. The current stable version is 0.12.3, with releases occurring as features and bug fixes are implemented, typically not on a fixed schedule.
pip install pyjsgVerified import paths — ran on the pinned version, not inferred.
This quickstart defines a simple 'Person' JSON Schema using `pyjsg` decorators, creates a validator, and demonstrates validating both valid and invalid data against it. It also shows how to access the validated data as a Python object and dump it back to a dictionary.
Review `pyjsg`'s supported JSON Schema features and adjust your schema accordingly. Consider breaking down complex schemas or using `pyjsg` for the core data structures and a more generic validator for auxiliary constraints.
Always pin `pyjsg` to an exact version in `requirements.txt` (e.g., `pyjsg==0.12.3`). Review release notes carefully when upgrading. Consult the latest documentation for updated API usage.
Work with the `pyjsg` generated Python objects directly when possible. If you need to manipulate raw dictionaries, ensure they conform to the schema and re-validate or re-instantiate through the `pyjsg` class if you intend to continue using `pyjsg`'s type safety.
No dependency data recorded yet.