Description
Document the success response for a PATCH operation so callers know how a partial update completes.
Potential impact
If only errors are documented, a client or test can treat a successful update as a failure.
Remediation
Use the status your server returns. For example, document 200 and the result schema when returning a body, or 204 when the update completes without one.
Examples
The example adds 204 for a successful update and keeps default for other responses.
Before
json
{
"openapi": "3.0.0",
"paths": {
"/item": {
"patch": {
"operationId": "updateItem",
"summary": "Updated item",
"responses": {
"default": {
"description": "Error"
}
}
}
}
}
}
After
json
{
"openapi": "3.0.0",
"paths": {
"/item": {
"patch": {
"operationId": "updateItem",
"summary": "Update item",
"responses": {
"204": {
"description": "Item updated successfully"
},
"default": {
"description": "Error"
}
}
}
}
}
}