request-body-all-of-added

Sub-schema added to allOf in request body.

directionrequestareaschemakindstructureactionadd

Breaking change (level: error)

It adds a structural rule to the request schema, so some requests that were valid before no longer satisfy it and are rejected.

What this check detects

`allOf` means a value must satisfy every listed sub-schema at once. Adding a sub-schema to a request body’s `allOf` adds constraints the request must now also meet, so a payload that was valid before can start failing validation.

That is why this is breaking, even though nothing was removed: the request contract only got stricter.

Example

Before
After
1requestBody:1requestBody:
2 content:2 content:
3 application/json:3 application/json:
4 schema:4 schema:
5 allOf:5 allOf:
6 - $ref: '#/components/schemas/Account'6 - $ref: '#/components/schemas/Account'
7 - type: object
8 required:
9 - region
10 properties:
11 region:
12 type: string

The body must now also satisfy the added sub-schema, so a request that omits "region" was valid before and now fails.

How to handle this change

When oasdiff flags request-body-all-of-added, 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-all-of-added 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-all-of-added warn

Then pass it to oasdiff:

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

Related schema rules

Browse all 509 checks →