response-header-became-nullable
Response-header-became-nullable-description.
Breaking change (level: error)
It makes part of the response optional or nullable, so a client that always expected it can break.
What this check detects
A response header becomes nullable when its schema starts allowing a null value. The server may now return null where it previously always returned a concrete value, so a client that assumed the header was never null can break.
Nullability is expressed with `nullable: true` in OpenAPI 3.0, or by adding `"null"` to the type array (for example `type: [string, "null"]`) in OpenAPI 3.1; oasdiff recognizes both.
Example
The server may now return a null X-Trace-Id, which a client that always expected a string value can break on.
How to handle this change
When oasdiff flags response-header-became-nullable, you have a few ways to respond:
- Find a backward-compatible alternative. Redesign the change so clients that followed the old contract keep working, and agree on the approach with whoever introduced it.
- Release it in a new API version. Keep the current contract and introduce the change in a new version, then deprecate the old one with a sunset date so clients have time to migrate.
- Accept it as a deliberate breaking change. Sometimes a breaking change is unavoidable, such as an urgent or security fix. Approve it knowingly, document it in your release notes, and tell affected clients. This should be the exception, not a routine way of working.
If oasdiff's verdict does not match your API's compatibility policy, you can also change how it treats response-header-became-nullable with a severity-levels file:
Put one rule per line; the level can be err, warn, or info, or none to disable the check entirely:
# severity.txt
response-header-became-nullable warnThen pass it to oasdiff:
oasdiff changelog base.yaml revision.yaml --severity-levels severity.txt