| •1 |
[ |
| 2 |
{ |
| 3 |
"description": "invalid type for default", |
| 4 |
"schema": { |
| 5 |
"properties": { |
| 6 |
"foo": { |
| 7 |
"type": "integer", |
| 8 |
"default": [] |
| 9 |
} |
| 10 |
} |
| 11 |
}, |
| 12 |
"tests": [ |
| 13 |
{ |
| 14 |
"description": "valid when property is specified", |
| 15 |
"data": {"foo": 13}, |
| 16 |
"valid": true |
| 17 |
}, |
| 18 |
{ |
| 19 |
"description": "still valid when the invalid default is used", |
| 20 |
"data": {}, |
| 21 |
"valid": true |
| 22 |
} |
| 23 |
] |
| 24 |
}, |
| 25 |
{ |
| 26 |
"description": "invalid string value for default", |
| 27 |
"schema": { |
| 28 |
"properties": { |
| 29 |
"bar": { |
| 30 |
"type": "string", |
| 31 |
"minLength": 4, |
| 32 |
"default": "bad" |
| 33 |
} |
| 34 |
} |
| 35 |
}, |
| 36 |
"tests": [ |
| 37 |
{ |
| 38 |
"description": "valid when property is specified", |
| 39 |
"data": {"bar": "good"}, |
| 40 |
"valid": true |
| 41 |
}, |
| 42 |
{ |
| 43 |
"description": "still valid when the invalid default is used", |
| 44 |
"data": {}, |
| 45 |
"valid": true |
| 46 |
} |
| 47 |
] |
| 48 |
}, |
| 49 |
{ |
| 50 |
"description": "the default keyword does not do anything if the property is missing", |
| 51 |
"schema": { |
| 52 |
"type": "object", |
| 53 |
"properties": { |
| 54 |
"alpha": { |
| 55 |
"type": "number", |
| 56 |
"maximum": 3, |
| 57 |
"default": 5 |
| 58 |
} |
| 59 |
} |
| 60 |
}, |
| 61 |
"tests": [ |
| 62 |
{ |
| 63 |
"description": "an explicit property value is checked against maximum (passing)", |
| 64 |
"data": { "alpha": 1 }, |
| 65 |
"valid": true |
| 66 |
}, |
| 67 |
{ |
| 68 |
"description": "an explicit property value is checked against maximum (failing)", |
| 69 |
"data": { "alpha": 5 }, |
| 70 |
"valid": false |
| 71 |
}, |
| 72 |
{ |
| 73 |
"description": "missing properties are not filled in with the default", |
| 74 |
"data": {}, |
| 75 |
"valid": true |
| 76 |
} |
| 77 |
] |
| 78 |
} |
| 79 |
] |