invalid-min-length
Rejects a numeric minLength below zero on a string schema.
| Attribute | Value |
|---|---|
| Category | Schema |
| Maturity | Platinum |
| OpenAPI | Swagger 2.0; OpenAPI 3.0, 3.1, 3.2 |
| Starter | Off |
| Lenient | Warning |
| Recommended–Complete | Error |
Intent
String length cannot be negative. A negative constraint is contradictory and cannot describe valid data.
Flags
String schemas—including multi-type schemas containing string—with numeric minLength < 0. Missing, nonnumeric, and non-string cases are left to structural validation.
See it fail
name:
type: string
minLength: -1
Diagnostic: minLength -1 cannot be less than 0
Fix it
name:
type: string
minLength: 0
Configure
profiles:
default:
rules:
extends: [recommended]
override:
invalid-min-length: warn
Nearby: invalid-max-length, length-exceeds-limit.