Body parameter is missing schema (OpenAPI 2.0)

The schema describing the request body is missing

Description

An OpenAPI 2.0 in: body parameter needs a schema, even when the body is a single value.

Potential impact

Without a body schema, a client may send the wrong data or a generator may reject the specification.

Remediation

Describe the body the server accepts. Set its type and any required fields in schema, or use $ref there for a shared model.

Examples

Here limit names the parameter. The revised schema expects the body itself to be an integer.

Before

json
{
  "name": "limit",
  "in": "body",
  "description": "max records to return",
  "required": true
}

After

json
{
  "name": "limit",
  "in": "body",
  "description": "max records to return",
  "required": true,
  "schema": {
    "type": "integer"
  }
}

References