Description
In responses, the optional default entry covers status codes the operation does not otherwise document. It can describe errors or other outcomes.
Potential impact
A generated client may have no model for an undocumented error body.
Remediation
List known success and error codes. Add default if the remaining responses share a description or body format. Describe any body the server actually returns.
Examples
The PATCH example keeps the bodyless 204 and adds default with the description Error.
Before
json
{
"openapi": "3.0.0",
"paths": {
"/item": {
"patch": {
"operationId": "updateItem",
"responses": {
"204": {
"description": "Item updated successfully"
}
}
}
}
}
}
After
json
{
"openapi": "3.0.0",
"paths": {
"/item": {
"patch": {
"operationId": "updateItem",
"responses": {
"204": {
"description": "Item updated successfully"
},
"default": {
"description": "Error"
}
}
}
}
}
}