You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to set up a validator based on the web site example. I've got:
import com.wix.accord.dsl._
case class Deck (
id: Option[UUID],
number: Int,
name: String,
code: String,
isPax: Boolean,
) {
def safeId = id.getOrElse(UUID.randomUUID())
}
object Deck {
val LOWEST = 3
val HIGHEST = 20
/**
* A validator defines all the business logic for validating attributes. Validators can be called at any time with
* the `validate()` function. Typically `validate()` is called right after creating a new instance.
*/
implicit val deckValidator = validator[Deck] { p =>
p.code.length is between(1, 4) // The expression being validated is resolved automatically, see below
p.code should matchRegex(".*")
}
}
Which generates the following errors:
[error] /Users/zbeckman/Projects/Lightbend/NCL/zero-ship-service/ship-api/src/main/scala/com/ncl/zero/api/ship/Deck.scala:28:47: exception during macro expansion:
[error] java.lang.NoSuchMethodError: scala.collection.immutable.$colon$colon.tl$1()Lscala/collection/immutable/List;
[error] at com.wix.accord.transform.FunctionDescriber$class.describeFunction(ExpressionDescriber.scala:145)
[error] at com.wix.accord.transform.ValidationTransform.describeFunction(ValidationTransform.scala:24)
[error] at com.wix.accord.transform.ValidationTransform.<init>(ValidationTransform.scala:36)
[error] at com.wix.accord.transform.ValidationTransform$.apply(ValidationTransform.scala:240)
[error] implicit val deckValidator = validator[Deck] { p =>
[error] ^
The text was updated successfully, but these errors were encountered:
I'm trying to set up a validator based on the web site example. I've got:
Which generates the following errors:
The text was updated successfully, but these errors were encountered: