Review operation visibility for an OpenAPI path

Check for unintentionally omitted operations while retaining deliberately empty path items.

Description

A path can intentionally hide its operations from an audience. A $ref can also supply the operations for a path item.

Potential impact

An accidental omission leaves a supported method out of generated documentation and tests. The server still controls access to the endpoint.

Remediation

Resolve any $ref and compare the result with the methods this audience should see. Add each missing method and its responses. Keep a deliberately filtered path item empty.

Examples

The example adds GET / with a 200 response. Supply the document’s info object.

Before

json
{
  "openapi": "3.0.0",
  "paths": {
    "/": {}
  }
}

After

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

References