request-body-became-required

Request body became required.

directionrequestarearequestBodykindrequirednessactionchange

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

The request body was optional and is now required. A client that sent the request with no body, which was valid before, now fails.

This is the body-level counterpart of a property becoming required. To avoid breaking clients, keep the body optional and give the server a defined behavior when it is absent.

Example

Before
After
1requestBody:1requestBody:
2 required: false2 required: true
3 content:3 content:
4 application/json:4 application/json:
5 schema:5 schema:
6 type: object6 type: object

Clients that called the endpoint without a body were valid before and now fail.

How to handle this change

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

Then pass it to oasdiff:

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

Related requestBody rules

Browse all 509 checks →