request-body-discriminator-added
Request body discriminator added.
Not breaking (level: info)
oasdiff reports this in the changelog but does not treat it as a breaking change, so it does not fail CI by default.
What this check detects
A discriminator is a hint on a oneOf / anyOf schema that tells a consumer which of the listed subschemas a payload conforms to, by reading a named property (propertyName) rather than trying each subschema in turn. It is used mainly by code generators and validators to map a value to a concrete type.
Adding a discriminator changes how the request body is interpreted: the named property must now be present and must match one of the mapped subschemas. oasdiff reports it as informational, but review it, because a payload that validated against a branch by structure alone may now be routed by the discriminator value instead.
Example
requestBody:
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/Cat'
- $ref: '#/components/schemas/Dog'requestBody:
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/Cat'
- $ref: '#/components/schemas/Dog'
discriminator:
propertyName: petTypeA discriminator now selects which subschema the request body is validated against, based on the "petType" property.
Change its severity or ignore it
To change the severity oasdiff assigns to request-body-discriminator-added, list its id and a level in a severity-levels file, one rule per line. The level can be err, warn, or info, or none to disable the check entirely:
# severity.txt
request-body-discriminator-added errThen pass it to oasdiff:
oasdiff changelog base.yaml revision.yaml --severity-levels severity.txtSetting the level to none disables the check, so it is no longer reported at all.