1[ 2 { 3 "description": "integer type matches integers", 4 "schema": {"type": "integer"}, 5 "tests": [ 6 { 7 "description": "an integer is an integer", 8 "data": 1, 9 "valid": true 10 }, 11 { 12 "description": "a float is not an integer", 13 "data": 1.1, 14 "valid": false 15 }, 16 { 17 "description": "a string is not an integer", 18 "data": "foo", 19 "valid": false 20 }, 21 { 22 "description": "an object is not an integer", 23 "data": {}, 24 "valid": false 25 }, 26 { 27 "description": "an array is not an integer", 28 "data": [], 29 "valid": false 30 }, 31 { 32 "description": "a boolean is not an integer", 33 "data": true, 34 "valid": false 35 }, 36 { 37 "description": "null is not an integer", 38 "data": null, 39 "valid": false 40 } 41 ] 42 }, 43 { 44 "description": "number type matches numbers", 45 "schema": {"type": "number"}, 46 "tests": [ 47 { 48 "description": "an integer is a number", 49 "data": 1, 50 "valid": true 51 }, 52 { 53 "description": "a float is a number", 54 "data": 1.1, 55 "valid": true 56 }, 57 { 58 "description": "a string is not a number", 59 "data": "foo", 60 "valid": false 61 }, 62 { 63 "description": "an object is not a number", 64 "data": {}, 65 "valid": false 66 }, 67 { 68 "description": "an array is not a number", 69 "data": [], 70 "valid": false 71 }, 72 { 73 "description": "a boolean is not a number", 74 "data": true, 75 "valid": false 76 }, 77 { 78 "description": "null is not a number", 79 "data": null, 80 "valid": false 81 } 82 ] 83 }, 84 { 85 "description": "string type matches strings", 86 "schema": {"type": "string"}, 87 "tests": [ 88 { 89 "description": "1 is not a string", 90 "data": 1, 91 "valid": false 92 }, 93 { 94 "description": "a float is not a string", 95 "data": 1.1, 96 "valid": false 97 }, 98 { 99 "description": "a string is a string", 100 "data": "foo", 101 "valid": true 102 }, 103 { 104 "description": "an object is not a string", 105 "data": {}, 106 "valid": false 107 }, 108 { 109 "description": "an array is not a string", 110 "data": [], 111 "valid": false 112 }, 113 { 114 "description": "a boolean is not a string", 115 "data": true, 116 "valid": false 117 }, 118 { 119 "description": "null is not a string", 120 "data": null, 121 "valid": false 122 } 123 ] 124 }, 125 { 126 "description": "object type matches objects", 127 "schema": {"type": "object"}, 128 "tests": [ 129 { 130 "description": "an integer is not an object", 131 "data": 1, 132 "valid": false 133 }, 134 { 135 "description": "a float is not an object", 136 "data": 1.1, 137 "valid": false 138 }, 139 { 140 "description": "a string is not an object", 141 "data": "foo", 142 "valid": false 143 }, 144 { 145 "description": "an object is an object", 146 "data": {}, 147 "valid": true 148 }, 149 { 150 "description": "an array is not an object", 151 "data": [], 152 "valid": false 153 }, 154 { 155 "description": "a boolean is not an object", 156 "data": true, 157 "valid": false 158 }, 159 { 160 "description": "null is not an object", 161 "data": null, 162 "valid": false 163 } 164 ] 165 }, 166 { 167 "description": "array type matches arrays", 168 "schema": {"type": "array"}, 169 "tests": [ 170 { 171 "description": "an integer is not an array", 172 "data": 1, 173 "valid": false 174 }, 175 { 176 "description": "a float is not an array", 177 "data": 1.1, 178 "valid": false 179 }, 180 { 181 "description": "a string is not an array", 182 "data": "foo", 183 "valid": false 184 }, 185 { 186 "description": "an object is not an array", 187 "data": {}, 188 "valid": false 189 }, 190 { 191 "description": "an array is not an array", 192 "data": [], 193 "valid": true 194 }, 195 { 196 "description": "a boolean is not an array", 197 "data": true, 198 "valid": false 199 }, 200 { 201 "description": "null is not an array", 202 "data": null, 203 "valid": false 204 } 205 ] 206 }, 207 { 208 "description": "boolean type matches booleans", 209 "schema": {"type": "boolean"}, 210 "tests": [ 211 { 212 "description": "an integer is not a boolean", 213 "data": 1, 214 "valid": false 215 }, 216 { 217 "description": "a float is not a boolean", 218 "data": 1.1, 219 "valid": false 220 }, 221 { 222 "description": "a string is not a boolean", 223 "data": "foo", 224 "valid": false 225 }, 226 { 227 "description": "an object is not a boolean", 228 "data": {}, 229 "valid": false 230 }, 231 { 232 "description": "an array is not a boolean", 233 "data": [], 234 "valid": false 235 }, 236 { 237 "description": "a boolean is not a boolean", 238 "data": true, 239 "valid": true 240 }, 241 { 242 "description": "null is not a boolean", 243 "data": null, 244 "valid": false 245 } 246 ] 247 }, 248 { 249 "description": "null type matches only the null object", 250 "schema": {"type": "null"}, 251 "tests": [ 252 { 253 "description": "an integer is not null", 254 "data": 1, 255 "valid": false 256 }, 257 { 258 "description": "a float is not null", 259 "data": 1.1, 260 "valid": false 261 }, 262 { 263 "description": "a string is not null", 264 "data": "foo", 265 "valid": false 266 }, 267 { 268 "description": "an object is not null", 269 "data": {}, 270 "valid": false 271 }, 272 { 273 "description": "an array is not null", 274 "data": [], 275 "valid": false 276 }, 277 { 278 "description": "a boolean is not null", 279 "data": true, 280 "valid": false 281 }, 282 { 283 "description": "null is null", 284 "data": null, 285 "valid": true 286 } 287 ] 288 }, 289 { 290 "description": "multiple types can be specified in an array", 291 "schema": {"type": ["integer", "string"]}, 292 "tests": [ 293 { 294 "description": "an integer is valid", 295 "data": 1, 296 "valid": true 297 }, 298 { 299 "description": "a string is valid", 300 "data": "foo", 301 "valid": true 302 }, 303 { 304 "description": "a float is invalid", 305 "data": 1.1, 306 "valid": false 307 }, 308 { 309 "description": "an object is invalid", 310 "data": {}, 311 "valid": false 312 }, 313 { 314 "description": "an array is invalid", 315 "data": [], 316 "valid": false 317 }, 318 { 319 "description": "a boolean is invalid", 320 "data": true, 321 "valid": false 322 }, 323 { 324 "description": "null is invalid", 325 "data": null, 326 "valid": false 327 } 328 ] 329 } 330] 331