Skip to content

False positive requireValidation check with minProperties #149

@andylizi

Description

@andylizi

Description

{
    "type": "object",
    "minProperties": 1,
    "properties": {
        "phoneNumber": { "type": "string" },
        "emailAddress": { "type": "string" }
    },
    "additionalProperties": false
}

This schema will fail with [requireValidation] if properties is used, required should be specified.

The requirement in this case is not necessary because minProperties is specified and additionalProperties is set to false, so at least one of phoneNumber and emailAddress is already required without explicitly using the required keyword.

Related code

https://github.com/ExodusMovement/schemasafe/blob/81459f3c7162137c19e19d9b869f9e41d0bf8dde/src/compile.js#L1158

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions