Skip to content

oasdiff/oasdiff

Repository files navigation

CI codecov Go Report Card GoDoc Docker Image Version

oasdiff banner

Command-line and Go package to compare and detect breaking changes in OpenAPI specs.

Run it locally, in CI via the GitHub Action, or use the hosted PR review workflow at oasdiff.com to approve or reject each change with a CI commit status.

Get started in 30 seconds

No install needed — try it with Docker against two sample specs:

docker run --rm -t tufin/oasdiff changelog \
  https://raw.githubusercontent.com/oasdiff/oasdiff/main/data/openapi-test1.yaml \
  https://raw.githubusercontent.com/oasdiff/oasdiff/main/data/openapi-test5.yaml

That prints a human-readable changelog of every significant change between the two specs. Swap changelog for breaking to see only breaking changes, or diff for the full machine-readable diff.

Installation

Install with Go

go install github.com/oasdiff/oasdiff@latest

Install on macOS with Brew

brew install oasdiff

Install on macOS and Linux using curl

The install.sh script downloads the latest oasdiff binary into /usr/local/bin:

curl -fsSL https://raw.githubusercontent.com/oasdiff/oasdiff/main/install.sh | sh

To pin a specific version, set the version env var:

curl -fsSL https://raw.githubusercontent.com/oasdiff/oasdiff/main/install.sh | version=1.11.7 sh

Install with asdf

https://github.com/oasdiff/asdf-oasdiff

Download a binary

Pre-built binaries for macOS, Linux, and Windows (both x86_64 and arm64) are on the releases page.

Documentation

Grouped by what you're trying to do. New to oasdiff? Start with Commands.

Commands

The six top-level subcommands.

  • diff — full diff between two OpenAPI specs (output: html, json, markdown, markup, text, or yaml — default yaml)
  • summary — high-level count of changes between two specs (built on the diff engine; same shared options)
  • breaking — only breaking changes
  • changelog — every significant change, breaking or not, in human-readable form
  • flatten — replace allOf schemas with a merged equivalent
  • checks — list the rules oasdiff uses to classify changes (customize them)

Inputs

Where specs come from.

  • Git revisions — compare against a branch, tag, or commit
  • Local files, http/s URLs, YAML or JSON — all handled transparently

Comparison

How oasdiff pairs up base and revision and what counts as a difference.

Normalization

Align each spec before diffing so equivalent things line up.

API lifecycle

Communicate intent across versions.

Filtering changes

Choose which kinds of differences are reported.

Output

Shape and enrich the report.

How to run

Reference

Demo

Credits

This project relies on the excellent implementation of OpenAPI 3.0 and 3.1 for Go: kin-openapi.

Feedback

We welcome your feedback.
If you have ideas for improvement or additional needs around APIs, please let us know.