...

Text file src/github.com/qri-io/jsonschema/testdata/draft7/additionalItems.json

Documentation: github.com/qri-io/jsonschema/testdata/draft7

     1[
     2    {
     3        "description": "additionalItems as schema",
     4        "schema": {
     5            "items": [{}],
     6            "additionalItems": {"type": "integer"}
     7        },
     8        "tests": [
     9            {
    10                "description": "additional items match schema",
    11                "data": [ null, 2, 3, 4 ],
    12                "valid": true
    13            },
    14            {
    15                "description": "additional items do not match schema",
    16                "data": [ null, 2, 3, "foo" ],
    17                "valid": false
    18            }
    19        ]
    20    },
    21    {
    22        "description": "items is schema, no additionalItems",
    23        "schema": {
    24            "items": {},
    25            "additionalItems": false
    26        },
    27        "tests": [
    28            {
    29                "description": "all items match schema",
    30                "data": [ 1, 2, 3, 4, 5 ],
    31                "valid": true
    32            }
    33        ]
    34    },
    35    {
    36        "description": "array of items with no additionalItems",
    37        "schema": {
    38            "items": [{}, {}, {}],
    39            "additionalItems": false
    40        },
    41        "tests": [
    42            {
    43                "description": "fewer number of items present",
    44                "data": [ 1, 2 ],
    45                "valid": true
    46            },
    47            {
    48                "description": "equal number of items present",
    49                "data": [ 1, 2, 3 ],
    50                "valid": true
    51            },
    52            {
    53                "description": "additional items are not permitted",
    54                "data": [ 1, 2, 3, 4 ],
    55                "valid": false
    56            }
    57        ]
    58    },
    59    {
    60        "description": "additionalItems as false without items",
    61        "schema": {"additionalItems": false},
    62        "tests": [
    63            {
    64                "description":
    65                    "items defaults to empty schema so everything is valid",
    66                "data": [ 1, 2, 3, 4, 5 ],
    67                "valid": true
    68            },
    69            {
    70                "description": "ignores non-arrays",
    71                "data": {"foo" : "bar"},
    72                "valid": true
    73            }
    74        ]
    75    },
    76    {
    77        "description": "additionalItems are allowed by default",
    78        "schema": {"items": [{"type": "integer"}]},
    79        "tests": [
    80            {
    81                "description": "only the first item is validated",
    82                "data": [1, "foo", false],
    83                "valid": true
    84            }
    85        ]
    86    }
    87]

View as plain text