cuelang.org/go@v0.13.0/encoding/jsonschema/testdata/external/tests/draft2020-12/ref.json (about)

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