owasp-define-error-responses-429
Define a 429 response and a schema for its body. The rule checks the first declared media type for a schema; a response description alone does not pass. A default or wildcard response does not replace the explicit 429 response.
Bad example
openapi: "3.1.0"
info:
title: Chicken Nuggets API
version: "1.0"
paths:
/chickenNuggets:
get:
responses:
'200':
description: OK
Good example
openapi: "3.1.0"
info:
title: Chicken Nuggets API
version: "1.0"
paths:
/chickenNuggets:
get:
responses:
'200':
description: OK
'429':
description: Request failed
content:
application/problem+json:
schema:
type: object
properties:
detail:
type: string
How do I fix this violation?
Add the explicit response code and a content media type with a schema that describes the error body.