cuelang.org/go@v0.13.0/encoding/jsonschema/testdata/external/tests/draft2019-09/anchor.json (about)

     1  [
     2  	{
     3  		"description": "Location-independent identifier",
     4  		"schema": {
     5  			"$schema": "https://json-schema.org/draft/2019-09/schema",
     6  			"$ref": "#foo",
     7  			"$defs": {
     8  				"A": {
     9  					"$anchor": "foo",
    10  					"type": "integer"
    11  				}
    12  			}
    13  		},
    14  		"skip": {
    15  			"v2": "extract error: cannot determine CUE location for JSON Schema location id=https://cue.jsonschema.invalid#foo: anchors (foo) not supported (and 3 more errors)",
    16  			"v3": "extract error: cannot determine CUE location for JSON Schema location id=https://cue.jsonschema.invalid#foo: anchors (foo) not supported (and 3 more errors)"
    17  		},
    18  		"tests": [
    19  			{
    20  				"description": "match",
    21  				"data": 1,
    22  				"valid": true,
    23  				"skip": {
    24  					"v2": "could not compile schema",
    25  					"v3": "could not compile schema"
    26  				}
    27  			},
    28  			{
    29  				"description": "mismatch",
    30  				"data": "a",
    31  				"valid": false,
    32  				"skip": {
    33  					"v2": "could not compile schema",
    34  					"v3": "could not compile schema"
    35  				}
    36  			}
    37  		]
    38  	},
    39  	{
    40  		"description": "Location-independent identifier with absolute URI",
    41  		"schema": {
    42  			"$schema": "https://json-schema.org/draft/2019-09/schema",
    43  			"$ref": "http://localhost:1234/draft2019-09/bar#foo",
    44  			"$defs": {
    45  				"A": {
    46  					"$id": "http://localhost:1234/draft2019-09/bar",
    47  					"$anchor": "foo",
    48  					"type": "integer"
    49  				}
    50  			}
    51  		},
    52  		"skip": {
    53  			"v2": "extract error: cannot determine CUE location for JSON Schema location id=http://localhost:1234/draft2019-09/bar#foo: anchors (foo) not supported (and 3 more errors)",
    54  			"v3": "extract error: cannot determine CUE location for JSON Schema location id=http://localhost:1234/draft2019-09/bar#foo: anchors (foo) not supported (and 3 more errors)"
    55  		},
    56  		"tests": [
    57  			{
    58  				"description": "match",
    59  				"data": 1,
    60  				"valid": true,
    61  				"skip": {
    62  					"v2": "could not compile schema",
    63  					"v3": "could not compile schema"
    64  				}
    65  			},
    66  			{
    67  				"description": "mismatch",
    68  				"data": "a",
    69  				"valid": false,
    70  				"skip": {
    71  					"v2": "could not compile schema",
    72  					"v3": "could not compile schema"
    73  				}
    74  			}
    75  		]
    76  	},
    77  	{
    78  		"description": "Location-independent identifier with base URI change in subschema",
    79  		"schema": {
    80  			"$schema": "https://json-schema.org/draft/2019-09/schema",
    81  			"$id": "http://localhost:1234/draft2019-09/root",
    82  			"$ref": "http://localhost:1234/draft2019-09/nested.json#foo",
    83  			"$defs": {
    84  				"A": {
    85  					"$id": "nested.json",
    86  					"$defs": {
    87  						"B": {
    88  							"$anchor": "foo",
    89  							"type": "integer"
    90  						}
    91  					}
    92  				}
    93  			}
    94  		},
    95  		"skip": {
    96  			"v2": "extract error: cannot determine CUE location for JSON Schema location id=http://localhost:1234/draft2019-09/nested.json#foo: anchors (foo) not supported (and 3 more errors)",
    97  			"v3": "extract error: cannot determine CUE location for JSON Schema location id=http://localhost:1234/draft2019-09/nested.json#foo: anchors (foo) not supported (and 3 more errors)"
    98  		},
    99  		"tests": [
   100  			{
   101  				"description": "match",
   102  				"data": 1,
   103  				"valid": true,
   104  				"skip": {
   105  					"v2": "could not compile schema",
   106  					"v3": "could not compile schema"
   107  				}
   108  			},
   109  			{
   110  				"description": "mismatch",
   111  				"data": "a",
   112  				"valid": false,
   113  				"skip": {
   114  					"v2": "could not compile schema",
   115  					"v3": "could not compile schema"
   116  				}
   117  			}
   118  		]
   119  	},
   120  	{
   121  		"description": "same $anchor with different base uri",
   122  		"schema": {
   123  			"$schema": "https://json-schema.org/draft/2019-09/schema",
   124  			"$id": "http://localhost:1234/draft2019-09/foobar",
   125  			"$defs": {
   126  				"A": {
   127  					"$id": "child1",
   128  					"allOf": [
   129  						{
   130  							"$id": "child2",
   131  							"$anchor": "my_anchor",
   132  							"type": "number"
   133  						},
   134  						{
   135  							"$anchor": "my_anchor",
   136  							"type": "string"
   137  						}
   138  					]
   139  				}
   140  			},
   141  			"$ref": "child1#my_anchor"
   142  		},
   143  		"skip": {
   144  			"v2": "extract error: keyword \"$anchor\" not yet implemented (and 5 more errors)",
   145  			"v3": "extract error: keyword \"$anchor\" not yet implemented (and 5 more errors)"
   146  		},
   147  		"tests": [
   148  			{
   149  				"description": "$ref resolves to /$defs/A/allOf/1",
   150  				"data": "a",
   151  				"valid": true,
   152  				"skip": {
   153  					"v2": "could not compile schema",
   154  					"v3": "could not compile schema"
   155  				}
   156  			},
   157  			{
   158  				"description": "$ref does not resolve to /$defs/A/allOf/0",
   159  				"data": 1,
   160  				"valid": false,
   161  				"skip": {
   162  					"v2": "could not compile schema",
   163  					"v3": "could not compile schema"
   164  				}
   165  			}
   166  		]
   167  	}
   168  ]