FieldValidator
A type alias for field validation functions.
A field validator is a function that takes a field value and returns a FieldError. If validation passes, it should return noFieldError. If validation fails, it should return a FieldError containing the validation error messages.
Usage:
val emailValidator: FieldValidator<String> = { email ->
if (email.contains("@")) noFieldError
else FieldError(listOf("Must be a valid email"))
}
Content copied to clipboard
Parameters
V
The type of the value being validated.