length-exceeds-limit
Finds minLength or maxLength values above 4 MiB (4,194,304 characters).
| Attribute | Value |
|---|---|
| Category | Schema |
| Maturity | Platinum |
| OpenAPI | Swagger 2.0; OpenAPI 3.0, 3.1, 3.2 |
| Starter | Off |
| Lenient–Strict | Warning |
| Complete | Error |
Intent
Specmatic caps generated strings at 4 MiB to keep tests and stubs practical. Larger declared boundaries cannot receive full boundary testing.
Flags
Any schema with numeric minLength or maxLength greater than 4,194,304. Each oversized field gets its own finding.
See it fail
payload:
type: string
maxLength: 5000000
The diagnostic explains that generation is capped at 4 MiB and boundary testing will not reach the declared limit.
Fix it
Reduce the constraint when 4 MiB is sufficient:
payload:
type: string
maxLength: 4194304
If the larger limit is intentional, keep the API constraint and treat this rule as a documented warning.
Configure
profiles:
default:
rules:
extends: [recommended]
override:
length-exceeds-limit: warn
Nearby: invalid-max-length, string-max-length-or-enum.