not-error-json-response
Disallows problem-detail JSON media types on 2xx responses.
| Attribute | Value |
|---|---|
| Category | Operations |
| Maturity | Gold |
| OpenAPI | Swagger 2.0; OpenAPI 3.0, 3.1, 3.2 |
| Starter | Off |
| Lenient–Strict | Warning |
| Complete | Error |
Intent
Problem details represent failures. Advertising them as successful content blurs the operation's outcome and client handling.
Flags
A response code beginning with 2 when any content key contains the case-sensitive text problem+json.
Does not flag
Non-2xx responses or successful responses whose media types do not contain that text.
See it fail
responses:
'200':
description: OK
content:
application/problem+json:
schema:
type: object
Diagnostic: 2xx responses should not use `application/problem+json`.
Fix it
Use the success representation's media type:
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
Configure
profiles:
default:
rules:
extends: [recommended]
override:
not-error-json-response: error
Nearby: error-response-media-type, operation-4xx-problem-details-rfc7807.