contractdiff
Breaking-change diff, lint and code generation for API contracts (OpenAPI, JSON Schema, AsyncAPI, MCP), and the spec back from the code. No dependency outside the burgee family. An openapi-typescript migration path.
Read the docs
npm install contractdiffStart here
Learn contractdiff in this order
- Getting startedInstall contractdiff, diff two versions of a small OpenAPI contract and read the verdict, then generate TypeScript types and truefit validators from it and call one.
- Why contractdiffWhat contractdiff does that oasdiff, Optic and openapi-typescript do not: one model for HTTP, events and agent tools, a stated compatibility question, decisions read from the contract, code generation that knows its own files, and what it leaves out on purpose.
- API referenceEvery export of contractdiff, with its signature and doc comment: program, VERSION, configSchema, extract, gen, MAP_FILE, plus 8 types.
Migrate
Coming from another package
Each guide maps the package you use today onto this one, call by call, and says what is different on purpose.
- Coming from oasdiffMove a breaking-change check from oasdiff to contractdiff diff: the same rule ids for HTTP changes, a compatibility question you choose instead of a fixed one, AsyncAPI, JSON Schema and MCP on the same engine, and what oasdiff has that contractdiff does not.
- Coming from openapi-typescriptMove from openapi-typescript to contractdiff's types target: contractdiff migrate openapi-typescript turns your script flags and redocly.yaml into a config, contractdiff/openapi-typescript keeps the openapiTS call, and this page says which cases are not covered yet.
- Coming from OpticMove from Optic's diff, lint and changelog to contractdiff: diff for breaking changes, lint with forwards-only adoption through --since, the changelog as diff output, and what Optic did that contractdiff does not, such as capturing traffic into a spec.
The family
Part of burgee
contractdiff is one of the burgee packages. These pages cover all of them.