Skip to main content

array-max-items

Requires every resolved array schema to define maxItems.

AttributeValue
CategorySchema
MaturityPlatinum
OpenAPISwagger 2.0; OpenAPI 3.0, 3.1, 3.2
StarterOff
LenientWarning
Recommended–CompleteError

Intent

Bounded arrays make payload size predictable and reduce resource-exhaustion risk during validation, testing, and production use.

Flags

Schemas whose resolved type includes array and whose maxItems is absent. Referenced schemas are resolved.

See it fail

tags:
type: array
items:
type: string

Diagnostic: Array schemas should define \maxItems`.`

Fix it

tags:
type: array
maxItems: 20
items:
type: string

Configure

profiles:
default:
rules:
extends: [recommended]
override:
array-max-items: warn

Nearby: string-max-length-or-enum, integer-bounds-required.