package validation
Ordering
- Alphabetic
Visibility
- Public
- All
Type Members
- case class Person (gender: Option[String], experience: Int) extends Product with Serializable
- case class SchoolClass (pupils: Int, teacher: Person) extends Product with Serializable
Value Members
- object CollectErrors extends App
-
object
CrossFieldValidation
extends App
This example shows how to apply cross-field validation rules for the request using a for comprehensions and the "Extraction" construct.
This example shows how to apply cross-field validation rules for the request using a for comprehensions and the "Extraction" construct. The comprehension returns an Extracted, or ExtractionFailed instance. Note that the Extractables can be nested in other Extractables, which allows for re-use and compartmentalisation of validation logic.
In this example, we implement a checker for school class sizes.. the rule being that the number of pupils in a class must be greater than their teacher's years of experience.