...

Text file src/github.com/qri-io/jsonschema/testdata/draft2019-09/dependentRequired.json

Documentation: github.com/qri-io/jsonschema/testdata/draft2019-09

     1[
     2    {
     3        "description": "single dependency",
     4        "schema": {"dependentRequired": {"bar": ["foo"]}},
     5        "tests": [
     6            {
     7                "description": "neither",
     8                "data": {},
     9                "valid": true
    10            },
    11            {
    12                "description": "nondependant",
    13                "data": {"foo": 1},
    14                "valid": true
    15            },
    16            {
    17                "description": "with dependency",
    18                "data": {"foo": 1, "bar": 2},
    19                "valid": true
    20            },
    21            {
    22                "description": "missing dependency",
    23                "data": {"bar": 2},
    24                "valid": false
    25            },
    26            {
    27                "description": "ignores arrays",
    28                "data": ["bar"],
    29                "valid": true
    30            },
    31            {
    32                "description": "ignores strings",
    33                "data": "foobar",
    34                "valid": true
    35            },
    36            {
    37                "description": "ignores other non-objects",
    38                "data": 12,
    39                "valid": true
    40            }
    41        ]
    42    },
    43    {
    44        "description": "empty dependents",
    45        "schema": {"dependentRequired": {"bar": []}},
    46        "tests": [
    47            {
    48                "description": "empty object",
    49                "data": {},
    50                "valid": true
    51            },
    52            {
    53                "description": "object with one property",
    54                "data": {"bar": 2},
    55                "valid": true
    56            },
    57            {
    58                "description": "non-object is valid",
    59                "data": 1,
    60                "valid": true
    61            }
    62        ]
    63    },
    64    {
    65        "description": "multiple dependents required",
    66        "schema": {"dependentRequired": {"quux": ["foo", "bar"]}},
    67        "tests": [
    68            {
    69                "description": "neither",
    70                "data": {},
    71                "valid": true
    72            },
    73            {
    74                "description": "nondependants",
    75                "data": {"foo": 1, "bar": 2},
    76                "valid": true
    77            },
    78            {
    79                "description": "with dependencies",
    80                "data": {"foo": 1, "bar": 2, "quux": 3},
    81                "valid": true
    82            },
    83            {
    84                "description": "missing dependency",
    85                "data": {"foo": 1, "quux": 2},
    86                "valid": false
    87            },
    88            {
    89                "description": "missing other dependency",
    90                "data": {"bar": 1, "quux": 2},
    91                "valid": false
    92            },
    93            {
    94                "description": "missing both dependencies",
    95                "data": {"quux": 1},
    96                "valid": false
    97            }
    98        ]
    99    },
   100    {
   101        "description": "dependencies with escaped characters",
   102        "schema": {
   103            "dependentRequired": {
   104                "foo\nbar": ["foo\rbar"],
   105                "foo\"bar": ["foo'bar"]
   106            }
   107        },
   108        "tests": [
   109            {
   110                "description": "CRLF",
   111                "data": {
   112                    "foo\nbar": 1,
   113                    "foo\rbar": 2
   114                },
   115                "valid": true
   116            },
   117            {
   118                "description": "quoted quotes",
   119                "data": {
   120                    "foo'bar": 1,
   121                    "foo\"bar": 2
   122                },
   123                "valid": true
   124            },
   125            {
   126                "description": "CRLF missing dependent",
   127                "data": {
   128                    "foo\nbar": 1,
   129                    "foo": 2
   130                },
   131                "valid": false
   132            },
   133            {
   134                "description": "quoted quotes missing dependent",
   135                "data": {
   136                    "foo\"bar": 2
   137                },
   138                "valid": false
   139            }
   140        ]
   141    }
   142]

View as plain text