Skip to content

tv4.validate does not validate properly when using 'const' schema property #274

@catherine-greene

Description

@catherine-greene

tv4.validate does not tell the difference when using 'const' schema property

const jsonData = {
            "id": 1160134,
            "lastUpdatedBy": "API_TEST"
         }
const schema = {
    "required": [
        "id",
        "lastUpdatedBy",
        ],
    "properties": {
        "id": {
            "type": "integer"
        },
        "lastUpdatedBy": {
            "type": "string",
            **"const": "API_TEST3"**
        }
   }
}

tv4.validate(jsonData, schema);

App information

Postman v7.19.1
OS: Windows 10

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions