Missing OpenAPI 3.0 parameter reference target

Match parameter reference paths to their definitions.

Description

For a local $ref to a shared parameter, use the name defined in components.parameters. The reference can also point to a Parameter Object in an external file.

Potential impact

An unresolved reference can stop client generation or leave callers unsure which inputs and formats are required.

Remediation

After renaming a definition, update its references and validate the specification. Check the input’s location, type and required status against the server’s behavior.

Examples

Before

json
{
  "openapi": "3.0.0",
  "info": {
    "title": "Simple API Overview",
    "version": "1.0.0"
  },
  "paths": {
    "/": {
      "get": {
        "operationId": "listVersionsv2",
        "summary": "List API versions",
        "responses": {
          "200": {
            "description": "Success"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/wrongParameter"
          }
        ]
      }
    }
  },
  "components": {
    "parameters": {
      "limitParam": {
        "name": "limit",
        "in": "query",
        "description": "max records to return",
        "required": true,
        "schema": {
          "type": "integer"
        }
      }
    }
  }
}

After

json
{
  "openapi": "3.0.0",
  "info": {
    "title": "Simple API Overview",
    "version": "1.0.0"
  },
  "paths": {
    "/": {
      "get": {
        "operationId": "listVersionsv2",
        "summary": "List API versions",
        "responses": {
          "200": {
            "description": "Success"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/limitParam"
          }
        ]
      }
    }
  },
  "components": {
    "parameters": {
      "limitParam": {
        "name": "limit",
        "in": "query",
        "description": "max records to return",
        "required": true,
        "schema": {
          "type": "integer"
        }
      }
    }
  }
}

For GET /, replace the undefined wrongParameter with limitParam. Clients must send an integer query parameter named limit.

References