Skip to main content

Detect breaking API changes between OpenAPI schemas

Project description

SchemaWatch

Detect breaking API changes before they reach production. Works with any OpenAPI file — just run one command.

PyPI CI Python License Stars


🎬 Demo

SchemaWatch Demo

python -m schemawatch.cli examples/old.yaml examples/new.yaml

🚀 What is SchemaWatch?

SchemaWatch compares two OpenAPI schemas and detects breaking API changes automatically.

It is designed to be:

  • ⚡ Simple
  • ⚡ Fast
  • ⚡ CI/CD friendly

🚀 Features

SchemaWatch detects:

  • Removed endpoints
  • Removed HTTP methods
  • Removed schemas
  • Removed response fields
  • Field type changes
  • Fields that became required
  • Enum value changes
  • Array item type changes
  • $ref resolution for components.schemas and request/response bodies

📦 Installation

pip install schemawatch

⚙️ Usage

# Basic usage
python -m schemawatch.cli examples/old.yaml examples/new.yaml

# JSON output
python -m schemawatch.cli examples/old.yaml examples/new.yaml --format json

# Markdown output
python -m schemawatch.cli examples/old.yaml examples/new.yaml --format markdown

# Save to file
python -m schemawatch.cli examples/old.yaml examples/new.yaml --format json --output result.json

# Quiet mode (CI use)
python -m schemawatch.cli examples/old.yaml examples/new.yaml --quiet

🧑‍💻 Real-world usage

python -m schemawatch.cli openapi_old.yaml openapi.yaml
python -m schemawatch.cli api/v1/openapi.yaml api/v2/openapi.yaml

🧪 Example Output

====================================
🚨 SchemaWatch Report
====================================

Breaking changes detected: 5

── CRITICAL (2)
🔴 Endpoint removed: /orders
🔴 Method removed: GET /users

── WARNING (3)
🟡 Response field removed: User.email
🟡 Field type changed: User.id integer -> string
🟡 Field became required: User.id

------------------------------------
Summary:
- Total changes: 5
- Critical: 2
- Warning:  3
- Info:     0
------------------------------------

🔁 CI/CD Integration

SchemaWatch is designed to run in CI pipelines.

python -m schemawatch.cli openapi_old.yaml openapi.yaml
  • Exit code 1 → breaking changes detected ❌
  • Exit code 0 → no breaking changes ✅

⚙️ GitHub Actions Example

- name: Check API breaking changes
  run: python -m schemawatch.cli openapi_old.yaml openapi.yaml

💬 PR Comment Integration

Automatically comments on pull requests:

⚠ Breaking API changes detected:

🔴 Endpoint removed: /orders
🟡 Field type changed: User.id integer -> string

🤔 Why not oasdiff / openapi-diff?

Feature SchemaWatch oasdiff / openapi-diff
Easy CLI ✅ Very simple ⚠️ More complex
CI/CD friendly ✅ Built-in mindset ⚠️ Needs config
PR comments ✅ Yes ❌ Not built-in
Severity levels ✅ Critical/Warning/Info ❌ Not built-in
Output ✅ Clean & readable ⚠️ Verbose
Setup time ⚡ 10 seconds ⏱️ Longer

SchemaWatch = quick setup + practical usage


🛠 Roadmap

  • Request body change detection
  • Response status code comparison
  • $ref resolution (#/components/... internal pointers)
  • Nested object comparison improvements (allOf / oneOf, external file refs)
  • Markdown output (--format markdown)
  • HTML output
  • Web dashboard

🤖 AI-Powered Explanations (Experimental)

SchemaWatch can use Gemma 4 to explain breaking changes in plain English.

python gemma_explainer.py

Requires a Google AI Studio API key:

  1. Get your free API key from Google AI Studio
  2. Create a .env file: GEMINI_API_KEY=your_key_here
  3. Run: python gemma_explainer.py

🤝 Contributing

Contributions are welcome!

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Open a pull request

📄 License

This project is licensed under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

schemawatch-0.1.3.tar.gz (12.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

schemawatch-0.1.3-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file schemawatch-0.1.3.tar.gz.

File metadata

  • Download URL: schemawatch-0.1.3.tar.gz
  • Upload date:
  • Size: 12.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for schemawatch-0.1.3.tar.gz
Algorithm Hash digest
SHA256 793a6d79a0f9863da237a3b940f7caea544a080eb96225ea508036b0acb75ca6
MD5 b0c1dde4d8a4c40e5f3136549ec0882f
BLAKE2b-256 439eae7e6fd257396a6d4713247cc825c02d7f96c20a3e41d185c6dc9e778a7b

See more details on using hashes here.

Provenance

The following attestation bundles were made for schemawatch-0.1.3.tar.gz:

Publisher: publish.yml on CemCelik79/schemawatch

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file schemawatch-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: schemawatch-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for schemawatch-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 ee1e5577ead13c2d6d913705ae36aa397ddbaebe43f65efc54750b2d4947d970
MD5 fc0523e82ba5add1b0e5cfc3cbd9f93a
BLAKE2b-256 e9bc5739dea221cc7b296adfbedb813b0a3d6e8687e78ee98feb8a25bff9922e

See more details on using hashes here.

Provenance

The following attestation bundles were made for schemawatch-0.1.3-py3-none-any.whl:

Publisher: publish.yml on CemCelik79/schemawatch

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page