Non-body parameter uses schema (OpenAPI 2.0)

A query, path, header, or formData parameter specifies schema

Description

OpenAPI 2.0 query, path, header, and formData parameters define their type with a parameter-level type, not schema. Arrays also require items.

Potential impact

Document validation may fail, or tools may not interpret the parameter’s type correctly.

Remediation

Replace schema with the actual type, defining any needed format or items directly on the parameter. Do not simply remove schema and lose the type information.

Examples

These examples replace schema with type: integer in a query parameter and a reusable path parameter. The limitParam definition is not referenced by this operation.

Before

json
{
  "swagger": "2.0",
  "info": {
    "title": "Simple API Overview",
    "version": "1.0.0"
  },
  "paths": {
    "/": {
      "get": {
        "parameters": [
          {
            "name": "limit2",
            "in": "query",
            "description": "max records to return",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "operationId": "listVersionsV2",
        "summary": "List API versions",
        "responses": {
          "200": {
            "description": "200 response"
          }
        }
      }
    }
  },
  "parameters": {
    "limitParam": {
      "name": "limit",
      "in": "path",
      "description": "max records to return",
      "required": true,
      "schema": {
        "type": "integer"
      }
    }
  }
}

After

json
{
  "swagger": "2.0",
  "info": {
    "title": "Simple API Overview",
    "version": "1.0.0"
  },
  "paths": {
    "/": {
      "get": {
        "parameters": [
          {
            "name": "limit2",
            "in": "query",
            "description": "max records to return",
            "required": true,
            "type": "integer"
          }
        ],
        "operationId": "listVersionsV2",
        "summary": "List API versions",
        "responses": {
          "200": {
            "description": "200 response"
          }
        }
      }
    }
  },
  "parameters": {
    "limitParam": {
      "name": "limit",
      "in": "path",
      "description": "max records to return",
      "required": true,
      "type": "integer"
    }
  }
}

References