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