Missing parameter value definition

Specify an OpenAPI 3.0 parameter's type and representation using schema or content.

Description

An OpenAPI 3.0 Parameter Object must define its value through either schema or content. Without either, the format for a path, query, header, or cookie parameter is unclear.

Potential impact

Clients may send values with the wrong type or representation, causing failed requests or incorrect parameter handling in SDKs.

Remediation

Use schema for ordinary values and constraints, or content for a representation with a media type. Do not specify both. When using $ref, check that the referenced parameter definition is valid.

Examples

The example defines id in /user/{id} as an integer. A path parameter's name must match its path placeholder.

Before

json
{
  "openapi": "3.0.0",
  "paths": {
    "/user/{id}": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "ID of the API version"
        }
      ]
    }
  }
}

After

json
{
  "openapi": "3.0.0",
  "paths": {
    "/user/{id}": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "ID of the API version",
          "schema": {
            "type": "integer"
          }
        }
      ]
    }
  }
}

References