Length validators support transforms when validating strings. Transforms are applied before measuring length.
length!
Checks that the value has exactly the specified length.| Parameter | Type | Description |
|---|---|---|
| value | integer | Exact required length |
Examples
Examples
min_length!
Checks that the value has at least the specified length.| Parameter | Type | Description |
|---|---|---|
| value | integer | Minimum required length |
Examples
Examples
max_length!
Checks that the value has at most the specified length.| Parameter | Type | Description |
|---|---|---|
| value | integer | Maximum allowed length |
Examples
Examples
Combining Length Validators
Length Range
With Other Validators
Common Patterns
Response Quality Checks
Array Size Validation
Code Generation
Using Transforms
Transforms are applied before measuring length:Notes on Length Calculation
- Strings: Length is the number of characters
- Arrays: Length is the number of items
- Objects: Length is the number of keys