...

Text file src/github.com/qri-io/jsonschema/testdata/draft3/enum.json

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

     1[
     2    {
     3        "description": "simple enum validation",
     4        "schema": {"enum": [1, 2, 3]},
     5        "tests": [
     6            {
     7                "description": "one of the enum is valid",
     8                "data": 1,
     9                "valid": true
    10            },
    11            {
    12                "description": "something else is invalid",
    13                "data": 4,
    14                "valid": false
    15            }
    16        ]
    17    },
    18    {
    19        "description": "heterogeneous enum validation",
    20        "schema": {"enum": [6, "foo", [], true, {"foo": 12}]},
    21        "tests": [
    22            {
    23                "description": "one of the enum is valid",
    24                "data": [],
    25                "valid": true
    26            },
    27            {
    28                "description": "something else is invalid",
    29                "data": null,
    30                "valid": false
    31            },
    32            {
    33                "description": "objects are deep compared",
    34                "data": {"foo": false},
    35                "valid": false
    36            }
    37        ]
    38    },
    39    {
    40        "description": "enums in properties",
    41        "schema": {
    42            "type":"object",
    43            "properties": {
    44                "foo": {"enum":["foo"]},
    45                "bar": {"enum":["bar"], "required":true}
    46            }
    47        },
    48        "tests": [
    49            {
    50                "description": "both properties are valid",
    51                "data": {"foo":"foo", "bar":"bar"},
    52                "valid": true
    53            },
    54            {
    55                "description": "wrong foo value",
    56                "data": {"foo":"foot", "bar":"bar"},
    57                "valid": false
    58            },
    59            {
    60                "description": "wrong bar value",
    61                "data": {"foo":"foo", "bar":"bart"},
    62                "valid": false
    63            },
    64            {
    65                "description": "missing optional property is valid",
    66                "data": {"bar":"bar"},
    67                "valid": true
    68            },
    69            {
    70                "description": "missing required property is invalid",
    71                "data": {"foo":"foo"},
    72                "valid": false
    73            },
    74            {
    75                "description": "missing all properties is invalid",
    76                "data": {},
    77                "valid": false
    78            }
    79        ]
    80    }
    81]

View as plain text