Skip to main content

accept-response-content-type-conflict

Finds response media types that an operation's declared Accept header cannot accept.

AttributeValue
CategoryOperations
MaturityPlatinum
OpenAPISwagger 2.0; OpenAPI 3.0, 3.1, 3.2
StarterOff
Lenient–StrictWarning
CompleteError

Intent

The request's advertised acceptable formats and the operation's possible response formats must overlap.

Flags

Each response content type that matches none of the Accept header schema's enum or const values. Matching ignores case and media-type parameters and supports exact types, type/*, and */*.

Does not flag

Operations without an Accept header, headers without finite enum or const values, operations without response content, or content types accepted by at least one value.

See it fail

get:
parameters:
- name: Accept
in: header
schema:
type: string
enum: [application/xml]
responses:
'200':
description: OK
content:
application/json:
schema:
type: object

The request permits XML, but the response is JSON.

Fix it

Align the declared values:

schema:
type: string
enum: [application/json]

Configure

profiles:
default:
rules:
extends: [recommended]
override:
accept-response-content-type-conflict: error

Nearby: request-mime-type, response-mime-type.