{"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,"last_verified":"2026-05-12T14:38:52.962Z","next_check":"2026-06-26T00:00:00.000Z","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,"install_tag":"verified","quickstart_score":70,"quickstart_tag":"verified","pypi_latest":null,"install_checks":{"last_tested":"2026-05-12","tag":"verified","tag_description":"installs cleanly on critical runtimes, fast import, recently tested","results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.48,"mem_mb":7.6,"disk_size":"22.8M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.3,"mem_mb":7.6,"disk_size":"24M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.73,"mem_mb":8.2,"disk_size":"25.1M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.69,"mem_mb":8.2,"disk_size":"26M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.66,"mem_mb":8,"disk_size":"17.0M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.55,"mem_mb":8,"disk_size":"18M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.47,"mem_mb":7.9,"disk_size":"16.3M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.56,"mem_mb":7.9,"disk_size":"17M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":1.36,"mem_mb":12.4,"disk_size":"25.4M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.93,"mem_mb":12.4,"disk_size":"26M"}]},"quickstart_checks":{"last_tested":"2026-04-23","tag":"verified","tag_description":"quickstart runs on critical runtimes, recently tested","results":[{"runtime":"python:3.10-alpine","exit_code":0},{"runtime":"python:3.10-slim","exit_code":0},{"runtime":"python:3.11-alpine","exit_code":0},{"runtime":"python:3.11-slim","exit_code":0},{"runtime":"python:3.12-alpine","exit_code":0},{"runtime":"python:3.12-slim","exit_code":0},{"runtime":"python:3.13-alpine","exit_code":0},{"runtime":"python:3.13-slim","exit_code":0},{"runtime":"python:3.9-alpine","exit_code":1},{"runtime":"python:3.9-slim","exit_code":1}]}}