Cette page est affichée en anglais. Une traduction française est en cours.
CLI ToolsMay 12, 2026·2 min de lecture

oasdiff — OpenAPI Breaking-Change Diff CLI

oasdiff compares two OpenAPI specs and flags breaking changes with CI-friendly exit codes, so API refactors don’t silently ship incompatible contracts.

Prêt pour agents

Cet actif peut être lu et installé directement par les agents

TokRepo expose une commande CLI universelle, un contrat d'installation, le metadata JSON, un plan selon l'adaptateur et le contenu raw pour aider les agents à juger l'adaptation, le risque et les prochaines actions.

Stage only · 17/100Stage only
Surface agent
Tout agent MCP/CLI
Type
CLI Tool
Installation
Stage only
Confiance
Confiance : Established
Point d'entrée
Asset
Commande CLI universelle
npx tokrepo install ad3d0523-cda7-4257-9bdb-023370d39c5a
Introduction

oasdiff compares two OpenAPI specs and flags breaking changes with CI-friendly exit codes, so API refactors don’t silently ship incompatible contracts.

  • Best for: API teams that publish OpenAPI, and platform teams enforcing contract safety in CI
  • Works with: OpenAPI YAML/JSON files, local files or URLs, CI pipelines (exit codes)
  • Setup time: 5–15 minutes

Practical Notes

  • Use breaking as a hard gate; use changelog to help reviewers.
  • CI tip: store previous spec as an artifact and compare on PR.

CI gate: block incompatible API changes

The common failure mode is “a schema field got renamed and nobody noticed”. Make it explicit by comparing base vs revision on every PR:

oasdiff breaking openapi.base.yaml openapi.pr.yaml

If breaking changes exist, the command exits non-zero, which is ideal for CI.

Reviewer UX: attach a human-friendly changelog

In addition to failing CI, provide a readable summary:

oasdiff changelog openapi.base.yaml openapi.pr.yaml > oasdiff.changelog.txt

Paste the key lines into the PR description (or post via a bot).

Practical tips

  • Normalize specs first (same bundling/flattening strategy) to reduce false diffs.
  • Keep specs in-repo so agents and CI can diff deterministically.
  • If your spec comes from codegen, pin the generator version and compare the generated output.

FAQ

Q: Does it only detect breaking changes? A: No. It can also output full diffs and changelogs; breaking is the strict subset for gates.

Q: Can I compare URLs instead of files? A: Yes—oasdiff supports various inputs; keep CI inputs stable for deterministic results.

Q: How do I reduce noisy diffs? A: Ensure both specs are normalized the same way (flattening, ordering, bundling).

🙏

Source et remerciements

Source: https://github.com/oasdiff/oasdiff > License: Apache-2.0 > GitHub stars: 1,193 · forks: 95

Fil de discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires