Contract Watch is a tiny TypeScript CLI that compares two OpenAPI JSON contracts and reports breaking API changes before they surprise clients.
It is designed for pull requests, release checks, and backend teams that want a fast contract-safety signal without wiring up a full API gateway.
- Removed paths
- Removed HTTP methods
- Removed response status codes
- Newly required request fields
- Changed response media types
npm install
npm run build
npm run dev -- examples/base.openapi.json examples/next.openapi.jsonExample output:
Contract Watch found 3 breaking changes
[high] GET /users/{id}
Removed response status 200.
[critical] POST /users
Request field "email" became required.
contract-watch BASE_SPEC NEXT_SPEC [--json]During local development:
npm run dev -- BASE_SPEC NEXT_SPECJSON output is useful in CI:
npm run dev -- examples/base.openapi.json examples/next.openapi.json --jsonnpm run dev -- openapi/main.json openapi/pr.jsonThe command exits with:
0when no breaking changes are detected1when breaking changes are found2for invalid input or CLI usage errors
npm install
npm run checkAPI compatibility is a practical engineering problem: small backend changes can break mobile apps, dashboards, integrations, and partner systems. Contract Watch shows how to turn that risk into an automated, explainable check.
MIT