ContextualValidatable<C>, and validation(context) receives it:
Shopper.kt
PurchaseLine.kt
Purchase.kt
validate:
The type of the context is checked by the compiler: a
Purchase cannot be validated without a Shopper, and there is
no map of attributes to read and cast.
Passing the context down
Nested objects receive the context explicitly, withvalid(context). That keeps the flow visible, and lets a child
take only a part of it:
Validatable, checked with valid(), even inside a contextual parent.
The four ways to run
ContextualValidatable has the same four functions as Validatable, with the context first:
Validity after the context, for other messages or another clock.