response-body-discriminator-added

Response body discriminator added.

directionresponseareaschemakindstructureactionadd

Not breaking (level: info)

oasdiff records this in the changelog but does not fail CI by default. Clients that worked under the old contract still work, so existing clients are not affected.

What this check detects

A `discriminator` was added to a response body schema. It names the property that tells tooling which subschema of a `oneOf` or `anyOf` a payload matches, so a client can deserialize without trying every branch.

Adding one is informational: it does not change which payloads the server may return, only how tooling resolves them. Clients that already matched branches by shape keep working.

Example

Before
After
1responses:1responses:
2 '200':2 '200':
3 description: OK3 description: OK
4 content:4 content:
5 application/json:5 application/json:
6 schema:6 schema:
7 oneOf:7 oneOf:
8 - $ref: '#/components/schemas/Cat'8 - $ref: '#/components/schemas/Cat'
9 - $ref: '#/components/schemas/Dog'9 - $ref: '#/components/schemas/Dog'
10 discriminator:
11 propertyName: petType

The set of possible responses is unchanged; tooling can now use "petType" to pick the branch instead of inferring it.

Change its severity

oasdiff reports response-body-discriminator-added as informational, so it does not fail CI. To treat it as a warning or an error under your own compatibility policy, or to turn it off, set its level in 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-body-discriminator-added err

Then pass it to oasdiff:

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

Related schema rules

Browse all 509 checks →