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

     1  [
     2  	{
     3  		"description": "remote ref",
     4  		"schema": {
     5  			"$ref": "http://localhost:1234/integer.json"
     6  		},
     7  		"skip": {
     8  			"v2": "extract error: cannot compile resulting schema: invalid import path: \"localhost:1234/integer.json:integer\":\n    generated.cue:1:8\n",
     9  			"v3": "extract error: cannot compile resulting schema: invalid import path: \"localhost:1234/integer.json:integer\":\n    generated.cue:1:8\n"
    10  		},
    11  		"tests": [
    12  			{
    13  				"description": "remote ref valid",
    14  				"data": 1,
    15  				"valid": true,
    16  				"skip": {
    17  					"v2": "could not compile schema",
    18  					"v3": "could not compile schema"
    19  				}
    20  			},
    21  			{
    22  				"description": "remote ref invalid",
    23  				"data": "a",
    24  				"valid": false,
    25  				"skip": {
    26  					"v2": "could not compile schema",
    27  					"v3": "could not compile schema"
    28  				}
    29  			}
    30  		]
    31  	},
    32  	{
    33  		"description": "fragment within remote ref",
    34  		"schema": {
    35  			"$ref": "http://localhost:1234/subSchemas.json#/definitions/integer"
    36  		},
    37  		"skip": {
    38  			"v2": "extract error: cannot compile resulting schema: invalid import path: \"localhost:1234/subSchemas.json:subSchemas\":\n    generated.cue:1:8\n",
    39  			"v3": "extract error: cannot compile resulting schema: invalid import path: \"localhost:1234/subSchemas.json:subSchemas\":\n    generated.cue:1:8\n"
    40  		},
    41  		"tests": [
    42  			{
    43  				"description": "remote fragment valid",
    44  				"data": 1,
    45  				"valid": true,
    46  				"skip": {
    47  					"v2": "could not compile schema",
    48  					"v3": "could not compile schema"
    49  				}
    50  			},
    51  			{
    52  				"description": "remote fragment invalid",
    53  				"data": "a",
    54  				"valid": false,
    55  				"skip": {
    56  					"v2": "could not compile schema",
    57  					"v3": "could not compile schema"
    58  				}
    59  			}
    60  		]
    61  	},
    62  	{
    63  		"description": "ref within remote ref",
    64  		"schema": {
    65  			"$ref": "http://localhost:1234/subSchemas.json#/definitions/refToInteger"
    66  		},
    67  		"skip": {
    68  			"v2": "extract error: cannot compile resulting schema: invalid import path: \"localhost:1234/subSchemas.json:subSchemas\":\n    generated.cue:1:8\n",
    69  			"v3": "extract error: cannot compile resulting schema: invalid import path: \"localhost:1234/subSchemas.json:subSchemas\":\n    generated.cue:1:8\n"
    70  		},
    71  		"tests": [
    72  			{
    73  				"description": "ref within ref valid",
    74  				"data": 1,
    75  				"valid": true,
    76  				"skip": {
    77  					"v2": "could not compile schema",
    78  					"v3": "could not compile schema"
    79  				}
    80  			},
    81  			{
    82  				"description": "ref within ref invalid",
    83  				"data": "a",
    84  				"valid": false,
    85  				"skip": {
    86  					"v2": "could not compile schema",
    87  					"v3": "could not compile schema"
    88  				}
    89  			}
    90  		]
    91  	},
    92  	{
    93  		"description": "base URI change",
    94  		"schema": {
    95  			"$id": "http://localhost:1234/",
    96  			"items": {
    97  				"$id": "baseUriChange/",
    98  				"items": {
    99  					"$ref": "folderInteger.json"
   100  				}
   101  			}
   102  		},
   103  		"skip": {
   104  			"v2": "extract error: cannot compile resulting schema: invalid import path: \"localhost:1234/baseUriChange/folderInteger.json:folderInteger\":\n    generated.cue:1:8\n",
   105  			"v3": "extract error: cannot compile resulting schema: invalid import path: \"localhost:1234/baseUriChange/folderInteger.json:folderInteger\":\n    generated.cue:1:8\n"
   106  		},
   107  		"tests": [
   108  			{
   109  				"description": "base URI change ref valid",
   110  				"data": [
   111  					[
   112  						1
   113  					]
   114  				],
   115  				"valid": true,
   116  				"skip": {
   117  					"v2": "could not compile schema",
   118  					"v3": "could not compile schema"
   119  				}
   120  			},
   121  			{
   122  				"description": "base URI change ref invalid",
   123  				"data": [
   124  					[
   125  						"a"
   126  					]
   127  				],
   128  				"valid": false,
   129  				"skip": {
   130  					"v2": "could not compile schema",
   131  					"v3": "could not compile schema"
   132  				}
   133  			}
   134  		]
   135  	},
   136  	{
   137  		"description": "base URI change - change folder",
   138  		"schema": {
   139  			"$id": "http://localhost:1234/scope_change_defs1.json",
   140  			"type": "object",
   141  			"properties": {
   142  				"list": {
   143  					"$ref": "#/definitions/baz"
   144  				}
   145  			},
   146  			"definitions": {
   147  				"baz": {
   148  					"$id": "baseUriChangeFolder/",
   149  					"type": "array",
   150  					"items": {
   151  						"$ref": "folderInteger.json"
   152  					}
   153  				}
   154  			}
   155  		},
   156  		"skip": {
   157  			"v2": "extract error: cannot compile resulting schema: invalid import path: \"localhost:1234/baseUriChangeFolder/folderInteger.json:folderInteger\":\n    generated.cue:1:8\n",
   158  			"v3": "extract error: cannot compile resulting schema: invalid import path: \"localhost:1234/baseUriChangeFolder/folderInteger.json:folderInteger\":\n    generated.cue:1:8\n"
   159  		},
   160  		"tests": [
   161  			{
   162  				"description": "number is valid",
   163  				"data": {
   164  					"list": [
   165  						1
   166  					]
   167  				},
   168  				"valid": true,
   169  				"skip": {
   170  					"v2": "could not compile schema",
   171  					"v3": "could not compile schema"
   172  				}
   173  			},
   174  			{
   175  				"description": "string is invalid",
   176  				"data": {
   177  					"list": [
   178  						"a"
   179  					]
   180  				},
   181  				"valid": false,
   182  				"skip": {
   183  					"v2": "could not compile schema",
   184  					"v3": "could not compile schema"
   185  				}
   186  			}
   187  		]
   188  	},
   189  	{
   190  		"description": "base URI change - change folder in subschema",
   191  		"schema": {
   192  			"$id": "http://localhost:1234/scope_change_defs2.json",
   193  			"type": "object",
   194  			"properties": {
   195  				"list": {
   196  					"$ref": "#/definitions/baz/definitions/bar"
   197  				}
   198  			},
   199  			"definitions": {
   200  				"baz": {
   201  					"$id": "baseUriChangeFolderInSubschema/",
   202  					"definitions": {
   203  						"bar": {
   204  							"type": "array",
   205  							"items": {
   206  								"$ref": "folderInteger.json"
   207  							}
   208  						}
   209  					}
   210  				}
   211  			}
   212  		},
   213  		"skip": {
   214  			"v2": "extract error: cannot compile resulting schema: invalid import path: \"localhost:1234/baseUriChangeFolderInSubschema/folderInteger.json:folderInteger\":\n    generated.cue:1:8\n",
   215  			"v3": "extract error: cannot compile resulting schema: invalid import path: \"localhost:1234/baseUriChangeFolderInSubschema/folderInteger.json:folderInteger\":\n    generated.cue:1:8\n"
   216  		},
   217  		"tests": [
   218  			{
   219  				"description": "number is valid",
   220  				"data": {
   221  					"list": [
   222  						1
   223  					]
   224  				},
   225  				"valid": true,
   226  				"skip": {
   227  					"v2": "could not compile schema",
   228  					"v3": "could not compile schema"
   229  				}
   230  			},
   231  			{
   232  				"description": "string is invalid",
   233  				"data": {
   234  					"list": [
   235  						"a"
   236  					]
   237  				},
   238  				"valid": false,
   239  				"skip": {
   240  					"v2": "could not compile schema",
   241  					"v3": "could not compile schema"
   242  				}
   243  			}
   244  		]
   245  	},
   246  	{
   247  		"description": "root ref in remote ref",
   248  		"schema": {
   249  			"$id": "http://localhost:1234/object",
   250  			"type": "object",
   251  			"properties": {
   252  				"name": {
   253  					"$ref": "name.json#/definitions/orNull"
   254  				}
   255  			}
   256  		},
   257  		"skip": {
   258  			"v2": "extract error: cannot compile resulting schema: invalid import path: \"localhost:1234/name.json:name\":\n    generated.cue:1:8\n",
   259  			"v3": "extract error: cannot compile resulting schema: invalid import path: \"localhost:1234/name.json:name\":\n    generated.cue:1:8\n"
   260  		},
   261  		"tests": [
   262  			{
   263  				"description": "string is valid",
   264  				"data": {
   265  					"name": "foo"
   266  				},
   267  				"valid": true,
   268  				"skip": {
   269  					"v2": "could not compile schema",
   270  					"v3": "could not compile schema"
   271  				}
   272  			},
   273  			{
   274  				"description": "null is valid",
   275  				"data": {
   276  					"name": null
   277  				},
   278  				"valid": true,
   279  				"skip": {
   280  					"v2": "could not compile schema",
   281  					"v3": "could not compile schema"
   282  				}
   283  			},
   284  			{
   285  				"description": "object is invalid",
   286  				"data": {
   287  					"name": {
   288  						"name": null
   289  					}
   290  				},
   291  				"valid": false,
   292  				"skip": {
   293  					"v2": "could not compile schema",
   294  					"v3": "could not compile schema"
   295  				}
   296  			}
   297  		]
   298  	},
   299  	{
   300  		"description": "remote ref with ref to definitions",
   301  		"schema": {
   302  			"$id": "http://localhost:1234/schema-remote-ref-ref-defs1.json",
   303  			"allOf": [
   304  				{
   305  					"$ref": "ref-and-definitions.json"
   306  				}
   307  			]
   308  		},
   309  		"skip": {
   310  			"v2": "extract error: cannot compile resulting schema: invalid import path: \"localhost:1234/ref-and-definitions.json:schema\":\n    generated.cue:1:8\n",
   311  			"v3": "extract error: cannot compile resulting schema: invalid import path: \"localhost:1234/ref-and-definitions.json:schema\":\n    generated.cue:1:8\n"
   312  		},
   313  		"tests": [
   314  			{
   315  				"description": "invalid",
   316  				"data": {
   317  					"bar": 1
   318  				},
   319  				"valid": false,
   320  				"skip": {
   321  					"v2": "could not compile schema",
   322  					"v3": "could not compile schema"
   323  				}
   324  			},
   325  			{
   326  				"description": "valid",
   327  				"data": {
   328  					"bar": "a"
   329  				},
   330  				"valid": true,
   331  				"skip": {
   332  					"v2": "could not compile schema",
   333  					"v3": "could not compile schema"
   334  				}
   335  			}
   336  		]
   337  	},
   338  	{
   339  		"description": "Location-independent identifier in remote ref",
   340  		"schema": {
   341  			"$ref": "http://localhost:1234/locationIndependentIdentifierPre2019.json#/definitions/refToInteger"
   342  		},
   343  		"skip": {
   344  			"v2": "extract error: cannot compile resulting schema: invalid import path: \"localhost:1234/locationIndependentIdentifierPre2019.json:locationIndependentIdentifierPre2019\":\n    generated.cue:1:8\n",
   345  			"v3": "extract error: cannot compile resulting schema: invalid import path: \"localhost:1234/locationIndependentIdentifierPre2019.json:locationIndependentIdentifierPre2019\":\n    generated.cue:1:8\n"
   346  		},
   347  		"tests": [
   348  			{
   349  				"description": "integer is valid",
   350  				"data": 1,
   351  				"valid": true,
   352  				"skip": {
   353  					"v2": "could not compile schema",
   354  					"v3": "could not compile schema"
   355  				}
   356  			},
   357  			{
   358  				"description": "string is invalid",
   359  				"data": "foo",
   360  				"valid": false,
   361  				"skip": {
   362  					"v2": "could not compile schema",
   363  					"v3": "could not compile schema"
   364  				}
   365  			}
   366  		]
   367  	},
   368  	{
   369  		"description": "retrieved nested refs resolve relative to their URI not $id",
   370  		"schema": {
   371  			"$id": "http://localhost:1234/some-id",
   372  			"properties": {
   373  				"name": {
   374  					"$ref": "nested/foo-ref-string.json"
   375  				}
   376  			}
   377  		},
   378  		"skip": {
   379  			"v2": "extract error: cannot compile resulting schema: invalid import path: \"localhost:1234/nested/foo-ref-string.json:schema\":\n    generated.cue:1:8\n",
   380  			"v3": "extract error: cannot compile resulting schema: invalid import path: \"localhost:1234/nested/foo-ref-string.json:schema\":\n    generated.cue:1:8\n"
   381  		},
   382  		"tests": [
   383  			{
   384  				"description": "number is invalid",
   385  				"data": {
   386  					"name": {
   387  						"foo": 1
   388  					}
   389  				},
   390  				"valid": false,
   391  				"skip": {
   392  					"v2": "could not compile schema",
   393  					"v3": "could not compile schema"
   394  				}
   395  			},
   396  			{
   397  				"description": "string is valid",
   398  				"data": {
   399  					"name": {
   400  						"foo": "a"
   401  					}
   402  				},
   403  				"valid": true,
   404  				"skip": {
   405  					"v2": "could not compile schema",
   406  					"v3": "could not compile schema"
   407  				}
   408  			}
   409  		]
   410  	},
   411  	{
   412  		"description": "$ref to $ref finds location-independent $id",
   413  		"schema": {
   414  			"$ref": "http://localhost:1234/draft6/detached-ref.json#/definitions/foo"
   415  		},
   416  		"skip": {
   417  			"v2": "extract error: cannot compile resulting schema: invalid import path: \"localhost:1234/draft6/detached-ref.json:schema\":\n    generated.cue:1:8\n",
   418  			"v3": "extract error: cannot compile resulting schema: invalid import path: \"localhost:1234/draft6/detached-ref.json:schema\":\n    generated.cue:1:8\n"
   419  		},
   420  		"tests": [
   421  			{
   422  				"description": "number is valid",
   423  				"data": 1,
   424  				"valid": true,
   425  				"skip": {
   426  					"v2": "could not compile schema",
   427  					"v3": "could not compile schema"
   428  				}
   429  			},
   430  			{
   431  				"description": "non-number is invalid",
   432  				"data": "a",
   433  				"valid": false,
   434  				"skip": {
   435  					"v2": "could not compile schema",
   436  					"v3": "could not compile schema"
   437  				}
   438  			}
   439  		]
   440  	}
   441  ]