We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
This is more or less from your example on the README:
import com.sksamuel.monkeytail.Validator import com.sksamuel.monkeytail._ import com.sksamuel.monkeytail.ValidatorSyntax._ case class Designation(prefix: String, code: String) case class Starship(name: String, maxWarp: Double, designation: Designation) implicit val designationValidator = Validator[Designation] .validate(_.prefix)(prefix => prefix != null && (prefix.startsWith("NCC") || prefix.startsWith("NX"))) .validate(_.code)(!_.isEmpty) object MaxWarpExceededViolation extends Violation val starshipValidator = Validator[Starship] .validate(_.name)(_ != null) .validate(_.maxWarp)(_ < 10)(MaxWarpExceededViolation) .valid(_.designation)(designationValidator) // this will require the previous implicit. val starship = Starship("USS Enterprise", maxWarp = 5.0, designation = Designation("NCC-foo", "")) val result = starshipValidator(starship)
The output of the result has what appears to be a bug in the path returned:
result
result: Validated[NonEmptyList[Violation],Starship] = Invalid(NonEmptyList(DefaultViolation(Invalid value: ,Path(List(code)))))
Path(List(code)) should be Path(List(designation, code))
Path(List(code))
Path(List(designation, code))
The text was updated successfully, but these errors were encountered:
No branches or pull requests
This is more or less from your example on the README:
The output of the
result
has what appears to be a bug in the path returned:Path(List(code))
should bePath(List(designation, code))
The text was updated successfully, but these errors were encountered: