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