skillfed

jsonschema-spec

JSONSchema Spec with object-oriented paths

jsonschema-spec v0.2.4 924.8K downloads/30d#4,711 on PyPI10
Permissive license Apache-2.0 Active released

What it is and what it does

jsonschema-spec wraps JSONSchema documents in an object-oriented path interface, letting you navigate nested schema structures using forward-slash syntax while automatically resolving $ref pointers to local or remote definitions. Instead of manually parsing dictionaries and tracking reference paths, you construct a SchemaPath from a schema dict and then traverse it like a filesystem—checking key membership, concatenating paths, and opening dereferenced content on demand. The package handles both internal references (like #/$defs/Info) and external URLs, delegating actual HTTP fetches to requests and reference resolution to the referencing library.

This is most useful when you need to inspect or validate schema structure programmatically—for example, walking a schema to extract all property definitions, following $ref chains to understand the full shape of a nested object, or building tools that reason about schema metadata. It sits between raw dict manipulation and full schema validation, offering a cleaner API for schema introspection without enforcing validation rules.

Use it for:

  • Extract all properties from a JSONSchema by traversing the schema tree and following $ref pointers automatically
  • Build API documentation tools that need to walk OpenAPI or JSONSchema specs and resolve references
  • Validate that a schema structure is well-formed by checking key existence and dereferencing paths
  • Generate code or type definitions from a schema by navigating its structure and collecting metadata

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Provides an object-oriented interface to traverse and dereference JSONSchema documents, treating them as navigable paths with automatic resolution of $ref pointers.

Yes, if you need to programmatically inspect or traverse JSONSchema documents with automatic reference resolution. The low install friction, active maintenance, permissive license, and zero known vulnerabilities make it a safe choice. Not necessary if you only validate data against schemas or parse schemas as raw dicts.

Install

jsonschema-spec on PyPI

pip

pip install jsonschema-spec

uv

uv add jsonschema-spec

poetry

poetry add jsonschema-spec

Installing jsonschema-spec

Before you install

Low friction installation with four straightforward runtime dependencies (pathable, PyYAML, requests, referencing). Actively maintained with recent commits; last release was over a year ago but the repository remains active.

License in practice

Apache-2.0 permissive license allows commercial and private use with minimal restrictions; you must retain copyright and license notices in distributions.

Quickstart

from jsonschema_spec import SchemaPath

schema = {
    "properties": {"info": {"$ref": "#/$defs/Info"}},
    "$defs": {"Info": {"properties": {"title": {"type": "string"}}}}
}

path = SchemaPath.from_dict(schema)
info_path = path / "properties" / "info"
with info_path.open() as contents:
    print(contents)

Verify before relying

  • Whether the package handles circular $ref chains or other edge cases in schema dereferencing
  • Performance characteristics when working with very large or deeply nested schemas
  • Whether remote schema fetching via requests is cached or requires manual optimization

Package facts

License Apache-2.0 (permissive)
Python support supports the current Python release (>=3.8.0,<4.0.0)
Install friction low — pure-Python wheel
Runtime dependencies 4 — pathable, PyYAML, requests, referencing
Maintenance actively maintained — 1,094 days since the last release
Last repo commit
First released
Downloads 924,766/month — #4,711 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: jsonschema_spec-0.2.4-py3-none-any.whl

Keywords: jsonschema, swagger, spec

Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software Development :: LibrariesTopic :: Software Development :: Libraries :: Python Modules

Tags

jsonschema path traversalschema reference dereferencingobject-oriented json schemanavigate json schema documentsresolve schema references
schema-navigationopenapi-tooling

More Libraries packages