jsonschema-path is a Python library that provides an object-oriented way to traverse and access JSONSchema definitions. It enhances JSON Schema handling by offering path-like navigation and on-demand dereferencing with a separate accessor layer. It is currently at version 0.4.5 and actively maintained with a regular release cadence, focusing on bug fixes and feature enhancements.
pip install jsonschema-pathVerified import paths — ran on the pinned version, not inferred.
Demonstrates creating a SchemaPath from a dictionary, traversing properties, dereferencing `$ref`s, and accessing schema content. It also shows how to enable the optional resolved-path cache for performance improvements.
Upgrade your Python environment to 3.10 or newer, or pin jsonschema-path to a version before 0.4.0.
Initialize `SchemaPath` or `SchemaAccessor` with `resolved_cache_maxsize` set to a positive integer, e.g., `SchemaPath.from_dict(schema_dict, resolved_cache_maxsize=64)`.
Upgrade to `jsonschema-path` 0.4.5 or later to ensure correct `SchemaAccessor.resolver` behavior and backward compatibility. Review custom resolver logic if issues persist.
Refer to the `jsonschema-path` release notes for the supported `referencing` versions. As of 0.4.1, `referencing 0.37` is supported. Pin `referencing` to a compatible version if necessary.
Downgrade the `jsonschema` package to a version less than 4.0. For example: `pip install 'jsonschema<4.0'`
Inspect the structure of your JSON schema or instance data at the point of the error. If it's an array, use list indexing (e.g., `[0]`) instead of `.get()` to access elements, or iterate over the list. Ensure your code correctly handles both array and object types where they might appear.
Verify that the `$ref` value correctly points to an existing and accessible location. For local file references, ensure the base URI (if manually configured or if the schema relies on external files) includes a trailing slash for directories, and that all referenced files exist relative to the base.
Install the `jsonschema` package using pip: `pip install jsonschema`. If you are using a virtual environment, make sure it is activated before running the installation command.