@apivexa/diff
v0.1.4
Published
> Compare two OpenAPI specs and detect breaking changes with documentation impact analysis.
Readme
@apivexa/diff
Compare two OpenAPI specs and detect breaking changes with documentation impact analysis.
Part of ApiVexa — AI-powered API User Guide Generator.
Install
npm install @apivexa/diffWhat it detects
| Change type | Breaking? | |-------------|-----------| | Removed operation | Yes | | Added required parameter | Yes | | Removed required parameter | Yes | | Removed response status code | Yes | | Removed auth scheme | Yes | | Added operation | No | | Added optional parameter | No | | Required → optional parameter | No |
Usage
import { compareApis } from '@apivexa/diff';
const diff = await compareApis(
{ type: 'file', path: './openapi-v1.yaml' },
{ type: 'file', path: './openapi-v2.yaml' },
);
console.log(diff.hasBreakingChanges); // true | false
console.log(diff.breakingChanges); // [{ type: 'OPERATION_REMOVED', ... }]
console.log(diff.summary);
// { added: 3, removed: 1, modified: 2, breaking: 1 }
console.log(diff.documentationImpact);
// ['API Reference', 'Getting Started', 'Common Workflows']