Comprehensive row validation requires row construction
If I am given a row value
x of unknown provenance that I'd like to comprehensively validate (i.e. validate field values as well as field types) against schema
s, then my only option is to construct a new row
y = Legolas.row(s, x), at which point I can use
y as my "
s-validated" row. There is no mechanism to fully validate
The primary reason that this is the case is that field assignments may introduce implicit value-level constraints on a schema's input/output domain, and there is no enforceable mechanism by which schema authors are made to explicitly surface independently computable predicates for these implicit constraints.
For example, take the schema: