Property defined for an array item in a header is not applicable to the array item type

Description

A property defined for an array item in the header is not applicable to the type of the array item.

For more details, see the OpenAPI Specification.

Example

The following is an example of how this issue could look in your API definition. The array accepts string items but also has the property maximum defined which is a property of integers and numbers:

{
  "name": "someArray",
  "in": "header",
  "type": "array",
  "items": {
    "type": "string",
    "pattern": ^((4\d{3})|(5[1-5]\d{2})|(6011))-?\d{4}-?\d{4}-?\d{4}|3[4,7]\d{13}$,
    "maximum": 8
  }
}

Remediation

Make sure that all properties defined for array items match the array item type.

{
  "name": "someArray",
  "in": "header",
  "type": "array",
  "items": {
    "type": "string",
    "pattern": ^((4\d{3})|(5[1-5]\d{2})|(6011))-?\d{4}-?\d{4}-?\d{4}|3[4,7]\d{13}$,
    "maxLength": 8
  }
}

Get API Security news directly in your Inbox.

By clicking Subscribe you agree to our Data Policy