request-body-media-type-removed

Request body media-type deleted.

directionrequestarearequestBodykindexistenceactionremove

Breaking change (level: error)

It removes something the API used to accept in the request, so clients that still send it are rejected.

What this check detects

A request body can declare more than one media type under content, for example application/json and application/xml, and a client picks one by setting its Content-Type header. The server accepts whichever media types are listed.

Removing a media type drops the server’s ability to accept requests sent with that Content-Type. Clients that were sending the removed format have no compatible alternative and break, which is why this is reported as a breaking change.

Example

Before
After
1requestBody:1requestBody:
2 content:2 content:
3 application/json:3 application/json:
4 schema:4 schema:
5 $ref: '#/components/schemas/Pet'5 $ref: '#/components/schemas/Pet'
6 application/xml:
7 schema:
8 $ref: '#/components/schemas/Pet'

The "application/xml" media type was removed from the request body. Clients that send XML bodies break.

How to handle this change

When oasdiff flags request-body-media-type-removed, 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-media-type-removed 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-media-type-removed warn

Then pass it to oasdiff:

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

Related requestBody rules

Browse all 509 checks →