java-json-tools/json-schema-validator

RequiredSyntaxChecker not validating duplicate array elements correctly for required properties array

suryatej16 opened this issue · 0 comments

The validator has inconsistent behavior when validating duplicate elements in the required properties array. The following two schemas differ only by the order of elements in the required properties array, but one schema is validated successfully, while another fails validation:

Successful Schema

{
    "type": "object",
    "properties": {
        "name__c": {
            "label": "Passenger Name",
            "type": "string",
            "enum": [
                "test",
                "test",
                "noTest"
            ]
        },
        "dateOfBirth__c": {
            "label": "Date of Birth",
            "type": "string",
            "format": "date"
        }
    },
    "required": [
        "name__c",
        "name__c",
        "dateOfBirth__c"
    ]
}

Failed Schema

{
    "type": "object",
    "properties": {
        "name__c": {
            "label": "Passenger Name",
            "type": "string",
            "enum": [
                "test",
                "test",
                "noTest"
            ]
        },
        "dateOfBirth__c": {
            "label": "Date of Birth",
            "type": "string",
            "format": "date"
        }
    },
    "required": [
        "dateOfBirth__c",
        "name__c",
        "name__c"
    ]
}