Esta página se muestra en inglés. Una traducción al español está en curso.
CLI ToolsMay 12, 2026·2 min de lectura

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.

Listo para agents

Este activo puede ser leído e instalado directamente por agents

TokRepo expone un comando CLI universal, contrato de instalación, metadata JSON, plan según adaptador y contenido raw para que los agents evalúen compatibilidad, riesgo y próximos pasos.

Stage only · 17/100Stage only
Superficie agent
Cualquier agent MCP/CLI
Tipo
CLI Tool
Instalación
Stage only
Confianza
Confianza: Established
Entrada
Asset
Comando CLI universal
npx tokrepo install ad3d0523-cda7-4257-9bdb-023370d39c5a
Introducción

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).

🙏

Fuente y agradecimientos

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

Discusión

Inicia sesión para unirte a la discusión.
Aún no hay comentarios. Sé el primero en compartir tus ideas.

Activos relacionados