oasdiff can spot your broken API and still leave CI green
To turn the job red before the client calls, you have to choose the failure threshold yourself and write a tight enough spec.
In brief
- The oasdiff GitHub Action leaves fail-on empty by default, so the job never fails until you configure it.
- Narrowing a request is breaking, and so is widening a response; narrowing a response is not.
- oasdiff sees only what the spec describes, so you still need behavioral tests against the real system.
Add the oasdiff GitHub Action to a pull request, leave the configuration alone, and the job will never fail. The fail-on input is empty by default: the tool can find a breaking change while the check on the pull request stays green.
That default is easy to miss, especially when you are rushing to set up CI in your first week at a client. For an FDE the cost is concrete. The client’s team has already written code against the API you delivered, and you usually cannot change that code.
oasdiff automatically catches the changes that show up in the spec. The command-line tool, licensed under Apache-2.0, compares two OpenAPI specifications and points out breaking changes. It supports OpenAPI 3.0, 3.1 and 3.2, so check which version the client’s spec uses before you install it.
Widening means different things for requests and responses
oasdiff’s documentation judges changes from the consumer’s side: a change is breaking if a party that honored the old contract could stop working under the new one. Requests and responses therefore follow opposite rules, which are easy to remember backward.
Narrowing a request is breaking, because a call that used to be valid may now be rejected. Responses work the other way around: widening is what breaks, because the API may return something the client was never written to handle. Narrowing a response is not considered breaking.
Take a hypothetical delivery company’s order API. You change two things in one pull request: the phone field goes from optional to required when an order is created, and status gains the value partially_returned when an order is read.
The first is easy to spot, because an old app that does not send phone will be rejected. The second looks like a harmless feature, but client code with branches only for the old statuses will meet a value it does not recognize. In review, ask two questions of each field. Can the old client still send what it sent before? Can it read everything the API is about to return?
One command before you open the pull request
There is no need to download the old spec and compare by hand. oasdiff loads a spec straight from a git revision with the <ref>:<path> syntax. Install the tool by following the instructions in the github.com/oasdiff/oasdiff repo, then run:
git fetch origin main
oasdiff breaking origin/main:openapi.yaml openapi.yaml --fail-on ERR
echo $?
The first argument is the contract on the main branch; the second is the file you are editing. The git fetch line earns its place, because by default oasdiff reads only the local object store and does not modify the repo. If your local origin/main is a week old, you are comparing against last week’s contract. A --fetch flag exists, but you have to turn it on.
oasdiff sorts its findings into three levels. ERR is definitely breaking, WARN cannot be confirmed from the spec alone, and INFO is non-breaking. If there is at least one ERR-level finding, --fail-on ERR makes the command exit with code 1, which is enough for CI to go red.
Under the rules above, the phone change narrows a request and the status change widens a response. Both fall on the breaking side, but the general rule does not tell you whether status will be marked ERR or WARN. Let your installed version of oasdiff answer: move status to its own branch, because the phone error could mask the result, then run the command twice.
oasdiff breaking origin/main:openapi.yaml openapi.yaml --fail-on ERR; echo $?
oasdiff breaking origin/main:openapi.yaml openapi.yaml --fail-on WARN; echo $?
If status is the only change, the two exit codes are simple to read. A 1 followed by a 1 means ERR. A 0 followed by a 1 means WARN, and a gate set only to ERR would let it through. If both are 0, neither threshold stops the change and you have to review it yourself.
The threshold is a decision to make with the client
The documentation page currently counts 792 types of change: 363 breaking, 23 warnings and 406 informational. The numbers vary by version. They show how broad the rule set is, but the choice of threshold should depend on who can fix the client.
If the client’s team writes its own client, you do not know how their code handles an unfamiliar value. In that case --fail-on WARN, which stops on both errors and warnings, is the cautious choice: whether status is rated ERR or WARN, the pull request stops in time for you to ask. If you control both ends, --fail-on ERR is a reasonable starting point.
| Situation | Threshold to try | What to do alongside it |
|---|---|---|
| You do not yet know how clean the spec is | Leave empty for a few days | Read the results and set a date to start blocking |
| You can change both client and server | ERR | Release the client at the same time |
| The client’s team writes its own client | WARN | Ask the client about each warning |
Sometimes you will break the contract on purpose. The --err-ignore and --warn-ignore flags let you accept those changes. Record the reason, and the name of the person on the client side who agreed, in the pull request itself, so that nobody has to guess six months later.
On GitHub, the oasdiff/oasdiff-action/breaking@v0 action runs on pull requests, and the free version needs no account or token. The snippet below is only a skeleton and will not run if copied as is: it lacks the checkout step and the inputs pointing to the two specs. Take both from the action’s README, then add the fail-on line.
# Illustrative skeleton, not runnable yet: the two parts noted below are missing
on: pull_request
jobs:
api-contract:
runs-on: ubuntu-latest
steps:
# MISSING: checkout step, take it from the action's README
- uses: oasdiff/oasdiff-action/breaking@v0
with:
# MISSING: inputs pointing to the two specs, take them from the action's README
fail-on: ERR
The last line separates a job that merely reports from one that can go red. Once the workflow is complete, deliberately push the phone change to a test branch. Only when you see the job turn red do you know the gate works.
To remove an endpoint, set a date
APIs at client sites rarely stand still, so banning every breaking change is not realistic. oasdiff supports a way out: once marked deprecated, a resource can be removed from its sunset date onward without being reported as a breaking change. Moving the sunset date earlier does count as breaking.
This rule turns a retirement schedule into a promise that CI can check. You can also set separate grace periods for stable and beta APIs. First ask the client how long it takes them to release a new version of their client, then use the answer to choose the date.
What the spec omits, oasdiff cannot see
The documentation itself acknowledges the biggest limitation: a behavior change that the OpenAPI definition does not describe is invisible to every specification-based tool. Suppose the order API changes its delivery fee from excluding tax to including it, while the spec records only a numeric field. The two specs are identical, and the client’s invoices are wrong.
So the first task on taking over an API is to check the spec against a few real responses. If the spec was written by hand and then neglected, fix it before you turn on blocking. Semantics such as units, ordering or update timing need separate behavioral tests.
Watch the version too. The release notes for v1.41.0, published on November 25, 2026, describe a security fix for anyone running breaking or changelog with --open on a spec they do not control.
FDEs often receive specs from other people, so upgrade before opening a client’s file. Older documentation still places the repo under the Tufin organization; do not copy commands from it without checking them.
Learn the rules first, the flags second
Start with oasdiff’s Breaking Changes page and read until you can predict the result of a diff before running the command. Then move on to git revisions, --fail-on and the deprecation process. Syntax takes a minute to look up; the habit of asking what will happen to the old client comes only with practice.
A small repo with three pull requests makes a manageable exercise: one that is blocked, one that is accepted with a stated reason, and one that removes an endpoint after its sunset date.
That repo is also evidence to show when an FDE job posting mentions “API integration”, “backward compatibility” or “versioning”. On your resume, describe the kind of change you blocked and what you agreed with the API’s callers before you name the tool.
The same applies at handover. Instead of showing the client only a green badge, show them the pull request that was blocked.
Was this article useful?
Thanks for the feedback!
9 sources
- oasdiff/oasdiff: OpenAPI Diff and Breaking Changes
- OpenAPI Diff Prevents API Breakages (Nikos Vaggalis) · 2023-07-25
- oasdiff docs: Breaking Changes
- oasdiff/docs/BREAKING-CHANGES.md
- oasdiff/docs/GIT-REVISION.md
- oasdiff/oasdiff-action
- oasdiff/docs/DEPRECATION.md
- oasdiff — API Change Review: approve breaking changes before production
- GitHub REST API: oasdiff latest release · 2026-11-25