driftmap-cli
v0.1.1
Published
Detect API drift by comparing live API samples against an inferred or OpenAPI contract. See the full docs at the repo homepage.
Maintainers
Readme
driftmap-cli
Command-line tool that detects API drift by comparing two JSON payloads (or OpenAPI 3.0 documents) inferred against each other as contracts. It is the CLI's presentation of the DriftMap engine; the full documentation lives in the repo: https://github.com/nwjud54833/drift-map.
The name
driftmapon npm belongs to an unrelated project. Install and rundriftmap-cli.
Install
Requires Node.js 20 or newer.
npx driftmap-cli compare baseline.json candidate.jsonor add it to a project:
npm install --save-dev driftmap-cliQuick start
npx driftmap-cli compare order_v1.json order_v2.json
npx driftmap-cli compare --fail-on warning openapi-a.json samples.json
npx driftmap-cli compare --format json order_v1.json order_v2.json > diff.jsonDetect breaking changes between two payload snapshots or OpenAPI 3.0 (JSON or YAML) specs. Compare result as text, JSON, or Markdown.
Flags
--directionrequest|response|event— which side the payloads describe--fail-onbreaking|warning|off— threshold for the exit code (defaultbreaking)--formattext|json|markdown— output format (defaulttext)--out— write the report to a file instead of stdout--quiet— print only the verdict line (for scripts)--verbose— include rawRULE_*identifiers and sample counts--colorauto|always|never— ANSI colors;autoenables them only on a TTY.--quietstays plain even under--color=always.
Exit codes
0— no findings at or above the threshold (pass)1— findings at or above the threshold (fail)2— usage or input error (missing file, unparseable JSON, unsupported OpenAPI 3.1, oversize input)
Repository
Documentation and source: https://github.com/nwjud54833/drift-map. Reporting issues: https://github.com/nwjud54833/drift-map/issues
