Generic validators

See #2132