required-string-property-missing-min-length
Requires every required string property to declare minLength.
| Attribute | Value |
|---|---|
| Category | Schema |
| Maturity | Silver |
| OpenAPI | Swagger 2.0; OpenAPI 3.0, 3.1, 3.2 |
| Starter–Recommended | Off |
| Strict | Warning |
| Complete | Error |
Intent
Required says a property must exist; minLength states whether an empty string is acceptable. Declaring both removes that ambiguity.
Flags
A property listed in its object's required array when its inline or referenced schema has type: string but no minLength.
Does not flag
Optional strings, non-string properties, or required strings with any explicit minLength, including 0.
See it fail
Customer:
type: object
required: [name]
properties:
name:
type: string
Diagnostic: Property minLength is required.
Fix it
Use a limit that matches the domain:
Customer:
type: object
required: [name]
properties:
name:
type: string
minLength: 1
Configure
profiles:
default:
rules:
extends: [strict]
override:
required-string-property-missing-min-length: error
Nearby: invalid-min-length, string-max-length-or-enum.