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

Description

A property defined for a schema array item 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 has the property maximum defined which is a property of integers and numbers:

{
  "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.

{
  "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