Multiple multiple validation rules in control structures is incorrect
CatTail opened this issue · 2 comments
CatTail commented
When using multiple is false
validation rules inside control structure, it seems only the last rule matters, below is an example to reproduce the issue.
object AccordConditionIssueApp extends App {
case class Something(bool1: Boolean, bool2: Boolean, bool3: Boolean)
val condition = true
implicit val somethingValidator = validator[Something] { o =>
if (condition) {
o.bool1 is false
o.bool2 is false
}
o.bool3 is false
}
// Following example expected to be invalid, but it turned out to be valid
val invalidSomething = Something(bool1 = true, bool2 = false, bool3 = false)
println(validate(invalidSomething)) // => Success
}
holograph commented
Confirmed. Looking into it
holograph commented
PR issued. @noam-almog ball's in your court :-)