A validator which merely delegates to another, implicitly available validator. This is necessary for the
description generation to work correctly, e.g. in the case where:
case class Person( firstName: String, lastName: String )
case class Classroom( teacher: Person, students: Seq[ Person ] )
implicit val personValidator = validator[ Person ] { p =>
p.firstName is notEmpty
p.lastName is notEmpty
}
implicit val classValidator = validator[ Classroom ] { c =>
c.teacher is valid
c.students.each is valid
c.students have size > 0
}
c.teacher actually delegates to the personValidator, which means a correct error message would be
a com.wix.accord.GroupViolation aggregating the actual rule violations.
T
The object type this validator operates on. An implicit com.wix.accord.Validator
over type T must be in scope.
A validator which merely delegates to another, implicitly available validator. This is necessary for the description generation to work correctly, e.g. in the case where:
case class Person( firstName: String, lastName: String ) case class Classroom( teacher: Person, students: Seq[ Person ] )
implicit val personValidator = validator[ Person ] { p => p.firstName is notEmpty p.lastName is notEmpty }
implicit val classValidator = validator[ Classroom ] { c => c.teacher is valid c.students.each is valid c.students have size > 0 }
c.teacher
actually delegates to thepersonValidator
, which means a correct error message would be a com.wix.accord.GroupViolation aggregating the actual rule violations.The object type this validator operates on. An implicit com.wix.accord.Validator over type
T
must be in scope.