# Agent renamed an API field? oasdiff shows which clients break

> oasdiff compares two OpenAPI specs and fails CI when a change breaks existing clients.

Source: https://fullbytedeveloper.com/blog/oasdiff-api-breaking-change-detection
Keyword: APICHECK
Published here: 2026-11-10

An AI coding agent renamed an API field. The server accepted it, but every client using the old name failed. oasdiff catches this by comparing two OpenAPI specs and listing what breaks existing clients [1].

## Run a breaking change check

```bash
oasdiff breaking base.yaml revision.yaml
```

Exit code 0 means no breaking changes. Exit code 1 means at least one [2].

## Fail CI on breaking changes

Add `--fail-on ERR` to exit 1 on errors, or `--fail-on WARN` to include warnings [4]:

```bash
oasdiff breaking --fail-on ERR base.yaml revision.yaml
```

You should see either a clean exit or a list of breaking changes with their severity.

## Add it to GitHub Actions

The oasdiff action compares your PR branch against the base branch and posts inline annotations [3]:

```yaml
name: oasdiff
on:
  pull_request:
    branches: [main]
permissions:
  contents: read
  pull-requests: write
jobs:
  breaking-changes:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - run: git fetch --depth=1 origin ${{ github.base_ref }}
      - uses: oasdiff/oasdiff-action/breaking@v0
        with:
          base: 'origin/${{ github.base_ref }}:openapi.yaml'
          revision: 'HEAD:openapi.yaml'
          fail-on: WARN
          github-token: ${{ github.token }}
```

Replace `openapi.yaml` with your spec path.

## What oasdiff calls breaking

oasdiff checks what the contract declares, not what a server happens to accept. A required field is breaking even if your server has a default, because API gateways and generated SDKs enforce the spec [4]. Changes flagged as `ERR` are definite breaks. Changes flagged as `WARN` are potential breaks that cannot be confirmed without more context.

The full check list is in the oasdiff documentation [4]. For the plain definition of an API contract before you wire CI, see [what is an API](/blog/what-is-an-api).

Send this to the teammate whose agent renamed an API field and broke every client.

## Sources

1. [oasdiff GitHub repository](https://github.com/oasdiff/oasdiff/)
2. [oasdiff CLI quick start](https://www.oasdiff.com/docs/getting-started)
3. [oasdiff GitHub Action](https://www.oasdiff.com/docs/github-action)
4. [oasdiff breaking changes documentation](https://github.com/oasdiff/oasdiff/blob/main/docs/BREAKING-CHANGES.md)
