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

     1  [
     2  	{
     3  		"description": "anyOf",
     4  		"schema": {
     5  			"$schema": "https://json-schema.org/draft/2019-09/schema",
     6  			"anyOf": [
     7  				{
     8  					"type": "integer"
     9  				},
    10  				{
    11  					"minimum": 2
    12  				}
    13  			]
    14  		},
    15  		"tests": [
    16  			{
    17  				"description": "first anyOf valid",
    18  				"data": 1,
    19  				"valid": true
    20  			},
    21  			{
    22  				"description": "second anyOf valid",
    23  				"data": 2.5,
    24  				"valid": true
    25  			},
    26  			{
    27  				"description": "both anyOf valid",
    28  				"data": 3,
    29  				"valid": true
    30  			},
    31  			{
    32  				"description": "neither anyOf valid",
    33  				"data": 1.5,
    34  				"valid": false
    35  			}
    36  		]
    37  	},
    38  	{
    39  		"description": "anyOf with base schema",
    40  		"schema": {
    41  			"$schema": "https://json-schema.org/draft/2019-09/schema",
    42  			"type": "string",
    43  			"anyOf": [
    44  				{
    45  					"maxLength": 2
    46  				},
    47  				{
    48  					"minLength": 4
    49  				}
    50  			]
    51  		},
    52  		"tests": [
    53  			{
    54  				"description": "mismatch base schema",
    55  				"data": 3,
    56  				"valid": false
    57  			},
    58  			{
    59  				"description": "one anyOf valid",
    60  				"data": "foobar",
    61  				"valid": true
    62  			},
    63  			{
    64  				"description": "both anyOf invalid",
    65  				"data": "foo",
    66  				"valid": false
    67  			}
    68  		]
    69  	},
    70  	{
    71  		"description": "anyOf with boolean schemas, all true",
    72  		"schema": {
    73  			"$schema": "https://json-schema.org/draft/2019-09/schema",
    74  			"anyOf": [
    75  				true,
    76  				true
    77  			]
    78  		},
    79  		"tests": [
    80  			{
    81  				"description": "any value is valid",
    82  				"data": "foo",
    83  				"valid": true
    84  			}
    85  		]
    86  	},
    87  	{
    88  		"description": "anyOf with boolean schemas, some true",
    89  		"schema": {
    90  			"$schema": "https://json-schema.org/draft/2019-09/schema",
    91  			"anyOf": [
    92  				true,
    93  				false
    94  			]
    95  		},
    96  		"tests": [
    97  			{
    98  				"description": "any value is valid",
    99  				"data": "foo",
   100  				"valid": true
   101  			}
   102  		]
   103  	},
   104  	{
   105  		"description": "anyOf with boolean schemas, all false",
   106  		"schema": {
   107  			"$schema": "https://json-schema.org/draft/2019-09/schema",
   108  			"anyOf": [
   109  				false,
   110  				false
   111  			]
   112  		},
   113  		"tests": [
   114  			{
   115  				"description": "any value is invalid",
   116  				"data": "foo",
   117  				"valid": false
   118  			}
   119  		]
   120  	},
   121  	{
   122  		"description": "anyOf complex types",
   123  		"schema": {
   124  			"$schema": "https://json-schema.org/draft/2019-09/schema",
   125  			"anyOf": [
   126  				{
   127  					"properties": {
   128  						"bar": {
   129  							"type": "integer"
   130  						}
   131  					},
   132  					"required": [
   133  						"bar"
   134  					]
   135  				},
   136  				{
   137  					"properties": {
   138  						"foo": {
   139  							"type": "string"
   140  						}
   141  					},
   142  					"required": [
   143  						"foo"
   144  					]
   145  				}
   146  			]
   147  		},
   148  		"tests": [
   149  			{
   150  				"description": "first anyOf valid (complex)",
   151  				"data": {
   152  					"bar": 2
   153  				},
   154  				"valid": true
   155  			},
   156  			{
   157  				"description": "second anyOf valid (complex)",
   158  				"data": {
   159  					"foo": "baz"
   160  				},
   161  				"valid": true
   162  			},
   163  			{
   164  				"description": "both anyOf valid (complex)",
   165  				"data": {
   166  					"foo": "baz",
   167  					"bar": 2
   168  				},
   169  				"valid": true
   170  			},
   171  			{
   172  				"description": "neither anyOf valid (complex)",
   173  				"data": {
   174  					"foo": 2,
   175  					"bar": "quux"
   176  				},
   177  				"valid": false
   178  			}
   179  		]
   180  	},
   181  	{
   182  		"description": "anyOf with one empty schema",
   183  		"schema": {
   184  			"$schema": "https://json-schema.org/draft/2019-09/schema",
   185  			"anyOf": [
   186  				{
   187  					"type": "number"
   188  				},
   189  				{}
   190  			]
   191  		},
   192  		"tests": [
   193  			{
   194  				"description": "string is valid",
   195  				"data": "foo",
   196  				"valid": true
   197  			},
   198  			{
   199  				"description": "number is valid",
   200  				"data": 123,
   201  				"valid": true
   202  			}
   203  		]
   204  	},
   205  	{
   206  		"description": "nested anyOf, to check validation semantics",
   207  		"schema": {
   208  			"$schema": "https://json-schema.org/draft/2019-09/schema",
   209  			"anyOf": [
   210  				{
   211  					"anyOf": [
   212  						{
   213  							"type": "null"
   214  						}
   215  					]
   216  				}
   217  			]
   218  		},
   219  		"tests": [
   220  			{
   221  				"description": "null is valid",
   222  				"data": null,
   223  				"valid": true
   224  			},
   225  			{
   226  				"description": "anything non-null is invalid",
   227  				"data": 123,
   228  				"valid": false
   229  			}
   230  		]
   231  	}
   232  ]