Skip to main content

jsonschema-changelog

CI Coverage PyPI version Python versions License: MIT

Detect, document, and manage changes between JSON Schema versions.

Part of the Búho Zurdo ecosystem 🦉


Overview

jsonschema-changelog provides deterministic semantic comparison, classification, and changelog generation for JSON Schema specifications.

  • Detect differences between schema revisions (properties, types, constraints, enums, conditional subschemas if/then/else, dependentRequired, and dynamic keywords like unevaluatedProperties).
  • Classify changes by operational impact (breaking, non-breaking, deprecations).
  • Generate human-readable and machine-parseable changelogs (Markdown, JSON, HTML).
  • Validate backward and forward schema compatibility in CI/CD pipelines.
  • Generate deterministic data migration scripts.

Designed for data governance in schema-driven architectures, APIs, and clinical/laboratory management systems (LIMS).


Installation

pip install jsonschema-changelog

For development:

git clone https://github.com/buhozurdo/jsonschema-changelog.git
cd jsonschema-changelog
pip install -e ".[dev]"

Quick Start

Python API

from jsonschema_changelog import SchemaDiff, ChangeClassifier, ChangelogGenerator

old_schema = {
    "type": "object",
    "properties": {
        "name": {"type": "string"},
        "status": {"type": "string", "enum": ["active", "inactive"]}
    },
    "required": ["name"]
}

new_schema = {
    "type": "object",
    "properties": {
        "name": {"type": "string"},
        "status": {"type": "string", "enum": ["active", "inactive", "pending"]},
        "email": {"type": "string", "format": "email"}
    },
    "required": ["name"]
}

# 1. Detect differences
differ = SchemaDiff(old_version="1.0.0", new_version="2.0.0")
diff_result = differ.compare(old_schema, new_schema)

# 2. Classify impact
classifier = ChangeClassifier()
classification = classifier.classify(diff_result)

print(f"Breaking: {len(classification.breaking_changes)}")
print(f"Non-breaking: {len(classification.non_breaking_changes)}")
print(f"Compatible: {classification.is_compatible}")

# 3. Generate changelog
generator = ChangelogGenerator(title="API Schema Changelog")
changelog = generator.generate(classification)
markdown = generator.to_markdown(changelog)
print(markdown)

Command Line Interface

# Compare schemas
jsonschema-changelog diff old.json new.json

# Generate changelog
jsonschema-changelog changelog old.json new.json --format markdown -o CHANGELOG.md

# Validate compatibility (fails with exit code 1 on breaking changes)
jsonschema-changelog validate old.json new.json --fail-on-breaking

# Generate data migration script
jsonschema-changelog migrate old.json new.json --language python -o migrate.py

# Inspect schema details
jsonschema-changelog info schema.json

Change Classification Matrix

Impact Description Examples
🚨 Breaking Incompatible contract change Property removed, field made required, enum value removed, constraint narrowed (minimum increased).
✨ Non-Breaking Backward-compatible addition Optional property added, required field made optional, enum value added, constraint relaxed.
⚠️ Deprecation Marked for future removal Field annotated with deprecated: true or notice in description.
📝 Documentation Metadata update Changes to title, description, or examples without structural impact.

CI/CD Integration

GitHub Actions (Fail PR on Breaking Changes)

name: Schema Compatibility Check

on:
  pull_request:
    paths:
      - 'schemas/**'

jobs:
  validate:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - uses: actions/setup-python@v5
        with:
          python-version: '3.11'

      - run: pip install jsonschema-changelog

      - name: Validate schema compatibility
        run: |
          jsonschema-changelog validate \
            schemas/current.json \
            schemas/proposed.json \
            --fail-on-breaking

      - name: Generate changelog
        if: always()
        run: |
          jsonschema-changelog changelog \
            schemas/current.json \
            schemas/proposed.json \
            --format markdown \
            -o SCHEMA_CHANGELOG.md

      - uses: actions/upload-artifact@v4
        with:
          name: schema-changelog
          path: SCHEMA_CHANGELOG.md

Pre-commit Hook

