Property defined for a schema array item is not applicable for the array item type

Description

A property defined for a schema array item is not applicable for the type of the array item.

Example

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

"post": {
  "description": "Creates a new pet in the store",
  "operationId": "addPet",
  "parameters": [
    {
      "name": "pet",
      "in": "body",
      "description": "Pet to add to the store",
      "required": true,
      "schema": {
        "type": "object",
        "required": [
          "name"
        ],
        "properties": {
        "name": {
          "type": "string"
        },
        "favfood": {
          "type": "array",
          "items": {
             "type": "string",
             "pattern": ".*",
             "maximum": 8
          }
        }
      }
    }
   ],

Remediation

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

"post": {
  "description": "Creates a new pet in the store",
  "operationId": "addPet",
  "parameters": [
    {
      "name": "pet",
      "in": "body",
      "description": "Pet to add to the store",
      "required": true,
      "schema": {
        "type": "object",
        "required": [
          "name"
        ],
        "properties": {
        "name": {
          "type": "string"
        },
        "favfood": {
          "type": "array",
          "items": {
             "type": "string",
             "pattern": ".*"
             "maxLength": 8
          }
        }
      }
    }
   ],

Get API Security news directly in your Inbox.

By clicking Subscribe you agree to our Data Policy