Description
A GET operation with only a default response leaves the success result unclear. default covers every code without its own entry.
Potential impact
Callers and tests may expect the wrong response format.
Remediation
Document the success status and body for a full retrieval, typically 200. If the endpoint fulfills HTTP Range requests, also describe the 206 response and its format.
Examples
This Swagger 2.0 excerpt adds 200 to getItem and omits the body schema.
Before
json
{
"swagger": "2.0",
"paths": {
"/item": {
"get": {
"operationId": "getItem",
"summary": "Get item",
"responses": {
"default": {
"description": "Error"
}
}
}
}
}
}
After
json
{
"swagger": "2.0",
"paths": {
"/item": {
"get": {
"operationId": "getItem",
"summary": "Get item",
"responses": {
"200": {
"description": "Success"
},
"default": {
"description": "Error"
}
}
}
}
}
}