repos:
  - repo: local
    hooks:
      - id: schema-compatibility
        name: Validate Schema Compatibility
        entry: jsonschema-changelog validate
        language: python
        files: \.json$
        args: ['schemas/current.json', 'schemas/proposed.json', '--fail-on-breaking']

Alternatives & Competitors

Solution Core Approach Best Use Case Comparison to jsonschema-changelog
jsonschema-changelog Semantic Diff & Changelogs Data Governance, CI/CD, Raw Schemas (Baseline) Lightweight, OpenAPI-agnostic, generates human-readable changelogs/migrations, and robustly handles Draft 2020-12.
jsonschema-diff Semantic JSON Diff Simple schema type checks Pros: Minimalist approach to diffing.
Cons: Lacks changelog/migration generation and robust support for modern dynamic keywords.
oasdiff OpenAPI Contract Review HTTP REST APIs Pros: Deeply integrated with OpenAPI semantics (paths, endpoints).
Cons: Tied to OpenAPI; unsuitable for raw JSON Schemas (e.g. Kafka, NoSQL, LIMS).
Optic Managed API Evolution Enterprise API Platforms Pros: Powerful GUI, history tracking, and platform features.
Cons: Heavy, commercial vendor lock-in, overkill for agile CI pipelines.
Schema.biz Breaking Change Detector SemVer API Lifecycle Pros: Excellent alignment with Semantic Versioning guarantees.
Cons: Platform-oriented, less flexible than a fully local open-source Python library.

Known Limitations

  • Recursive Schemas: Self-referential $ref definitions beyond 10 levels of nesting are truncated to avoid recursion exhaustion.
  • Draft 2020-12 & OpenAPI 3.1 Support: The library provides broad support for modern JSON Schema keywords (including unevaluatedProperties, unevaluatedItems, dependentRequired, and if/then/else). However, highly complex dynamic cross-references or niche schema compositions might still fall back to structural diffs.

Testing

# Run test suite
pytest

# Run tests with coverage
pytest --cov=src/jsonschema_changelog --cov-report=term-missing

Roadmap

Curious about what's next? Check out our ROADMAP.md for upcoming features like automated SemVer suggestions, Git history tracking, and interactive UIs.


Contributing

Contributions are welcome. Please read CONTRIBUTING.md and adhere to Búho Zurdo Engineering Standards.

  1. Fork repository.
  2. Create feature branch (git checkout -b feat/schema-feature).
  3. Add tests and verify formatting.
  4. Open Pull Request.

License

MIT License. See LICENSE for details.

Metadata

Release files for jsonschema-changelog 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jsonschema-changelog 0.2.1
File Size Uploaded Provenance Actions
jsonschema_changelog-0.2.1.tar.gz 41.5 kB With provenance Details for jsonschema_changelog-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for jsonschema-changelog 0.2.1
File Interpreter ABI Platform Actions
jsonschema_changelog-0.2.1-py3-none-any.whl Python 3 none any Details for jsonschema_changelog-0.2.1-py3-none-any.whl

Total release size: 47.2 kB

Release files / jsonschema_changelog-0.2.1.tar.gz

Download URL jsonschema_changelog-0.2.1.tar.gz
Size 41.5 kB
Tags Source
SHA-256 checksum
How to use checksums
d9a879026de66b9c727252c7ea5093ad652b0036fd87990bfd8b52eadc8f5a6f
BLAKE2b-256 checksum
How to use checksums
9bb4b5165b8aee79a393cea05c6cbc9c8b7475cdcfe923003bd420e420fc4896
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.

Transparency log

Release files / jsonschema_changelog-0.2.1-py3-none-any.whl

Download URL jsonschema_changelog-0.2.1-py3-none-any.whl
Size 5.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
673a4ef39e9ff2895e4c6d8b0460fccbbb1c1e9dcf7351662bee3bfdb0b995aa
BLAKE2b-256 checksum
How to use checksums
43074f4109a5a327a69007aa0e9c1a6300d8206648c4f349b91cc47a78fa28ad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.

Transparency log

Security for jsonschema-changelog 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for jsonschema_changelog-0.2.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page