Tags the specified validation expression with an explicit description.
Tags the specified validation expression with an explicit description. Enables syntax such as:
p.firstName as "first name" is notEmpty
; violations for this validation rule will be rendered with the
specified expression (instead of the implicit rule), for example:
--- TODO --- update example!
scala> case class Person( firstName: String, lastName: String ) defined class Person scala> implicit val personValidator = validator[ Person ] { p => p.firstName as "first name" is notEmpty } personValidator: com.wix.accord.combinators.And[Person] = <function1> scala> validate( Person( "", "last" ) ) res0: com.wix.accord.Result = Failure(List(Violation(first name must not be empty,)))
Without the explicit description, the violation would read "firstName must not be empty".
The description to use for the expression in case of violations.
The validation expression tagged with the explicit description.
Enables explicitly describing expression under validation.
After the macro transform, the resulting validator will use the specified description to render violations. See the as method for full example.
The type of the provided expression.
com.wix.accord.dsl