Skip to content

[Question/Proposal] Adding tests for invalid JSON schemas #623

Closed as not planned
@DrDeano

Description

@DrDeano

Currently, all test files contain valid schema and are within specification. For some validators, there are MUST constrains in the specification such as in minItems where the integer must be a non-negative integer.

Can there be tests for invalid schemas ensuring these constrains are met, for example: {"minItems": -1}, and ensuring that the implementation recognizes that this is invalid.

Proposed starting format for discussion: adding in valid_schema:

[
    {
        "description": "minItems validation",
        "schema": {"minItems": 1},
        "valid_schema": true,
        "tests": [
            {
                "description": "longer is valid",
                "data": [1, 2],
                "valid": true
            }
        ]
    },
    {
        "description": "minItems invalid schema",
        "schema": {"minItems": -1},
        "valid_schema": false,
        "tests": []
    }
]

Trying not to change the existing format too much to not break exiting test.

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