rules
Creates a set of validation rules using a DSL builder.
This function provides a convenient way to create validation rule sets using a domain-specific language (DSL) approach. The builder block allows you to compose multiple validation rules together in a readable and maintainable way.
Usage:
val stringRules = rules<String> {
notEmpty { "must be not empty" }
maxLength(100) { "must be at most 100 characters" }
}
Content copied to clipboard
Return
A ValidationRuleSet containing all the rules defined in the block.
Parameters
V
The type of the value to be validated.
block
A lambda that configures the ValidationRuleBuilder to create the rule set.