Item format is not applicable to the type the array items

Issue ID: warning-items-format-improper

Description

The format you have specified for one or more array items is not consistent with their type. While this is acceptable, it probably is not what you want.

For more details, see the OpenAPI Specification and JSON Schema Validation.

Example

The following is an example of how this issue could look in your API definition. The array accepts items of the type integer, but the format float is not an integer format:

{
    "name": "lockCombo",
    "in": "body",
    "description": "Lock combination to add to the list",
    "required": true,
    "schema": {
        "type": "object",
        "required": [
            "combination"
        ],
        "properties": {
            "combination": {
                "type": "array",
                "items": {
                    "type": "integer",
                    "format": "float"
                }
            }
        }
    }
}

Remediation

Make sure that the formats of all array items match the type of the items.

Numeric parameters type integer can have the format int32 or int64. Numeric parameters type number can have the format float or double.

{
    "name": "lockCombo",
    "in": "body",
    "description": "Lock combination to add to the list",
    "required": true,
    "schema": {
        "type": "object",
        "required": [
            "combination"
        ],
        "properties": {
            "combination": {
                "type": "array",
                "items": {
                    "type": "integer",
                    "format": "int32"
                }
            }
        }
    }
}