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

     1  [
     2  	{
     3  		"description": "remote ref",
     4  		"schema": {
     5  			"$schema": "https://json-schema.org/draft/2020-12/schema",
     6  			"$ref": "http://localhost:1234/draft2020-12/integer.json"
     7  		},
     8  		"skip": {
     9  			"v2": "extract error: cannot compile resulting schema: invalid import path: \"localhost:1234/draft2020-12/integer.json:integer\":\n    generated.cue:1:8\n",
    10  			"v3": "extract error: cannot compile resulting schema: invalid import path: \"localhost:1234/draft2020-12/integer.json:integer\":\n    generated.cue:1:8\n"
    11  		},
    12  		"tests": [
    13  			{
    14  				"description": "remote ref valid",
    15  				"data": 1,
    16  				"valid": true,
    17  				"skip": {
    18  					"v2": "could not compile schema",
    19  					"v3": "could not compile schema"
    20  				}
    21  			},
    22  			{
    23  				"description": "remote ref invalid",
    24  				"data": "a",
    25  				"valid": false,
    26  				"skip": {
    27  					"v2": "could not compile schema",
    28  					"v3": "could not compile schema"
    29  				}
    30  			}
    31  		]
    32  	},
    33  	{
    34  		"description": "fragment within remote ref",
    35  		"schema": {
    36  			"$schema": "https://json-schema.org/draft/2020-12/schema",
    37  			"$ref": "http://localhost:1234/draft2020-12/subSchemas.json#/$defs/integer"
    38  		},
    39  		"skip": {
    40  			"v2": "extract error: cannot compile resulting schema: invalid import path: \"localhost:1234/draft2020-12/subSchemas.json:subSchemas\":\n    generated.cue:1:8\n",
    41  			"v3": "extract error: cannot compile resulting schema: invalid import path: \"localhost:1234/draft2020-12/subSchemas.json:subSchemas\":\n    generated.cue:1:8\n"
    42  		},
    43  		"tests": [
    44  			{
    45  				"description": "remote fragment valid",
    46  				"data": 1,
    47  				"valid": true,
    48  				"skip": {
    49  					"v2": "could not compile schema",
    50  					"v3": "could not compile schema"
    51  				}
    52  			},
    53  			{
    54  				"description": "remote fragment invalid",
    55  				"data": "a",
    56  				"valid": false,
    57  				"skip": {
    58  					"v2": "could not compile schema",
    59  					"v3": "could not compile schema"
    60  				}
    61  			}
    62  		]
    63  	},
    64  	{
    65  		"description": "anchor within remote ref",
    66  		"schema": {
    67  			"$schema": "https://json-schema.org/draft/2020-12/schema",
    68  			"$ref": "http://localhost:1234/draft2020-12/locationIndependentIdentifier.json#foo"
    69  		},
    70  		"skip": {
    71  			"v2": "extract error: cannot determine CUE location for JSON Schema location id=http://localhost:1234/draft2020-12/locationIndependentIdentifier.json#foo: anchors (foo) not supported",
    72  			"v3": "extract error: cannot determine CUE location for JSON Schema location id=http://localhost:1234/draft2020-12/locationIndependentIdentifier.json#foo: anchors (foo) not supported"
    73  		},
    74  		"tests": [
    75  			{
    76  				"description": "remote anchor valid",
    77  				"data": 1,
    78  				"valid": true,
    79  				"skip": {
    80  					"v2": "could not compile schema",
    81  					"v3": "could not compile schema"
    82  				}
    83  			},
    84  			{
    85  				"description": "remote anchor invalid",
    86  				"data": "a",
    87  				"valid": false,
    88  				"skip": {
    89  					"v2": "could not compile schema",
    90  					"v3": "could not compile schema"
    91  				}
    92  			}
    93  		]
    94  	},
    95  	{
    96  		"description": "ref within remote ref",
    97  		"schema": {
    98  			"$schema": "https://json-schema.org/draft/2020-12/schema",
    99  			"$ref": "http://localhost:1234/draft2020-12/subSchemas.json#/$defs/refToInteger"
   100  		},
   101  		"skip": {
   102  			"v2": "extract error: cannot compile resulting schema: invalid import path: \"localhost:1234/draft2020-12/subSchemas.json:subSchemas\":\n    generated.cue:1:8\n",
   103  			"v3": "extract error: cannot compile resulting schema: invalid import path: \"localhost:1234/draft2020-12/subSchemas.json:subSchemas\":\n    generated.cue:1:8\n"
   104  		},
   105  		"tests": [
   106  			{
   107  				"description": "ref within ref valid",
   108  				"data": 1,
   109  				"valid": true,
   110  				"skip": {
   111  					"v2": "could not compile schema",
   112  					"v3": "could not compile schema"
   113  				}
   114  			},
   115  			{
   116  				"description": "ref within ref invalid",
   117  				"data": "a",
   118  				"valid": false,
   119  				"skip": {
   120  					"v2": "could not compile schema",
   121  					"v3": "could not compile schema"
   122  				}
   123  			}
   124  		]
   125  	},
   126  	{
   127  		"description": "base URI change",
   128  		"schema": {
   129  			"$schema": "https://json-schema.org/draft/2020-12/schema",
   130  			"$id": "http://localhost:1234/draft2020-12/",
   131  			"items": {
   132  				"$id": "baseUriChange/",
   133  				"items": {
   134  					"$ref": "folderInteger.json"
   135  				}
   136  			}
   137  		},
   138  		"skip": {
   139  			"v2": "extract error: cannot compile resulting schema: invalid import path: \"localhost:1234/draft2020-12/baseUriChange/folderInteger.json:folderInteger\":\n    generated.cue:1:8\n",
   140  			"v3": "extract error: cannot compile resulting schema: invalid import path: \"localhost:1234/draft2020-12/baseUriChange/folderInteger.json:folderInteger\":\n    generated.cue:1:8\n"
   141  		},
   142  		"tests": [
   143  			{
   144  				"description": "base URI change ref valid",
   145  				"data": [
   146  					[
   147  						1
   148  					]
   149  				],
   150  				"valid": true,
   151  				"skip": {
   152  					"v2": "could not compile schema",
   153  					"v3": "could not compile schema"
   154  				}
   155  			},
   156  			{
   157  				"description": "base URI change ref invalid",
   158  				"data": [
   159  					[
   160  						"a"
   161  					]
   162  				],
   163  				"valid": false,
   164  				"skip": {
   165  					"v2": "could not compile schema",
   166  					"v3": "could not compile schema"
   167  				}
   168  			}
   169  		]
   170  	},
   171  	{
   172  		"description": "base URI change - change folder",
   173  		"schema": {
   174  			"$schema": "https://json-schema.org/draft/2020-12/schema",
   175  			"$id": "http://localhost:1234/draft2020-12/scope_change_defs1.json",
   176  			"type": "object",
   177  			"properties": {
   178  				"list": {
   179  					"$ref": "baseUriChangeFolder/"
   180  				}
   181  			},
   182  			"$defs": {
   183  				"baz": {
   184  					"$id": "baseUriChangeFolder/",
   185  					"type": "array",
   186  					"items": {
   187  						"$ref": "folderInteger.json"
   188  					}
   189  				}
   190  			}
   191  		},
   192  		"skip": {
   193  			"v2": "extract error: cannot determine package name from import path \"localhost:1234/draft2020-12/baseUriChangeFolder/\"",
   194  			"v3": "extract error: cannot determine package name from import path \"localhost:1234/draft2020-12/baseUriChangeFolder/\""
   195  		},
   196  		"tests": [
   197  			{
   198  				"description": "number is valid",
   199  				"data": {
   200  					"list": [
   201  						1
   202  					]
   203  				},
   204  				"valid": true,
   205  				"skip": {
   206  					"v2": "could not compile schema",
   207  					"v3": "could not compile schema"
   208  				}
   209  			},
   210  			{
   211  				"description": "string is invalid",
   212  				"data": {
   213  					"list": [
   214  						"a"
   215  					]
   216  				},
   217  				"valid": false,
   218  				"skip": {
   219  					"v2": "could not compile schema",
   220  					"v3": "could not compile schema"
   221  				}
   222  			}
   223  		]
   224  	},
   225  	{
   226  		"description": "base URI change - change folder in subschema",
   227  		"schema": {
   228  			"$schema": "https://json-schema.org/draft/2020-12/schema",
   229  			"$id": "http://localhost:1234/draft2020-12/scope_change_defs2.json",
   230  			"type": "object",
   231  			"properties": {
   232  				"list": {
   233  					"$ref": "baseUriChangeFolderInSubschema/#/$defs/bar"
   234  				}
   235  			},
   236  			"$defs": {
   237  				"baz": {
   238  					"$id": "baseUriChangeFolderInSubschema/",
   239  					"$defs": {
   240  						"bar": {
   241  							"type": "array",
   242  							"items": {
   243  								"$ref": "folderInteger.json"
   244  							}
   245  						}
   246  					}
   247  				}
   248  			}
   249  		},
   250  		"skip": {
   251  			"v2": "extract error: cannot determine package name from import path \"localhost:1234/draft2020-12/baseUriChangeFolderInSubschema/\"",
   252  			"v3": "extract error: cannot determine package name from import path \"localhost:1234/draft2020-12/baseUriChangeFolderInSubschema/\""
   253  		},
   254  		"tests": [
   255  			{
   256  				"description": "number is valid",
   257  				"data": {
   258  					"list": [
   259  						1
   260  					]
   261  				},
   262  				"valid": true,
   263  				"skip": {
   264  					"v2": "could not compile schema",
   265  					"v3": "could not compile schema"
   266  				}
   267  			},
   268  			{
   269  				"description": "string is invalid",
   270  				"data": {
   271  					"list": [
   272  						"a"
   273  					]
   274  				},
   275  				"valid": false,
   276  				"skip": {
   277  					"v2": "could not compile schema",
   278  					"v3": "could not compile schema"
   279  				}
   280  			}
   281  		]
   282  	},
   283  	{
   284  		"description": "root ref in remote ref",
   285  		"schema": {
   286  			"$schema": "https://json-schema.org/draft/2020-12/schema",
   287  			"$id": "http://localhost:1234/draft2020-12/object",
   288  			"type": "object",
   289  			"properties": {
   290  				"name": {
   291  					"$ref": "name-defs.json#/$defs/orNull"
   292  				}
   293  			}
   294  		},
   295  		"skip": {
   296  			"v2": "extract error: cannot compile resulting schema: invalid import path: \"localhost:1234/draft2020-12/name-defs.json:schema\":\n    generated.cue:1:8\n",
   297  			"v3": "extract error: cannot compile resulting schema: invalid import path: \"localhost:1234/draft2020-12/name-defs.json:schema\":\n    generated.cue:1:8\n"
   298  		},
   299  		"tests": [
   300  			{
   301  				"description": "string is valid",
   302  				"data": {
   303  					"name": "foo"
   304  				},
   305  				"valid": true,
   306  				"skip": {
   307  					"v2": "could not compile schema",
   308  					"v3": "could not compile schema"
   309  				}
   310  			},
   311  			{
   312  				"description": "null is valid",
   313  				"data": {
   314  					"name": null
   315  				},
   316  				"valid": true,
   317  				"skip": {
   318  					"v2": "could not compile schema",
   319  					"v3": "could not compile schema"
   320  				}
   321  			},
   322  			{
   323  				"description": "object is invalid",
   324  				"data": {
   325  					"name": {
   326  						"name": null
   327  					}
   328  				},
   329  				"valid": false,
   330  				"skip": {
   331  					"v2": "could not compile schema",
   332  					"v3": "could not compile schema"
   333  				}
   334  			}
   335  		]
   336  	},
   337  	{
   338  		"description": "remote ref with ref to defs",
   339  		"schema": {
   340  			"$schema": "https://json-schema.org/draft/2020-12/schema",
   341  			"$id": "http://localhost:1234/draft2020-12/schema-remote-ref-ref-defs1.json",
   342  			"$ref": "ref-and-defs.json"
   343  		},
   344  		"skip": {
   345  			"v2": "extract error: cannot compile resulting schema: invalid import path: \"localhost:1234/draft2020-12/ref-and-defs.json:schema\":\n    generated.cue:1:8\n",
   346  			"v3": "extract error: cannot compile resulting schema: invalid import path: \"localhost:1234/draft2020-12/ref-and-defs.json:schema\":\n    generated.cue:1:8\n"
   347  		},
   348  		"tests": [
   349  			{
   350  				"description": "invalid",
   351  				"data": {
   352  					"bar": 1
   353  				},
   354  				"valid": false,
   355  				"skip": {
   356  					"v2": "could not compile schema",
   357  					"v3": "could not compile schema"
   358  				}
   359  			},
   360  			{
   361  				"description": "valid",
   362  				"data": {
   363  					"bar": "a"
   364  				},
   365  				"valid": true,
   366  				"skip": {
   367  					"v2": "could not compile schema",
   368  					"v3": "could not compile schema"
   369  				}
   370  			}
   371  		]
   372  	},
   373  	{
   374  		"description": "Location-independent identifier in remote ref",
   375  		"schema": {
   376  			"$schema": "https://json-schema.org/draft/2020-12/schema",
   377  			"$ref": "http://localhost:1234/draft2020-12/locationIndependentIdentifier.json#/$defs/refToInteger"
   378  		},
   379  		"skip": {
   380  			"v2": "extract error: cannot compile resulting schema: invalid import path: \"localhost:1234/draft2020-12/locationIndependentIdentifier.json:locationIndependentIdentifier\":\n    generated.cue:1:8\n",
   381  			"v3": "extract error: cannot compile resulting schema: invalid import path: \"localhost:1234/draft2020-12/locationIndependentIdentifier.json:locationIndependentIdentifier\":\n    generated.cue:1:8\n"
   382  		},
   383  		"tests": [
   384  			{
   385  				"description": "integer is valid",
   386  				"data": 1,
   387  				"valid": true,
   388  				"skip": {
   389  					"v2": "could not compile schema",
   390  					"v3": "could not compile schema"
   391  				}
   392  			},
   393  			{
   394  				"description": "string is invalid",
   395  				"data": "foo",
   396  				"valid": false,
   397  				"skip": {
   398  					"v2": "could not compile schema",
   399  					"v3": "could not compile schema"
   400  				}
   401  			}
   402  		]
   403  	},
   404  	{
   405  		"description": "retrieved nested refs resolve relative to their URI not $id",
   406  		"schema": {
   407  			"$schema": "https://json-schema.org/draft/2020-12/schema",
   408  			"$id": "http://localhost:1234/draft2020-12/some-id",
   409  			"properties": {
   410  				"name": {
   411  					"$ref": "nested/foo-ref-string.json"
   412  				}
   413  			}
   414  		},
   415  		"skip": {
   416  			"v2": "extract error: cannot compile resulting schema: invalid import path: \"localhost:1234/draft2020-12/nested/foo-ref-string.json:schema\":\n    generated.cue:1:8\n",
   417  			"v3": "extract error: cannot compile resulting schema: invalid import path: \"localhost:1234/draft2020-12/nested/foo-ref-string.json:schema\":\n    generated.cue:1:8\n"
   418  		},
   419  		"tests": [
   420  			{
   421  				"description": "number is invalid",
   422  				"data": {
   423  					"name": {
   424  						"foo": 1
   425  					}
   426  				},
   427  				"valid": false,
   428  				"skip": {
   429  					"v2": "could not compile schema",
   430  					"v3": "could not compile schema"
   431  				}
   432  			},
   433  			{
   434  				"description": "string is valid",
   435  				"data": {
   436  					"name": {
   437  						"foo": "a"
   438  					}
   439  				},
   440  				"valid": true,
   441  				"skip": {
   442  					"v2": "could not compile schema",
   443  					"v3": "could not compile schema"
   444  				}
   445  			}
   446  		]
   447  	},
   448  	{
   449  		"description": "remote HTTP ref with different $id",
   450  		"schema": {
   451  			"$schema": "https://json-schema.org/draft/2020-12/schema",
   452  			"$ref": "http://localhost:1234/different-id-ref-string.json"
   453  		},
   454  		"skip": {
   455  			"v2": "extract error: cannot compile resulting schema: invalid import path: \"localhost:1234/different-id-ref-string.json:schema\":\n    generated.cue:1:8\n",
   456  			"v3": "extract error: cannot compile resulting schema: invalid import path: \"localhost:1234/different-id-ref-string.json:schema\":\n    generated.cue:1:8\n"
   457  		},
   458  		"tests": [
   459  			{
   460  				"description": "number is invalid",
   461  				"data": 1,
   462  				"valid": false,
   463  				"skip": {
   464  					"v2": "could not compile schema",
   465  					"v3": "could not compile schema"
   466  				}
   467  			},
   468  			{
   469  				"description": "string is valid",
   470  				"data": "foo",
   471  				"valid": true,
   472  				"skip": {
   473  					"v2": "could not compile schema",
   474  					"v3": "could not compile schema"
   475  				}
   476  			}
   477  		]
   478  	},
   479  	{
   480  		"description": "remote HTTP ref with different URN $id",
   481  		"schema": {
   482  			"$schema": "https://json-schema.org/draft/2020-12/schema",
   483  			"$ref": "http://localhost:1234/urn-ref-string.json"
   484  		},
   485  		"skip": {
   486  			"v2": "extract error: cannot compile resulting schema: invalid import path: \"localhost:1234/urn-ref-string.json:schema\":\n    generated.cue:1:8\n",
   487  			"v3": "extract error: cannot compile resulting schema: invalid import path: \"localhost:1234/urn-ref-string.json:schema\":\n    generated.cue:1:8\n"
   488  		},
   489  		"tests": [
   490  			{
   491  				"description": "number is invalid",
   492  				"data": 1,
   493  				"valid": false,
   494  				"skip": {
   495  					"v2": "could not compile schema",
   496  					"v3": "could not compile schema"
   497  				}
   498  			},
   499  			{
   500  				"description": "string is valid",
   501  				"data": "foo",
   502  				"valid": true,
   503  				"skip": {
   504  					"v2": "could not compile schema",
   505  					"v3": "could not compile schema"
   506  				}
   507  			}
   508  		]
   509  	},
   510  	{
   511  		"description": "remote HTTP ref with nested absolute ref",
   512  		"schema": {
   513  			"$schema": "https://json-schema.org/draft/2020-12/schema",
   514  			"$ref": "http://localhost:1234/nested-absolute-ref-to-string.json"
   515  		},
   516  		"skip": {
   517  			"v2": "extract error: cannot compile resulting schema: invalid import path: \"localhost:1234/nested-absolute-ref-to-string.json:schema\":\n    generated.cue:1:8\n",
   518  			"v3": "extract error: cannot compile resulting schema: invalid import path: \"localhost:1234/nested-absolute-ref-to-string.json:schema\":\n    generated.cue:1:8\n"
   519  		},
   520  		"tests": [
   521  			{
   522  				"description": "number is invalid",
   523  				"data": 1,
   524  				"valid": false,
   525  				"skip": {
   526  					"v2": "could not compile schema",
   527  					"v3": "could not compile schema"
   528  				}
   529  			},
   530  			{
   531  				"description": "string is valid",
   532  				"data": "foo",
   533  				"valid": true,
   534  				"skip": {
   535  					"v2": "could not compile schema",
   536  					"v3": "could not compile schema"
   537  				}
   538  			}
   539  		]
   540  	},
   541  	{
   542  		"description": "$ref to $ref finds detached $anchor",
   543  		"schema": {
   544  			"$schema": "https://json-schema.org/draft/2020-12/schema",
   545  			"$ref": "http://localhost:1234/draft2020-12/detached-ref.json#/$defs/foo"
   546  		},
   547  		"skip": {
   548  			"v2": "extract error: cannot compile resulting schema: invalid import path: \"localhost:1234/draft2020-12/detached-ref.json:schema\":\n    generated.cue:1:8\n",
   549  			"v3": "extract error: cannot compile resulting schema: invalid import path: \"localhost:1234/draft2020-12/detached-ref.json:schema\":\n    generated.cue:1:8\n"
   550  		},
   551  		"tests": [
   552  			{
   553  				"description": "number is valid",
   554  				"data": 1,
   555  				"valid": true,
   556  				"skip": {
   557  					"v2": "could not compile schema",
   558  					"v3": "could not compile schema"
   559  				}
   560  			},
   561  			{
   562  				"description": "non-number is invalid",
   563  				"data": "a",
   564  				"valid": false,
   565  				"skip": {
   566  					"v2": "could not compile schema",
   567  					"v3": "could not compile schema"
   568  				}
   569  			}
   570  		]
   571  	}
   572  ]