cast
Creates a transformation-based validation rule chain.
This function allows you to validate a transformed or derived value from the original object. It's useful when you need to validate a computed property, extracted field, or any transformation of the original value. The transformation is applied first, then the chained validation rules are applied to the transformed result.
Usage:
rules<String> {
notBlank { "must be not blank" }
cast { it.length } then {
minimum(3) { "must be at least 3 characters" }
maximum(20) { "must be at most 20 characters" }
}
}
Content copied to clipboard
Return
An ValidationRuleChainer that allows chaining validation rules for the transformed value.
Parameters
V
The type of the original object value.
S
The type of the transformed value.
transform
The transformation function to apply to the object value.