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

     1  [
     2  	{
     3  		"description": "contains keyword validation",
     4  		"schema": {
     5  			"contains": {
     6  				"minimum": 5
     7  			}
     8  		},
     9  		"tests": [
    10  			{
    11  				"description": "array with item matching schema (5) is valid",
    12  				"data": [
    13  					3,
    14  					4,
    15  					5
    16  				],
    17  				"valid": true
    18  			},
    19  			{
    20  				"description": "array with item matching schema (6) is valid",
    21  				"data": [
    22  					3,
    23  					4,
    24  					6
    25  				],
    26  				"valid": true
    27  			},
    28  			{
    29  				"description": "array with two items matching schema (5, 6) is valid",
    30  				"data": [
    31  					3,
    32  					4,
    33  					5,
    34  					6
    35  				],
    36  				"valid": true
    37  			},
    38  			{
    39  				"description": "array without items matching schema is invalid",
    40  				"data": [
    41  					2,
    42  					3,
    43  					4
    44  				],
    45  				"valid": false
    46  			},
    47  			{
    48  				"description": "empty array is invalid",
    49  				"data": [],
    50  				"valid": false
    51  			},
    52  			{
    53  				"description": "not array is valid",
    54  				"data": {},
    55  				"valid": true
    56  			}
    57  		]
    58  	},
    59  	{
    60  		"description": "contains keyword with const keyword",
    61  		"schema": {
    62  			"contains": {
    63  				"const": 5
    64  			}
    65  		},
    66  		"tests": [
    67  			{
    68  				"description": "array with item 5 is valid",
    69  				"data": [
    70  					3,
    71  					4,
    72  					5
    73  				],
    74  				"valid": true
    75  			},
    76  			{
    77  				"description": "array with two items 5 is valid",
    78  				"data": [
    79  					3,
    80  					4,
    81  					5,
    82  					5
    83  				],
    84  				"valid": true
    85  			},
    86  			{
    87  				"description": "array without item 5 is invalid",
    88  				"data": [
    89  					1,
    90  					2,
    91  					3,
    92  					4
    93  				],
    94  				"valid": false
    95  			}
    96  		]
    97  	},
    98  	{
    99  		"description": "contains keyword with boolean schema true",
   100  		"schema": {
   101  			"contains": true
   102  		},
   103  		"tests": [
   104  			{
   105  				"description": "any non-empty array is valid",
   106  				"data": [
   107  					"foo"
   108  				],
   109  				"valid": true
   110  			},
   111  			{
   112  				"description": "empty array is invalid",
   113  				"data": [],
   114  				"valid": false
   115  			}
   116  		]
   117  	},
   118  	{
   119  		"description": "contains keyword with boolean schema false",
   120  		"schema": {
   121  			"contains": false
   122  		},
   123  		"tests": [
   124  			{
   125  				"description": "any non-empty array is invalid",
   126  				"data": [
   127  					"foo"
   128  				],
   129  				"valid": false
   130  			},
   131  			{
   132  				"description": "empty array is invalid",
   133  				"data": [],
   134  				"valid": false
   135  			},
   136  			{
   137  				"description": "non-arrays are valid",
   138  				"data": "contains does not apply to strings",
   139  				"valid": true
   140  			}
   141  		]
   142  	},
   143  	{
   144  		"description": "items + contains",
   145  		"schema": {
   146  			"items": {
   147  				"multipleOf": 2
   148  			},
   149  			"contains": {
   150  				"multipleOf": 3
   151  			}
   152  		},
   153  		"tests": [
   154  			{
   155  				"description": "matches items, does not match contains",
   156  				"data": [
   157  					2,
   158  					4,
   159  					8
   160  				],
   161  				"valid": false
   162  			},
   163  			{
   164  				"description": "does not match items, matches contains",
   165  				"data": [
   166  					3,
   167  					6,
   168  					9
   169  				],
   170  				"valid": false
   171  			},
   172  			{
   173  				"description": "matches both items and contains",
   174  				"data": [
   175  					6,
   176  					12
   177  				],
   178  				"valid": true
   179  			},
   180  			{
   181  				"description": "matches neither items nor contains",
   182  				"data": [
   183  					1,
   184  					5
   185  				],
   186  				"valid": false
   187  			}
   188  		]
   189  	},
   190  	{
   191  		"description": "contains with null instance elements",
   192  		"schema": {
   193  			"contains": {
   194  				"type": "null"
   195  			}
   196  		},
   197  		"tests": [
   198  			{
   199  				"description": "allows null items",
   200  				"data": [
   201  					null
   202  				],
   203  				"valid": true
   204  			}
   205  		]
   206  	}
   207  ]