cast an object's values to a specified schema