Add validation primitives to util

Part 2 in a series of changes towards data validation.