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:
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,)))
With 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.
Wraps expression under validation with an explicit description; after macro transformation, the resulting validator will use the specified description to render violations. See the com.wix.accord.dsl.Descriptor.as method for an example.
The type of the provided expression.