Review normal operation response definitions

Document the outcomes that an operation actually returns during normal processing.

Description

An operation can normally return a redirect. A missing 2xx entry alone does not invalidate its responses.

Potential impact

Clients or tests can mistake an expected response for an error or overlook its body.

Remediation

Document the expected outcomes and known errors. Give each its status, description, and any headers or body the client needs. Check what default already covers and, in OpenAPI 3.0, any 2XX entry.

Examples

These OpenAPI 3.0 excerpts omit info.

Before

json
{
  "openapi": "3.0.0",
  "paths": {
    "/": {
      "get": {
        "responses": {
          "300": {
            "description": "Redirect"
          }
        }
      }
    }
  }
}

After

json
{
  "openapi": "3.0.0",
  "paths": {
    "/": {
      "get": {
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  }
}

Keep 300 if the server offers multiple choices. Use 200 if the server returns the requested result directly.

References