{"id":524,"library":"jsonschema-path","title":"JSONSchema Spec with object-oriented paths","description":"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.","status":"active","version":"0.4.5","language":"python","source_language":"en","source_url":"https://github.com/p1c2u/jsonschema-path","tags":["jsonschema","swagger","spec","json-schema","path","validation","schema-traversal"],"install":[{"cmd":"pip install jsonschema-path","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Explicitly requires Python 3.10 or newer.","package":"python","optional":false},{"reason":"Used for JSON Schema reference resolution; version 0.37+ is supported.","package":"referencing","optional":false}],"imports":[{"symbol":"SchemaPath","correct":"from jsonschema_path import SchemaPath"}],"quickstart":{"code":"from jsonschema_path import SchemaPath\n\nd = {\n    \"properties\": {\n        \"info\": {\n            \"$ref\": \"#/definitions/Info\"\n        }\n    },\n    \"definitions\": {\n        \"Info\": {\n            \"properties\": {\n                \"title\": {\n                    \"type\": \"string\"\n                },\n                \"version\": {\n                    \"type\": \"string\",\n                    \"default\": \"1.0\"\n                }\n            }\n        }\n    }\n}\n\npath = SchemaPath.from_dict(d)\n\n# Traverse schema like paths\nassert \"properties\" in path\n\n# Concatenate paths with /\ninfo_path = path / \"properties\" / \"info\"\nassert \"properties\" in info_path # Implicit dereferencing\n\nversion_path = info_path / \"properties\" / \"version\"\n\n# Open content with implicit dereferencing\nwith version_path.open() as contents:\n    print(contents)\n# Expected output: {'type': 'string', 'default': '1.0'}\n\n# Enable resolved-path LRU cache for performance\npath_with_cache = SchemaPath.from_dict(d, resolved_cache_maxsize=64)","lang":"python","description":"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."},"warnings":[{"fix":"Upgrade your Python environment to 3.10 or newer, or pin jsonschema-path to a version before 0.4.0.","message":"Python 3.8 and 3.9 support has been dropped. The library now requires Python >=3.10.","severity":"breaking","affected_versions":"<0.4.0"},{"fix":"Initialize `SchemaPath` or `SchemaAccessor` with `resolved_cache_maxsize` set to a positive integer, e.g., `SchemaPath.from_dict(schema_dict, resolved_cache_maxsize=64)`.","message":"The resolved-path LRU cache is disabled by default (`resolved_cache_maxsize=0`). For applications with repeated path lookups, enabling this cache can significantly improve performance, especially for `read_value` and membership checks.","severity":"gotcha","affected_versions":"0.4.0+"},{"fix":"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.","message":"Version 0.4.5 introduced a fix for `SchemaAccessor.resolver` backward compatibility (issue #246). If you have custom resolver configurations, earlier 0.4.x versions might have exhibited unexpected behavior related to how resolvers were handled during schema traversal and dereferencing.","severity":"breaking","affected_versions":"0.4.0 - 0.4.4"},{"fix":"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.","message":"The library relies on the `referencing` library for JSON Schema reference resolution. While `jsonschema-path` manages its dependency, ensure compatibility if you manually manage `referencing` or rely on specific resolution behaviors across different `jsonschema-path` versions.","severity":"gotcha","affected_versions":"0.4.1+"}],"env_vars":null,"search_vec":"'0.4.5':54 'access':25 'accessor':47 'activ':56 'bug':65 'cadenc':62 'current':51 'definit':27 'demand':42 'dereferenc':43 'enhanc':29,69 'featur':68 'fix':66 'focus':63 'handl':32 'json':30,74 'json-schema':73 'jsonschema':1,9,26,70 'jsonschema-path':8 'layer':48 'librari':14 'like':37 'maintain':57 'navig':38 'object':5,19 'object-ori':4,18 'offer':34 'on-demand':40 'orient':6,20 'path':7,10,36,76 'path-lik':35 'provid':16 'python':13 'regular':60 'releas':61 'schema':31,75,79 'schema-travers':78 'separ':46 'spec':2,72 'swagger':71 'travers':23,80 'valid':77 'version':53 'way':21","created_at":"2026-03-28T15:17:19.728896+00:00","updated_at":"2026-04-16T15:57:27.365767+00:00","problems":[{"fix":"Downgrade the `jsonschema` package to a version less than 4.0. For example: `pip install 'jsonschema<4.0'`","cause":"This error occurs when the `jsonschema-path` library (or a library that depends on `jsonschema`) attempts to import `jsonschema.compat`, but the installed `jsonschema` version is 4.0 or higher, where the `compat` module was removed due to API changes.","error":"ModuleNotFoundError: No module named 'jsonschema.compat'"},{"fix":"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.","cause":"This typically happens when you try to access data using dictionary-like `.get()` method on a Python list object. In the context of JSON Schema, this means your schema path traversal or data access resulted in a JSON array (Python list), but you expected a JSON object (Python dictionary).","error":"AttributeError: 'list' object has no attribute 'get'"},{"fix":"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.","cause":"This error indicates that `jsonschema-path` (or its underlying `jsonschema` dependency during dereferencing) failed to locate or resolve a `$ref` within your JSON Schema. This could be due to an incorrect path in the `$ref` itself, a missing schema file, or an improperly configured base URI for resolution.","error":"jsonschema.exceptions.RefResolutionError: Unresolvable JSON pointer:"},{"fix":"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.","cause":"The core `jsonschema` library, which `jsonschema-path` depends on, is not installed in your current Python environment or is not available in the Python path.","error":"ModuleNotFoundError: No module named 'jsonschema'"}],"ecosystem":"pypi","meta_description":null,"install_score":100,"quickstart_score":70,"quickstart_tag":"verified","pypi_latest":"0.5.0","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/p1c2u/jsonschema-path","docs":null,"changelog":null,"pypi":"https://pypi.org/project/jsonschema-path/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["serialization"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-06-28","next_check":"2026-07-28","install_tag":"verified"}}