request-property-became-required-with-default

Request property with a default value became required.

directionrequestareaschemakindrequirednessactionchange

Breaking change (level: error)

It makes part of the request mandatory or non-nullable, so requests that omitted it or sent null are no longer valid.

What this check detects

Making an existing request property required is breaking: a request that omits it was valid before and is now invalid under the contract. This variant covers the case where the property already has a default value, which does not change the verdict.

A default is a server-side fallback value; it does not make an omitted required property valid. Whether a server applies it and accepts the request anyway is that server’s own leniency, not the contract. Other consumers break regardless: a generated client SDK makes the property a mandatory argument, and a strict API gateway rejects a request that omits it.

So oasdiff reports this as breaking, the same as making a property required with no default. Downgrade this check with a severity-levels file if the change is safe for your ecosystem.

Example

Before
After
1schema:1schema:
2 type: object2 type: object
3 properties:3 properties:
4 region:4 region:
5 type: string5 type: string
6 default: us-east-16 default: us-east-1
7 required: []7 required:
8 - region

"region" already has a default and is now required. A request that omits it was valid before and is now invalid under the contract; the default does not change that.

How to handle this change

When oasdiff flags request-property-became-required-with-default, 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 request-property-became-required-with-default 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
request-property-became-required-with-default warn

Then pass it to oasdiff:

oasdiff changelog base.yaml revision.yaml --severity-levels severity.txt

Related schema rules

Browse all 509 checks →