github.com/kaptinlin/jsonschema@v0.4.6/testdata/JSON-Schema-Test-Suite/tests/draft2019-09/ref.json (about)

     1  [
     2      {
     3          "description": "root pointer ref",
     4          "schema": {
     5              "$schema": "https://json-schema.org/draft/2019-09/schema",
     6              "properties": {
     7                  "foo": {"$ref": "#"}
     8              },
     9              "additionalProperties": false
    10          },
    11          "tests": [
    12              {
    13                  "description": "match",
    14                  "data": {"foo": false},
    15                  "valid": true
    16              },
    17              {
    18                  "description": "recursive match",
    19                  "data": {"foo": {"foo": false}},
    20                  "valid": true
    21              },
    22              {
    23                  "description": "mismatch",
    24                  "data": {"bar": false},
    25                  "valid": false
    26              },
    27              {
    28                  "description": "recursive mismatch",
    29                  "data": {"foo": {"bar": false}},
    30                  "valid": false
    31              }
    32          ]
    33      },
    34      {
    35          "description": "relative pointer ref to object",
    36          "schema": {
    37              "$schema": "https://json-schema.org/draft/2019-09/schema",
    38              "properties": {
    39                  "foo": {"type": "integer"},
    40                  "bar": {"$ref": "#/properties/foo"}
    41              }
    42          },
    43          "tests": [
    44              {
    45                  "description": "match",
    46                  "data": {"bar": 3},
    47                  "valid": true
    48              },
    49              {
    50                  "description": "mismatch",
    51                  "data": {"bar": true},
    52                  "valid": false
    53              }
    54          ]
    55      },
    56      {
    57          "description": "relative pointer ref to array",
    58          "schema": {
    59              "$schema": "https://json-schema.org/draft/2019-09/schema",
    60              "items": [
    61                  {"type": "integer"},
    62                  {"$ref": "#/items/0"}
    63              ]
    64          },
    65          "tests": [
    66              {
    67                  "description": "match array",
    68                  "data": [1, 2],
    69                  "valid": true
    70              },
    71              {
    72                  "description": "mismatch array",
    73                  "data": [1, "foo"],
    74                  "valid": false
    75              }
    76          ]
    77      },
    78      {
    79          "description": "escaped pointer ref",
    80          "schema": {
    81              "$schema": "https://json-schema.org/draft/2019-09/schema",
    82              "$defs": {
    83                  "tilde~field": {"type": "integer"},
    84                  "slash/field": {"type": "integer"},
    85                  "percent%field": {"type": "integer"}
    86              },
    87              "properties": {
    88                  "tilde": {"$ref": "#/$defs/tilde~0field"},
    89                  "slash": {"$ref": "#/$defs/slash~1field"},
    90                  "percent": {"$ref": "#/$defs/percent%25field"}
    91              }
    92          },
    93          "tests": [
    94              {
    95                  "description": "slash invalid",
    96                  "data": {"slash": "aoeu"},
    97                  "valid": false
    98              },
    99              {
   100                  "description": "tilde invalid",
   101                  "data": {"tilde": "aoeu"},
   102                  "valid": false
   103              },
   104              {
   105                  "description": "percent invalid",
   106                  "data": {"percent": "aoeu"},
   107                  "valid": false
   108              },
   109              {
   110                  "description": "slash valid",
   111                  "data": {"slash": 123},
   112                  "valid": true
   113              },
   114              {
   115                  "description": "tilde valid",
   116                  "data": {"tilde": 123},
   117                  "valid": true
   118              },
   119              {
   120                  "description": "percent valid",
   121                  "data": {"percent": 123},
   122                  "valid": true
   123              }
   124          ]
   125      },
   126      {
   127          "description": "nested refs",
   128          "schema": {
   129              "$schema": "https://json-schema.org/draft/2019-09/schema",
   130              "$defs": {
   131                  "a": {"type": "integer"},
   132                  "b": {"$ref": "#/$defs/a"},
   133                  "c": {"$ref": "#/$defs/b"}
   134              },
   135              "$ref": "#/$defs/c"
   136          },
   137          "tests": [
   138              {
   139                  "description": "nested ref valid",
   140                  "data": 5,
   141                  "valid": true
   142              },
   143              {
   144                  "description": "nested ref invalid",
   145                  "data": "a",
   146                  "valid": false
   147              }
   148          ]
   149      },
   150      {
   151          "description": "ref applies alongside sibling keywords",
   152          "schema": {
   153              "$schema": "https://json-schema.org/draft/2019-09/schema",
   154              "$defs": {
   155                  "reffed": {
   156                      "type": "array"
   157                  }
   158              },
   159              "properties": {
   160                  "foo": {
   161                      "$ref": "#/$defs/reffed",
   162                      "maxItems": 2
   163                  }
   164              }
   165          },
   166          "tests": [
   167              {
   168                  "description": "ref valid, maxItems valid",
   169                  "data": { "foo": [] },
   170                  "valid": true
   171              },
   172              {
   173                  "description": "ref valid, maxItems invalid",
   174                  "data": { "foo": [1, 2, 3] },
   175                  "valid": false
   176              },
   177              {
   178                  "description": "ref invalid",
   179                  "data": { "foo": "string" },
   180                  "valid": false
   181              }
   182          ]
   183      },
   184      {
   185          "description": "remote ref, containing refs itself",
   186          "schema": {
   187              "$schema": "https://json-schema.org/draft/2019-09/schema",
   188              "$ref": "https://json-schema.org/draft/2019-09/schema"
   189          },
   190          "tests": [
   191              {
   192                  "description": "remote ref valid",
   193                  "data": {"minLength": 1},
   194                  "valid": true
   195              },
   196              {
   197                  "description": "remote ref invalid",
   198                  "data": {"minLength": -1},
   199                  "valid": false
   200              }
   201          ]
   202      },
   203      {
   204          "description": "property named $ref that is not a reference",
   205          "schema": {
   206              "$schema": "https://json-schema.org/draft/2019-09/schema",
   207              "properties": {
   208                  "$ref": {"type": "string"}
   209              }
   210          },
   211          "tests": [
   212              {
   213                  "description": "property named $ref valid",
   214                  "data": {"$ref": "a"},
   215                  "valid": true
   216              },
   217              {
   218                  "description": "property named $ref invalid",
   219                  "data": {"$ref": 2},
   220                  "valid": false
   221              }
   222          ]
   223      },
   224      {
   225          "description": "property named $ref, containing an actual $ref",
   226          "schema": {
   227              "$schema": "https://json-schema.org/draft/2019-09/schema",
   228              "properties": {
   229                  "$ref": {"$ref": "#/$defs/is-string"}
   230              },
   231              "$defs": {
   232                  "is-string": {
   233                      "type": "string"
   234                  }
   235              }
   236          },
   237          "tests": [
   238              {
   239                  "description": "property named $ref valid",
   240                  "data": {"$ref": "a"},
   241                  "valid": true
   242              },
   243              {
   244                  "description": "property named $ref invalid",
   245                  "data": {"$ref": 2},
   246                  "valid": false
   247              }
   248          ]
   249      },
   250      {
   251          "description": "$ref to boolean schema true",
   252          "schema": {
   253              "$schema": "https://json-schema.org/draft/2019-09/schema",
   254              "$ref": "#/$defs/bool",
   255              "$defs": {
   256                  "bool": true
   257              }
   258          },
   259          "tests": [
   260              {
   261                  "description": "any value is valid",
   262                  "data": "foo",
   263                  "valid": true
   264              }
   265          ]
   266      },
   267      {
   268          "description": "$ref to boolean schema false",
   269          "schema": {
   270              "$schema": "https://json-schema.org/draft/2019-09/schema",
   271              "$ref": "#/$defs/bool",
   272              "$defs": {
   273                  "bool": false
   274              }
   275          },
   276          "tests": [
   277              {
   278                  "description": "any value is invalid",
   279                  "data": "foo",
   280                  "valid": false
   281              }
   282          ]
   283      },
   284      {
   285          "description": "Recursive references between schemas",
   286          "schema": {
   287              "$schema": "https://json-schema.org/draft/2019-09/schema",
   288              "$id": "http://localhost:1234/draft2019-09/tree",
   289              "description": "tree of nodes",
   290              "type": "object",
   291              "properties": {
   292                  "meta": {"type": "string"},
   293                  "nodes": {
   294                      "type": "array",
   295                      "items": {"$ref": "node"}
   296                  }
   297              },
   298              "required": ["meta", "nodes"],
   299              "$defs": {
   300                  "node": {
   301                      "$id": "http://localhost:1234/draft2019-09/node",
   302                      "description": "node",
   303                      "type": "object",
   304                      "properties": {
   305                          "value": {"type": "number"},
   306                          "subtree": {"$ref": "tree"}
   307                      },
   308                      "required": ["value"]
   309                  }
   310              }
   311          },
   312          "tests": [
   313              {
   314                  "description": "valid tree",
   315                  "data": {
   316                      "meta": "root",
   317                      "nodes": [
   318                          {
   319                              "value": 1,
   320                              "subtree": {
   321                                  "meta": "child",
   322                                  "nodes": [
   323                                      {"value": 1.1},
   324                                      {"value": 1.2}
   325                                  ]
   326                              }
   327                          },
   328                          {
   329                              "value": 2,
   330                              "subtree": {
   331                                  "meta": "child",
   332                                  "nodes": [
   333                                      {"value": 2.1},
   334                                      {"value": 2.2}
   335                                  ]
   336                              }
   337                          }
   338                      ]
   339                  },
   340                  "valid": true
   341              },
   342              {
   343                  "description": "invalid tree",
   344                  "data": {
   345                      "meta": "root",
   346                      "nodes": [
   347                          {
   348                              "value": 1,
   349                              "subtree": {
   350                                  "meta": "child",
   351                                  "nodes": [
   352                                      {"value": "string is invalid"},
   353                                      {"value": 1.2}
   354                                  ]
   355                              }
   356                          },
   357                          {
   358                              "value": 2,
   359                              "subtree": {
   360                                  "meta": "child",
   361                                  "nodes": [
   362                                      {"value": 2.1},
   363                                      {"value": 2.2}
   364                                  ]
   365                              }
   366                          }
   367                      ]
   368                  },
   369                  "valid": false
   370              }
   371          ]
   372      },
   373      {
   374          "description": "refs with quote",
   375          "schema": {
   376              "$schema": "https://json-schema.org/draft/2019-09/schema",
   377              "properties": {
   378                  "foo\"bar": {"$ref": "#/$defs/foo%22bar"}
   379              },
   380              "$defs": {
   381                  "foo\"bar": {"type": "number"}
   382              }
   383          },
   384          "tests": [
   385              {
   386                  "description": "object with numbers is valid",
   387                  "data": {
   388                      "foo\"bar": 1
   389                  },
   390                  "valid": true
   391              },
   392              {
   393                  "description": "object with strings is invalid",
   394                  "data": {
   395                      "foo\"bar": "1"
   396                  },
   397                  "valid": false
   398              }
   399          ]
   400      },
   401      {
   402          "description": "ref creates new scope when adjacent to keywords",
   403          "schema": {
   404              "$schema": "https://json-schema.org/draft/2019-09/schema",
   405              "$defs": {
   406                  "A": {
   407                      "unevaluatedProperties": false
   408                  }
   409              },
   410              "properties": {
   411                  "prop1": {
   412                      "type": "string"
   413                  }
   414              },
   415              "$ref": "#/$defs/A"
   416          },
   417          "tests": [
   418              {
   419                  "description": "referenced subschema doesn't see annotations from properties",
   420                  "data": {
   421                      "prop1": "match"
   422                  },
   423                  "valid": false
   424              }
   425          ]
   426      },
   427      {
   428          "description": "naive replacement of $ref with its destination is not correct",
   429          "schema": {
   430              "$schema": "https://json-schema.org/draft/2019-09/schema",
   431              "$defs": {
   432                  "a_string": { "type": "string" }
   433              },
   434              "enum": [
   435                  { "$ref": "#/$defs/a_string" }
   436              ]
   437          },
   438          "tests": [
   439              {
   440                  "description": "do not evaluate the $ref inside the enum, matching any string",
   441                  "data": "this is a string",
   442                  "valid": false
   443              },
   444              {
   445                  "description": "do not evaluate the $ref inside the enum, definition exact match",
   446                  "data": { "type": "string" },
   447                  "valid": false
   448              },
   449              {
   450                  "description": "match the enum exactly",
   451                  "data": { "$ref": "#/$defs/a_string" },
   452                  "valid": true
   453              }
   454          ]
   455      },
   456      {
   457          "description": "refs with relative uris and defs",
   458          "schema": {
   459              "$schema": "https://json-schema.org/draft/2019-09/schema",
   460              "$id": "http://example.com/schema-relative-uri-defs1.json",
   461              "properties": {
   462                  "foo": {
   463                      "$id": "schema-relative-uri-defs2.json",
   464                      "$defs": {
   465                          "inner": {
   466                              "properties": {
   467                                  "bar": { "type": "string" }
   468                              }
   469                          }
   470                      },
   471                      "$ref": "#/$defs/inner"
   472                  }
   473              },
   474              "$ref": "schema-relative-uri-defs2.json"
   475          },
   476          "tests": [
   477              {
   478                  "description": "invalid on inner field",
   479                  "data": {
   480                      "foo": {
   481                          "bar": 1
   482                      },
   483                      "bar": "a"
   484                  },
   485                  "valid": false
   486              },
   487              {
   488                  "description": "invalid on outer field",
   489                  "data": {
   490                      "foo": {
   491                          "bar": "a"
   492                      },
   493                      "bar": 1
   494                  },
   495                  "valid": false
   496              },
   497              {
   498                  "description": "valid on both fields",
   499                  "data": {
   500                      "foo": {
   501                          "bar": "a"
   502                      },
   503                      "bar": "a"
   504                  },
   505                  "valid": true
   506              }
   507          ]
   508      },
   509      {
   510          "description": "relative refs with absolute uris and defs",
   511          "schema": {
   512              "$schema": "https://json-schema.org/draft/2019-09/schema",
   513              "$id": "http://example.com/schema-refs-absolute-uris-defs1.json",
   514              "properties": {
   515                  "foo": {
   516                      "$id": "http://example.com/schema-refs-absolute-uris-defs2.json",
   517                      "$defs": {
   518                          "inner": {
   519                              "properties": {
   520                                  "bar": { "type": "string" }
   521                              }
   522                          }
   523                      },
   524                      "$ref": "#/$defs/inner"
   525                  }
   526              },
   527              "$ref": "schema-refs-absolute-uris-defs2.json"
   528          },
   529          "tests": [
   530              {
   531                  "description": "invalid on inner field",
   532                  "data": {
   533                      "foo": {
   534                          "bar": 1
   535                      },
   536                      "bar": "a"
   537                  },
   538                  "valid": false
   539              },
   540              {
   541                  "description": "invalid on outer field",
   542                  "data": {
   543                      "foo": {
   544                          "bar": "a"
   545                      },
   546                      "bar": 1
   547                  },
   548                  "valid": false
   549              },
   550              {
   551                  "description": "valid on both fields",
   552                  "data": {
   553                      "foo": {
   554                          "bar": "a"
   555                      },
   556                      "bar": "a"
   557                  },
   558                  "valid": true
   559              }
   560          ]
   561      },
   562      {
   563          "description": "$id must be resolved against nearest parent, not just immediate parent",
   564          "schema": {
   565              "$schema": "https://json-schema.org/draft/2019-09/schema",
   566              "$id": "http://example.com/a.json",
   567              "$defs": {
   568                  "x": {
   569                      "$id": "http://example.com/b/c.json",
   570                      "not": {
   571                          "$defs": {
   572                              "y": {
   573                                  "$id": "d.json",
   574                                  "type": "number"
   575                              }
   576                          }
   577                      }
   578                  }
   579              },
   580              "allOf": [
   581                  {
   582                      "$ref": "http://example.com/b/d.json"
   583                  }
   584              ]
   585          },
   586          "tests": [
   587              {
   588                  "description": "number is valid",
   589                  "data": 1,
   590                  "valid": true
   591              },
   592              {
   593                  "description": "non-number is invalid",
   594                  "data": "a",
   595                  "valid": false
   596              }
   597          ]
   598      },
   599      {
   600          "description": "order of evaluation: $id and $ref",
   601          "schema": {
   602              "$schema": "https://json-schema.org/draft/2019-09/schema",
   603              "$comment": "$id must be evaluated before $ref to get the proper $ref destination",
   604              "$id": "https://example.com/draft2019-09/ref-and-id1/base.json",
   605              "$ref": "int.json",
   606              "$defs": {
   607                  "bigint": {
   608                      "$comment": "canonical uri: https://example.com/draft2019-09/ref-and-id1/int.json",
   609                      "$id": "int.json",
   610                      "maximum": 10
   611                  },
   612                  "smallint": {
   613                      "$comment": "canonical uri: https://example.com/draft2019-09/ref-and-id1-int.json",
   614                      "$id": "/draft2019-09/ref-and-id1-int.json",
   615                      "maximum": 2
   616                  }
   617              }
   618          },
   619          "tests": [
   620              {
   621                  "description": "data is valid against first definition",
   622                  "data": 5,
   623                  "valid": true
   624              },
   625              {
   626                  "description": "data is invalid against first definition",
   627                  "data": 50,
   628                  "valid": false
   629              }
   630          ]
   631      },
   632      {
   633          "description": "order of evaluation: $id and $anchor and $ref",
   634          "schema": {
   635              "$schema": "https://json-schema.org/draft/2019-09/schema",
   636              "$comment": "$id must be evaluated before $ref to get the proper $ref destination",
   637              "$id": "https://example.com/draft2019-09/ref-and-id2/base.json",
   638              "$ref": "#bigint",
   639              "$defs": {
   640                  "bigint": {
   641                      "$comment": "canonical uri: https://example.com/draft2019-09/ref-and-id2/base.json#/$defs/bigint; another valid uri for this location: https://example.com/ref-and-id2/base.json#bigint",
   642                      "$anchor": "bigint",
   643                      "maximum": 10
   644                  },
   645                  "smallint": {
   646                      "$comment": "canonical uri: https://example.com/draft2019-09/ref-and-id2#/$defs/smallint; another valid uri for this location: https://example.com/ref-and-id2/#bigint",
   647                      "$id": "/draft2019-09/ref-and-id2/",
   648                      "$anchor": "bigint",
   649                      "maximum": 2
   650                  }
   651              }
   652          },
   653          "tests": [
   654              {
   655                  "description": "data is valid against first definition",
   656                  "data": 5,
   657                  "valid": true
   658              },
   659              {
   660                  "description": "data is invalid against first definition",
   661                  "data": 50,
   662                  "valid": false
   663              }
   664          ]
   665      },
   666      {
   667          "description": "simple URN base URI with $ref via the URN",
   668          "schema": {
   669              "$schema": "https://json-schema.org/draft/2019-09/schema",
   670              "$comment": "URIs do not have to have HTTP(s) schemes",
   671              "$id": "urn:uuid:deadbeef-1234-ffff-ffff-4321feebdaed",
   672              "minimum": 30,
   673              "properties": {
   674                  "foo": {"$ref": "urn:uuid:deadbeef-1234-ffff-ffff-4321feebdaed"}
   675              }
   676          },
   677          "tests": [
   678              {
   679                  "description": "valid under the URN IDed schema",
   680                  "data": {"foo": 37},
   681                  "valid": true
   682              },
   683              {
   684                  "description": "invalid under the URN IDed schema",
   685                  "data": {"foo": 12},
   686                  "valid": false
   687              }
   688          ]
   689      },
   690      {
   691          "description": "simple URN base URI with JSON pointer",
   692          "schema": {
   693              "$schema": "https://json-schema.org/draft/2019-09/schema",
   694              "$comment": "URIs do not have to have HTTP(s) schemes",
   695              "$id": "urn:uuid:deadbeef-1234-00ff-ff00-4321feebdaed",
   696              "properties": {
   697                  "foo": {"$ref": "#/$defs/bar"}
   698              },
   699              "$defs": {
   700                  "bar": {"type": "string"}
   701              }
   702          },
   703          "tests": [
   704              {
   705                  "description": "a string is valid",
   706                  "data": {"foo": "bar"},
   707                  "valid": true
   708              },
   709              {
   710                  "description": "a non-string is invalid",
   711                  "data": {"foo": 12},
   712                  "valid": false
   713              }
   714          ]
   715      },
   716      {
   717          "description": "URN base URI with NSS",
   718          "schema": {
   719              "$schema": "https://json-schema.org/draft/2019-09/schema",
   720              "$comment": "RFC 8141 §2.2",
   721              "$id": "urn:example:1/406/47452/2",
   722              "properties": {
   723                  "foo": {"$ref": "#/$defs/bar"}
   724              },
   725              "$defs": {
   726                  "bar": {"type": "string"}
   727              }
   728          },
   729          "tests": [
   730              {
   731                  "description": "a string is valid",
   732                  "data": {"foo": "bar"},
   733                  "valid": true
   734              },
   735              {
   736                  "description": "a non-string is invalid",
   737                  "data": {"foo": 12},
   738                  "valid": false
   739              }
   740          ]
   741      },
   742      {
   743          "description": "URN base URI with r-component",
   744          "schema": {
   745              "$schema": "https://json-schema.org/draft/2019-09/schema",
   746              "$comment": "RFC 8141 §2.3.1",
   747              "$id": "urn:example:foo-bar-baz-qux?+CCResolve:cc=uk",
   748              "properties": {
   749                  "foo": {"$ref": "#/$defs/bar"}
   750              },
   751              "$defs": {
   752                  "bar": {"type": "string"}
   753              }
   754          },
   755          "tests": [
   756              {
   757                  "description": "a string is valid",
   758                  "data": {"foo": "bar"},
   759                  "valid": true
   760              },
   761              {
   762                  "description": "a non-string is invalid",
   763                  "data": {"foo": 12},
   764                  "valid": false
   765              }
   766          ]
   767      },
   768      {
   769          "description": "URN base URI with q-component",
   770          "schema": {
   771              "$schema": "https://json-schema.org/draft/2019-09/schema",
   772              "$comment": "RFC 8141 §2.3.2",
   773              "$id": "urn:example:weather?=op=map&lat=39.56&lon=-104.85&datetime=1969-07-21T02:56:15Z",
   774              "properties": {
   775                  "foo": {"$ref": "#/$defs/bar"}
   776              },
   777              "$defs": {
   778                  "bar": {"type": "string"}
   779              }
   780          },
   781          "tests": [
   782              {
   783                  "description": "a string is valid",
   784                  "data": {"foo": "bar"},
   785                  "valid": true
   786              },
   787              {
   788                  "description": "a non-string is invalid",
   789                  "data": {"foo": 12},
   790                  "valid": false
   791              }
   792          ]
   793      },
   794      {
   795          "description": "URN base URI with URN and JSON pointer ref",
   796          "schema": {
   797              "$schema": "https://json-schema.org/draft/2019-09/schema",
   798              "$id": "urn:uuid:deadbeef-1234-0000-0000-4321feebdaed",
   799              "properties": {
   800                  "foo": {"$ref": "urn:uuid:deadbeef-1234-0000-0000-4321feebdaed#/$defs/bar"}
   801              },
   802              "$defs": {
   803                  "bar": {"type": "string"}
   804              }
   805          },
   806          "tests": [
   807              {
   808                  "description": "a string is valid",
   809                  "data": {"foo": "bar"},
   810                  "valid": true
   811              },
   812              {
   813                  "description": "a non-string is invalid",
   814                  "data": {"foo": 12},
   815                  "valid": false
   816              }
   817          ]
   818      },
   819      {
   820          "description": "URN base URI with URN and anchor ref",
   821          "schema": {
   822              "$schema": "https://json-schema.org/draft/2019-09/schema",
   823              "$id": "urn:uuid:deadbeef-1234-ff00-00ff-4321feebdaed",
   824              "properties": {
   825                  "foo": {"$ref": "urn:uuid:deadbeef-1234-ff00-00ff-4321feebdaed#something"}
   826              },
   827              "$defs": {
   828                  "bar": {
   829                      "$anchor": "something",
   830                      "type": "string"
   831                  }
   832              }
   833          },
   834          "tests": [
   835              {
   836                  "description": "a string is valid",
   837                  "data": {"foo": "bar"},
   838                  "valid": true
   839              },
   840              {
   841                  "description": "a non-string is invalid",
   842                  "data": {"foo": 12},
   843                  "valid": false
   844              }
   845          ]
   846      },
   847      {
   848          "description": "URN ref with nested pointer ref",
   849          "schema": {
   850              "$schema": "https://json-schema.org/draft/2019-09/schema",
   851              "$ref": "urn:uuid:deadbeef-4321-ffff-ffff-1234feebdaed",
   852              "$defs": {
   853                  "foo": {
   854                      "$id": "urn:uuid:deadbeef-4321-ffff-ffff-1234feebdaed",
   855                      "$defs": {"bar": {"type": "string"}},
   856                      "$ref": "#/$defs/bar"
   857                  }
   858              }
   859          },
   860          "tests": [
   861              {
   862                  "description": "a string is valid",
   863                  "data": "bar",
   864                  "valid": true
   865              },
   866              {
   867                  "description": "a non-string is invalid",
   868                  "data": 12,
   869                  "valid": false
   870              }
   871          ]
   872      },
   873      {
   874          "description": "ref to if",
   875          "schema": {
   876              "$schema": "https://json-schema.org/draft/2019-09/schema",
   877              "$ref": "http://example.com/ref/if",
   878              "if": {
   879                  "$id": "http://example.com/ref/if",
   880                  "type": "integer"
   881              }
   882          },
   883          "tests": [
   884              {
   885                  "description": "a non-integer is invalid due to the $ref",
   886                  "data": "foo",
   887                  "valid": false
   888              },
   889              {
   890                  "description": "an integer is valid",
   891                  "data": 12,
   892                  "valid": true
   893              }
   894          ]
   895      },
   896      {
   897          "description": "ref to then",
   898          "schema": {
   899              "$schema": "https://json-schema.org/draft/2019-09/schema",
   900              "$ref": "http://example.com/ref/then",
   901              "then": {
   902                  "$id": "http://example.com/ref/then",
   903                  "type": "integer"
   904              }
   905          },
   906          "tests": [
   907              {
   908                  "description": "a non-integer is invalid due to the $ref",
   909                  "data": "foo",
   910                  "valid": false
   911              },
   912              {
   913                  "description": "an integer is valid",
   914                  "data": 12,
   915                  "valid": true
   916              }
   917          ]
   918      },
   919      {
   920          "description": "ref to else",
   921          "schema": {
   922              "$schema": "https://json-schema.org/draft/2019-09/schema",
   923              "$ref": "http://example.com/ref/else",
   924              "else": {
   925                  "$id": "http://example.com/ref/else",
   926                  "type": "integer"
   927              }
   928          },
   929          "tests": [
   930              {
   931                  "description": "a non-integer is invalid due to the $ref",
   932                  "data": "foo",
   933                  "valid": false
   934              },
   935              {
   936                  "description": "an integer is valid",
   937                  "data": 12,
   938                  "valid": true
   939              }
   940          ]
   941      },
   942      {
   943           "description": "ref with absolute-path-reference",
   944           "schema": {
   945              "$schema": "https://json-schema.org/draft/2019-09/schema",
   946               "$id": "http://example.com/ref/absref.json",
   947               "$defs": {
   948                   "a": {
   949                       "$id": "http://example.com/ref/absref/foobar.json",
   950                       "type": "number"
   951                   },
   952                   "b": {
   953                       "$id": "http://example.com/absref/foobar.json",
   954                       "type": "string"
   955                   }
   956               },
   957               "$ref": "/absref/foobar.json"
   958           },
   959           "tests": [
   960               {
   961                   "description": "a string is valid",
   962                   "data": "foo",
   963                   "valid": true
   964               },
   965               {
   966                   "description": "an integer is invalid",
   967                   "data": 12,
   968                   "valid": false
   969               }
   970           ]
   971       },
   972       {
   973           "description": "$id with file URI still resolves pointers - *nix",
   974           "schema": {
   975              "$schema": "https://json-schema.org/draft/2019-09/schema",
   976               "$id": "file:///folder/file.json",
   977               "$defs": {
   978                   "foo": {
   979                       "type": "number"
   980                   }
   981               },
   982               "$ref": "#/$defs/foo"
   983           },
   984           "tests": [
   985               {
   986                   "description": "number is valid",
   987                   "data": 1,
   988                   "valid": true
   989               },
   990               {
   991                   "description": "non-number is invalid",
   992                   "data": "a",
   993                   "valid": false
   994               }
   995           ]
   996       },
   997       {
   998           "description": "$id with file URI still resolves pointers - windows",
   999           "schema": {
  1000              "$schema": "https://json-schema.org/draft/2019-09/schema",
  1001               "$id": "file:///c:/folder/file.json",
  1002               "$defs": {
  1003                   "foo": {
  1004                       "type": "number"
  1005                   }
  1006               },
  1007               "$ref": "#/$defs/foo"
  1008           },
  1009           "tests": [
  1010               {
  1011                   "description": "number is valid",
  1012                   "data": 1,
  1013                   "valid": true
  1014               },
  1015               {
  1016                   "description": "non-number is invalid",
  1017                   "data": "a",
  1018                   "valid": false
  1019               }
  1020           ]
  1021       },
  1022       {
  1023           "description": "empty tokens in $ref json-pointer",
  1024           "schema": {
  1025              "$schema": "https://json-schema.org/draft/2019-09/schema",
  1026               "$defs": {
  1027                   "": {
  1028                       "$defs": {
  1029                           "": { "type": "number" }
  1030                       }
  1031                   } 
  1032               },
  1033               "allOf": [
  1034                   {
  1035                       "$ref": "#/$defs//$defs/"
  1036                   }
  1037               ]
  1038           },
  1039           "tests": [
  1040               {
  1041                   "description": "number is valid",
  1042                   "data": 1,
  1043                   "valid": true
  1044               },
  1045               {
  1046                   "description": "non-number is invalid",
  1047                   "data": "a",
  1048                   "valid": false
  1049               }
  1050           ]
  1051       },
  1052       {
  1053          "description": "$ref with $recursiveAnchor",
  1054          "schema": {
  1055              "$schema": "https://json-schema.org/draft/2019-09/schema",
  1056              "$id": "https://example.com/schemas/unevaluated-items-are-disallowed",
  1057              "$ref": "/schemas/unevaluated-items-are-allowed",
  1058              "$recursiveAnchor": true,
  1059              "unevaluatedItems": false,
  1060              "$defs": {
  1061                  "/schemas/unevaluated-items-are-allowed": {
  1062                      "$schema": "https://json-schema.org/draft/2019-09/schema",
  1063                      "$id": "/schemas/unevaluated-items-are-allowed",
  1064                      "$recursiveAnchor": true,
  1065                      "type": "array",
  1066                      "items": [
  1067                          {
  1068                              "type": "string"
  1069                          },
  1070                          {
  1071                              "$ref": "#"
  1072                          }
  1073                      ]
  1074                  }
  1075              }
  1076          },
  1077          "tests": [
  1078              {
  1079                  "description": "extra items allowed for inner arrays",
  1080                  "data" : ["foo",["bar" , [] , 8]],
  1081                  "valid": true
  1082              },
  1083              {
  1084                  "description": "extra items disallowed for root",
  1085                  "data" : ["foo",["bar" , [] , 8], 8],
  1086                  "valid": false
  1087              }
  1088          ]
  1089      }
  1090  ]