Fix for failing uniqueness validation on enum. #14172

Adding test case and fix for the issue described in here: #14172