Default value for the array item is not consistent with the item’s type

Description

The default value you have defined for an array item is not consistent with the type of the item.

Example

The following is an example how this issue could look int your API definition. The property count only accepts integer values, but the default value is a string:

{         
  "type": "array",
     "items": {
       "type": "object",
       "properties": {
         "count": {
           "type": "integer",
          "format": "int32",
          "default": "none",
          ...
         }
      }
   }
}

Remediation

Make sure that all default values for array items match the array items’ type.

{         
  "type": "array",
     "items": {
       "type": "object",
       "properties": {
         "count": {
           "type": "integer",
          "format": "int32",
          "default": 0,
          ...
         }
      }
   }
}

Get API Security news directly in your Inbox.

By clicking Subscribe you agree to our Data Policy