Problem
The current iteration of the Validation Framework is mostly a port of the logic out of the Finatra Jackson CaseClassDeserializer. As such the current version is limited in function as Jackson deserialization does a fair amount of the lifting. This however translates to a somewhat limited Validation API when used outside of Jackson deserialization. Specifically, this means that the current API does not handle nested case class constructs, nor does it track property paths for error reporting (nested or otherwise) as those parts are handled by Jackson deserialization and the Validation framework is only used to validation construction of a specific case class during the process.
The standalone Validation API also differs from usage with Jackson as the usage is post-construction and thus is less concerned with the vagaries of case class construction but is more straight-forwardly about annotated field and method validation.
Solution
Implement changes to support nested case class validation via cascading of
validation via an @Valid
annotation, along with tracking of validated property
paths (for fields and methods) for use in error reporting.
Draw clearer line around Jackson deserialization for construction validation moving specific logic into the Jackson library making use of constructs and utilities provided by the validation library.
Result
The ability to enable cascading validation for nested case classes or (Iterables of case classes). Better code/logic separation and tests.
JIRA Issues: CSL-9785, CSL-9783
Differential Revision: https://phabricator.twitter.biz/D559644