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

     1  [
     2  	{
     3  		"description": "id inside an enum is not a real identifier",
     4  		"comment": "the implementation must not be confused by an id buried in the enum",
     5  		"schema": {
     6  			"definitions": {
     7  				"id_in_enum": {
     8  					"enum": [
     9  						{
    10  							"$id": "https://localhost:1234/id/my_identifier.json",
    11  							"type": "null"
    12  						}
    13  					]
    14  				},
    15  				"real_id_in_schema": {
    16  					"$id": "https://localhost:1234/id/my_identifier.json",
    17  					"type": "string"
    18  				},
    19  				"zzz_id_in_const": {
    20  					"const": {
    21  						"$id": "https://localhost:1234/id/my_identifier.json",
    22  						"type": "null"
    23  					}
    24  				}
    25  			},
    26  			"anyOf": [
    27  				{
    28  					"$ref": "#/definitions/id_in_enum"
    29  				},
    30  				{
    31  					"$ref": "https://localhost:1234/id/my_identifier.json"
    32  				}
    33  			]
    34  		},
    35  		"tests": [
    36  			{
    37  				"description": "exact match to enum, and type matches",
    38  				"data": {
    39  					"$id": "https://localhost:1234/id/my_identifier.json",
    40  					"type": "null"
    41  				},
    42  				"valid": true
    43  			},
    44  			{
    45  				"description": "match $ref to id",
    46  				"data": "a string to match #/definitions/id_in_enum",
    47  				"valid": true
    48  			},
    49  			{
    50  				"description": "no match on enum or $ref to id",
    51  				"data": 1,
    52  				"valid": false
    53  			}
    54  		]
    55  	},
    56  	{
    57  		"description": "non-schema object containing a plain-name $id property",
    58  		"schema": {
    59  			"definitions": {
    60  				"const_not_anchor": {
    61  					"const": {
    62  						"$id": "#not_a_real_anchor"
    63  					}
    64  				}
    65  			},
    66  			"oneOf": [
    67  				{
    68  					"const": "skip not_a_real_anchor"
    69  				},
    70  				{
    71  					"allOf": [
    72  						{
    73  							"not": {
    74  								"const": "skip not_a_real_anchor"
    75  							}
    76  						},
    77  						{
    78  							"$ref": "#/definitions/const_not_anchor"
    79  						}
    80  					]
    81  				}
    82  			]
    83  		},
    84  		"tests": [
    85  			{
    86  				"description": "skip traversing definition for a valid result",
    87  				"data": "skip not_a_real_anchor",
    88  				"valid": true
    89  			},
    90  			{
    91  				"description": "const at const_not_anchor does not match",
    92  				"data": 1,
    93  				"valid": false
    94  			}
    95  		]
    96  	},
    97  	{
    98  		"description": "non-schema object containing an $id property",
    99  		"schema": {
   100  			"definitions": {
   101  				"const_not_id": {
   102  					"const": {
   103  						"$id": "not_a_real_id"
   104  					}
   105  				}
   106  			},
   107  			"oneOf": [
   108  				{
   109  					"const": "skip not_a_real_id"
   110  				},
   111  				{
   112  					"allOf": [
   113  						{
   114  							"not": {
   115  								"const": "skip not_a_real_id"
   116  							}
   117  						},
   118  						{
   119  							"$ref": "#/definitions/const_not_id"
   120  						}
   121  					]
   122  				}
   123  			]
   124  		},
   125  		"tests": [
   126  			{
   127  				"description": "skip traversing definition for a valid result",
   128  				"data": "skip not_a_real_id",
   129  				"valid": true
   130  			},
   131  			{
   132  				"description": "const at const_not_id does not match",
   133  				"data": 1,
   134  				"valid": false
   135  			}
   136  		]
   137  	}
   138  ]