validation now a function of a schema

rather than a C-style switch over types.