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

     1  [
     2  	{
     3  		"description": "a schema given for prefixItems",
     4  		"schema": {
     5  			"$schema": "https://json-schema.org/draft/2020-12/schema",
     6  			"prefixItems": [
     7  				{
     8  					"type": "integer"
     9  				},
    10  				{
    11  					"type": "string"
    12  				}
    13  			]
    14  		},
    15  		"tests": [
    16  			{
    17  				"description": "correct types",
    18  				"data": [
    19  					1,
    20  					"foo"
    21  				],
    22  				"valid": true
    23  			},
    24  			{
    25  				"description": "wrong types",
    26  				"data": [
    27  					"foo",
    28  					1
    29  				],
    30  				"valid": false
    31  			},
    32  			{
    33  				"description": "incomplete array of items",
    34  				"data": [
    35  					1
    36  				],
    37  				"valid": true,
    38  				"skip": {
    39  					"v2": "5 errors in empty disjunction:\nconflicting values [1] and {...} (mismatched types list and struct):\n    generated.cue:3:1\n    generated.cue:3:54\n    instance.json:1:1\nconflicting values bool and [1] (mismatched types bool and list):\n    generated.cue:3:8\n    instance.json:1:1\nconflicting values null and [1] (mismatched types null and list):\n    generated.cue:3:1\n    instance.json:1:1\nconflicting values number and [1] (mismatched types number and list):\n    generated.cue:3:15\n    instance.json:1:1\nconflicting values string and [1] (mismatched types string and list):\n    generated.cue:3:24\n    instance.json:1:1\n",
    40  					"v3": "6 errors in empty disjunction:\nconflicting values [1] and bool (mismatched types list and bool):\n    generated.cue:3:8\n    instance.json:1:1\nconflicting values [1] and null (mismatched types list and null):\n    generated.cue:3:1\n    instance.json:1:1\nconflicting values [1] and number (mismatched types list and number):\n    generated.cue:3:15\n    instance.json:1:1\nconflicting values [1] and string (mismatched types list and string):\n    generated.cue:3:24\n    instance.json:1:1\nconflicting values [1] and {...} (mismatched types list and struct):\n    generated.cue:3:54\n    instance.json:1:1\nincompatible list lengths (1 and 3):\n    generated.cue:3:33\n"
    41  				}
    42  			},
    43  			{
    44  				"description": "array with additional items",
    45  				"data": [
    46  					1,
    47  					"foo",
    48  					true
    49  				],
    50  				"valid": true
    51  			},
    52  			{
    53  				"description": "empty array",
    54  				"data": [],
    55  				"valid": true,
    56  				"skip": {
    57  					"v2": "5 errors in empty disjunction:\nconflicting values [] and {...} (mismatched types list and struct):\n    generated.cue:3:1\n    generated.cue:3:54\n    instance.json:1:1\nconflicting values bool and [] (mismatched types bool and list):\n    generated.cue:3:8\n    instance.json:1:1\nconflicting values null and [] (mismatched types null and list):\n    generated.cue:3:1\n    instance.json:1:1\nconflicting values number and [] (mismatched types number and list):\n    generated.cue:3:15\n    instance.json:1:1\nconflicting values string and [] (mismatched types string and list):\n    generated.cue:3:24\n    instance.json:1:1\n",
    58  					"v3": "6 errors in empty disjunction:\nconflicting values [] and bool (mismatched types list and bool):\n    generated.cue:3:8\n    instance.json:1:1\nconflicting values [] and null (mismatched types list and null):\n    generated.cue:3:1\n    instance.json:1:1\nconflicting values [] and number (mismatched types list and number):\n    generated.cue:3:15\n    instance.json:1:1\nconflicting values [] and string (mismatched types list and string):\n    generated.cue:3:24\n    instance.json:1:1\nconflicting values [] and {...} (mismatched types list and struct):\n    generated.cue:3:54\n    instance.json:1:1\nincompatible list lengths (0 and 3):\n    generated.cue:3:33\n"
    59  				}
    60  			},
    61  			{
    62  				"description": "JavaScript pseudo-array is valid",
    63  				"data": {
    64  					"0": "invalid",
    65  					"1": "valid",
    66  					"length": 2
    67  				},
    68  				"valid": true
    69  			}
    70  		]
    71  	},
    72  	{
    73  		"description": "prefixItems with boolean schemas",
    74  		"schema": {
    75  			"$schema": "https://json-schema.org/draft/2020-12/schema",
    76  			"prefixItems": [
    77  				true,
    78  				false
    79  			]
    80  		},
    81  		"tests": [
    82  			{
    83  				"description": "array with one item is valid",
    84  				"data": [
    85  					1
    86  				],
    87  				"valid": true,
    88  				"skip": {
    89  					"v2": "5 errors in empty disjunction:\nconflicting values [1] and {...} (mismatched types list and struct):\n    generated.cue:3:1\n    generated.cue:3:49\n    instance.json:1:1\nconflicting values bool and [1] (mismatched types bool and list):\n    generated.cue:3:8\n    instance.json:1:1\nconflicting values null and [1] (mismatched types null and list):\n    generated.cue:3:1\n    instance.json:1:1\nconflicting values number and [1] (mismatched types number and list):\n    generated.cue:3:15\n    instance.json:1:1\nconflicting values string and [1] (mismatched types string and list):\n    generated.cue:3:24\n    instance.json:1:1\n",
    90  					"v3": "7 errors in empty disjunction:\nconflicting values [1] and bool (mismatched types list and bool):\n    generated.cue:3:8\n    instance.json:1:1\nconflicting values [1] and null (mismatched types list and null):\n    generated.cue:3:1\n    instance.json:1:1\nconflicting values [1] and number (mismatched types list and number):\n    generated.cue:3:15\n    instance.json:1:1\nconflicting values [1] and string (mismatched types list and string):\n    generated.cue:3:24\n    instance.json:1:1\nconflicting values [1] and {...} (mismatched types list and struct):\n    generated.cue:3:49\n    instance.json:1:1\nincompatible list lengths (1 and 3):\n    generated.cue:3:33\nexplicit error (_|_ literal) in source:\n    generated.cue:3:37\n"
    91  				}
    92  			},
    93  			{
    94  				"description": "array with two items is invalid",
    95  				"data": [
    96  					1,
    97  					"foo"
    98  				],
    99  				"valid": false
   100  			},
   101  			{
   102  				"description": "empty array is valid",
   103  				"data": [],
   104  				"valid": true,
   105  				"skip": {
   106  					"v2": "5 errors in empty disjunction:\nconflicting values [] and {...} (mismatched types list and struct):\n    generated.cue:3:1\n    generated.cue:3:49\n    instance.json:1:1\nconflicting values bool and [] (mismatched types bool and list):\n    generated.cue:3:8\n    instance.json:1:1\nconflicting values null and [] (mismatched types null and list):\n    generated.cue:3:1\n    instance.json:1:1\nconflicting values number and [] (mismatched types number and list):\n    generated.cue:3:15\n    instance.json:1:1\nconflicting values string and [] (mismatched types string and list):\n    generated.cue:3:24\n    instance.json:1:1\n",
   107  					"v3": "6 errors in empty disjunction:\nconflicting values [] and bool (mismatched types list and bool):\n    generated.cue:3:8\n    instance.json:1:1\nconflicting values [] and null (mismatched types list and null):\n    generated.cue:3:1\n    instance.json:1:1\nconflicting values [] and number (mismatched types list and number):\n    generated.cue:3:15\n    instance.json:1:1\nconflicting values [] and string (mismatched types list and string):\n    generated.cue:3:24\n    instance.json:1:1\nconflicting values [] and {...} (mismatched types list and struct):\n    generated.cue:3:49\n    instance.json:1:1\nincompatible list lengths (0 and 3):\n    generated.cue:3:33\n"
   108  				}
   109  			}
   110  		]
   111  	},
   112  	{
   113  		"description": "additional items are allowed by default",
   114  		"schema": {
   115  			"$schema": "https://json-schema.org/draft/2020-12/schema",
   116  			"prefixItems": [
   117  				{
   118  					"type": "integer"
   119  				}
   120  			]
   121  		},
   122  		"tests": [
   123  			{
   124  				"description": "only the first item is validated",
   125  				"data": [
   126  					1,
   127  					"foo",
   128  					false
   129  				],
   130  				"valid": true
   131  			}
   132  		]
   133  	},
   134  	{
   135  		"description": "prefixItems with null instance elements",
   136  		"schema": {
   137  			"$schema": "https://json-schema.org/draft/2020-12/schema",
   138  			"prefixItems": [
   139  				{
   140  					"type": "null"
   141  				}
   142  			]
   143  		},
   144  		"tests": [
   145  			{
   146  				"description": "allows null elements",
   147  				"data": [
   148  					null
   149  				],
   150  				"valid": true
   151  			}
   152  		]
   153  	}
   154  ]