Description
OpenAPI 3.0 requires items in a type: array schema. On a Swagger 2.0 non-body array parameter, items belongs directly on the parameter.
Potential impact
A missing element definition can break validation or SDK generation, or leave clients sending the wrong type.
Remediation
Specify the element type or schema reference in the array schema’s items. For a Swagger 2.0 non-body array parameter, supply items.type. Check representative request or response data against the definition.
Examples
These OpenAPI 3.0 excerpts omit the required info and paths sections.
Before
json
{
"openapi": "3.0.0",
"components": {
"schemas": {
"GeneralError": {
"type": "array"
}
}
}
}
After
json
{
"openapi": "3.0.0",
"components": {
"schemas": {
"GeneralError": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
The second GeneralError defines an array of strings with items.type: string.