Length validators support transforms when validating strings. Transforms are applied before measuring length.
length!
Checks that the value has exactly the specified length.Examples
Examples
min_length!
Checks that the value has at least the specified length.Examples
Examples
max_length!
Checks that the value has at most the specified 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