Improving custom validation of the allowedValues field