com.github.vickumar1981.svalidate
A generic interface that defines which class to validate and what type of validation to return. Creating an implicit that extends this class creates a validator for that class
object TestValidation { case class Password(password: String) case class CustomError(errorCode: String, errorMessage: String) implicit object PasswordValidator extends ValidatableResult[Password, CustomError] { override def validate(value: Password): Validation = (value.nonEmpty orElse CustomError("password.empty", "Password cannot be empty")) } }
the class to validate
the type of ValidationResult to use with ValidationDsl
Override this class to validate type A using a ValidationResult[B]
A generic interface that defines which class to validate and what type of validation to return. Creating an implicit that extends this class creates a validator for that class
the class to validate
the type of ValidationResult to use with ValidationDsl