cuelang.org/go@v0.13.0/encoding/jsonschema/testdata/external/tests/draft7/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 false if subschema", 192 "schema": { 193 "contains": { 194 "if": false, 195 "else": true 196 } 197 }, 198 "tests": [ 199 { 200 "description": "any non-empty array is valid", 201 "data": [ 202 "foo" 203 ], 204 "valid": true, 205 "skip": { 206 "v2": "6 errors in empty disjunction:\nconflicting values [\"foo\"] and {...} (mismatched types list and struct):\n generated.cue:3:1\n generated.cue:3:72\n instance.json:1:1\nconflicting values bool and [\"foo\"] (mismatched types bool and list):\n generated.cue:3:8\n instance.json:1:1\nconflicting values null and [\"foo\"] (mismatched types null and list):\n generated.cue:3:1\n instance.json:1:1\nconflicting values number and [\"foo\"] (mismatched types number and list):\n generated.cue:3:15\n instance.json:1:1\nconflicting values string and [\"foo\"] (mismatched types string and list):\n generated.cue:3:24\n instance.json:1:1\nexplicit error (_|_ literal) in source:\n generated.cue:3:58\n", 207 "v3": "6 errors in empty disjunction:\nconflicting values [\"foo\"] and bool (mismatched types list and bool):\n generated.cue:3:8\n instance.json:1:1\nconflicting values [\"foo\"] and null (mismatched types list and null):\n generated.cue:3:1\n instance.json:1:1\nconflicting values [\"foo\"] and number (mismatched types list and number):\n generated.cue:3:15\n instance.json:1:1\nconflicting values [\"foo\"] and string (mismatched types list and string):\n generated.cue:3:24\n instance.json:1:1\nconflicting values [\"foo\"] and {...} (mismatched types list and struct):\n generated.cue:3:72\n instance.json:1:1\nexplicit error (_|_ literal) in source:\n generated.cue:3:58\n" 208 } 209 }, 210 { 211 "description": "empty array is invalid", 212 "data": [], 213 "valid": false 214 } 215 ] 216 }, 217 { 218 "description": "contains with null instance elements", 219 "schema": { 220 "contains": { 221 "type": "null" 222 } 223 }, 224 "tests": [ 225 { 226 "description": "allows null items", 227 "data": [ 228 null 229 ], 230 "valid": true 231 } 232 ] 233 } 234 ]