github.com/kaptinlin/jsonschema@v0.4.6/testdata/JSON-Schema-Test-Suite/tests/draft2020-12/optional/dependencies-compatibility.json (about)

     1  [
     2      {
     3          "description": "single dependency",
     4          "schema": {
     5              "$schema": "https://json-schema.org/draft/2020-12/schema",
     6              "dependencies": {"bar": ["foo"]}
     7          },
     8          "tests": [
     9              {
    10                  "description": "neither",
    11                  "data": {},
    12                  "valid": true
    13              },
    14              {
    15                  "description": "nondependant",
    16                  "data": {"foo": 1},
    17                  "valid": true
    18              },
    19              {
    20                  "description": "with dependency",
    21                  "data": {"foo": 1, "bar": 2},
    22                  "valid": true
    23              },
    24              {
    25                  "description": "missing dependency",
    26                  "data": {"bar": 2},
    27                  "valid": false
    28              },
    29              {
    30                  "description": "ignores arrays",
    31                  "data": ["bar"],
    32                  "valid": true
    33              },
    34              {
    35                  "description": "ignores strings",
    36                  "data": "foobar",
    37                  "valid": true
    38              },
    39              {
    40                  "description": "ignores other non-objects",
    41                  "data": 12,
    42                  "valid": true
    43              }
    44          ]
    45      },
    46      {
    47          "description": "empty dependents",
    48          "schema": {
    49              "$schema": "https://json-schema.org/draft/2020-12/schema",
    50              "dependencies": {"bar": []}
    51          },
    52          "tests": [
    53              {
    54                  "description": "empty object",
    55                  "data": {},
    56                  "valid": true
    57              },
    58              {
    59                  "description": "object with one property",
    60                  "data": {"bar": 2},
    61                  "valid": true
    62              },
    63              {
    64                  "description": "non-object is valid",
    65                  "data": 1,
    66                  "valid": true
    67              }
    68          ]
    69      },
    70      {
    71          "description": "multiple dependents required",
    72          "schema": {
    73              "$schema": "https://json-schema.org/draft/2020-12/schema",
    74              "dependencies": {"quux": ["foo", "bar"]}
    75          },
    76          "tests": [
    77              {
    78                  "description": "neither",
    79                  "data": {},
    80                  "valid": true
    81              },
    82              {
    83                  "description": "nondependants",
    84                  "data": {"foo": 1, "bar": 2},
    85                  "valid": true
    86              },
    87              {
    88                  "description": "with dependencies",
    89                  "data": {"foo": 1, "bar": 2, "quux": 3},
    90                  "valid": true
    91              },
    92              {
    93                  "description": "missing dependency",
    94                  "data": {"foo": 1, "quux": 2},
    95                  "valid": false
    96              },
    97              {
    98                  "description": "missing other dependency",
    99                  "data": {"bar": 1, "quux": 2},
   100                  "valid": false
   101              },
   102              {
   103                  "description": "missing both dependencies",
   104                  "data": {"quux": 1},
   105                  "valid": false
   106              }
   107          ]
   108      },
   109      {
   110          "description": "dependencies with escaped characters",
   111          "schema": {
   112              "$schema": "https://json-schema.org/draft/2020-12/schema",
   113              "dependencies": {
   114                  "foo\nbar": ["foo\rbar"],
   115                  "foo\"bar": ["foo'bar"]
   116              }
   117          },
   118          "tests": [
   119              {
   120                  "description": "CRLF",
   121                  "data": {
   122                      "foo\nbar": 1,
   123                      "foo\rbar": 2
   124                  },
   125                  "valid": true
   126              },
   127              {
   128                  "description": "quoted quotes",
   129                  "data": {
   130                      "foo'bar": 1,
   131                      "foo\"bar": 2
   132                  },
   133                  "valid": true
   134              },
   135              {
   136                  "description": "CRLF missing dependent",
   137                  "data": {
   138                      "foo\nbar": 1,
   139                      "foo": 2
   140                  },
   141                  "valid": false
   142              },
   143              {
   144                  "description": "quoted quotes missing dependent",
   145                  "data": {
   146                      "foo\"bar": 2
   147                  },
   148                  "valid": false
   149              }
   150          ]
   151      },
   152      {
   153          "description": "single schema dependency",
   154          "schema": {
   155              "$schema": "https://json-schema.org/draft/2020-12/schema",
   156              "dependencies": {
   157                  "bar": {
   158                      "properties": {
   159                          "foo": {"type": "integer"},
   160                          "bar": {"type": "integer"}
   161                      }
   162                  }
   163              }
   164          },
   165          "tests": [
   166              {
   167                  "description": "valid",
   168                  "data": {"foo": 1, "bar": 2},
   169                  "valid": true
   170              },
   171              {
   172                  "description": "no dependency",
   173                  "data": {"foo": "quux"},
   174                  "valid": true
   175              },
   176              {
   177                  "description": "wrong type",
   178                  "data": {"foo": "quux", "bar": 2},
   179                  "valid": false
   180              },
   181              {
   182                  "description": "wrong type other",
   183                  "data": {"foo": 2, "bar": "quux"},
   184                  "valid": false
   185              },
   186              {
   187                  "description": "wrong type both",
   188                  "data": {"foo": "quux", "bar": "quux"},
   189                  "valid": false
   190              },
   191              {
   192                  "description": "ignores arrays",
   193                  "data": ["bar"],
   194                  "valid": true
   195              },
   196              {
   197                  "description": "ignores strings",
   198                  "data": "foobar",
   199                  "valid": true
   200              },
   201              {
   202                  "description": "ignores other non-objects",
   203                  "data": 12,
   204                  "valid": true
   205              }
   206          ]
   207      },
   208      {
   209          "description": "boolean subschemas",
   210          "schema": {
   211              "$schema": "https://json-schema.org/draft/2020-12/schema",
   212              "dependencies": {
   213                  "foo": true,
   214                  "bar": false
   215              }
   216          },
   217          "tests": [
   218              {
   219                  "description": "object with property having schema true is valid",
   220                  "data": {"foo": 1},
   221                  "valid": true
   222              },
   223              {
   224                  "description": "object with property having schema false is invalid",
   225                  "data": {"bar": 2},
   226                  "valid": false
   227              },
   228              {
   229                  "description": "object with both properties is invalid",
   230                  "data": {"foo": 1, "bar": 2},
   231                  "valid": false
   232              },
   233              {
   234                  "description": "empty object is valid",
   235                  "data": {},
   236                  "valid": true
   237              }
   238          ]
   239      },
   240      {
   241          "description": "schema dependencies with escaped characters",
   242          "schema": {
   243              "$schema": "https://json-schema.org/draft/2020-12/schema",
   244              "dependencies": {
   245                  "foo\tbar": {"minProperties": 4},
   246                  "foo'bar": {"required": ["foo\"bar"]}
   247              }
   248          },
   249          "tests": [
   250              {
   251                  "description": "quoted tab",
   252                  "data": {
   253                      "foo\tbar": 1,
   254                      "a": 2,
   255                      "b": 3,
   256                      "c": 4
   257                  },
   258                  "valid": true
   259              },
   260              {
   261                  "description": "quoted quote",
   262                  "data": {
   263                      "foo'bar": {"foo\"bar": 1}
   264                  },
   265                  "valid": false
   266              },
   267              {
   268                  "description": "quoted tab invalid under dependent schema",
   269                  "data": {
   270                      "foo\tbar": 1,
   271                      "a": 2
   272                  },
   273                  "valid": false
   274              },
   275              {
   276                  "description": "quoted quote invalid under dependent schema",
   277                  "data": {"foo'bar": 1},
   278                  "valid": false
   279              }
   280          ]
   281      }
   282  ]