cuelang.org/go@v0.13.0/encoding/jsonschema/testdata/txtar/object.txtar (about) 1 -- schema.json -- 2 { 3 "type": "object", 4 "title": "Main schema", 5 6 "properties": { 7 "fields" : { 8 "type": "object", 9 "minProperties": 3, 10 "maxProperties": 10, 11 "propertyNames": { 12 "pattern": "^\\P{Lu}" 13 } 14 }, 15 "additional": { 16 "type": "object", 17 "properties": { 18 "foo": { "type": "number" }, 19 "bar": { "type": "number" } 20 }, 21 "additionalProperties": { "type": "string" } 22 }, 23 "map": { 24 "type": "object", 25 "additionalProperties": { "type": "string" } 26 }, 27 "patterns": { 28 "type": "object", 29 "properties": { 30 "foo": { "type": "number" }, 31 "bar": { "type": "number" } 32 }, 33 "patternProperties": { 34 "^\\P{Lu}": { "type": "string" }, 35 "^\\P{Lo}": { "type": "integer" } 36 } 37 }, 38 "patternsNoProps": { 39 "type": "object", 40 "patternProperties": { 41 "^\\P{Lu}": { "type": "string" }, 42 "^\\P{Lo}": { "type": "integer" } 43 } 44 }, 45 "complex": { 46 "type": "object", 47 "properties": { 48 "foo": { "type": "number" }, 49 "bar": { "type": "number" } 50 }, 51 "patternProperties": { 52 "^\\P{Lu}": { "type": "string" }, 53 "^\\P{Lo}": { "type": "integer" } 54 }, 55 "additionalProperties": { "type": "string" } 56 }, 57 "multi": { 58 "type": [ "object", "number" ], 59 "properties": { 60 "foo": { "type": "number" }, 61 "bar": { "type": "number" } 62 }, 63 "maxProperties": 5, 64 "minimum": 7 65 } 66 }, 67 "additionalProperties": false 68 } 69 70 -- out/decode/extract -- 71 // Main schema 72 73 import "struct" 74 75 close({ 76 fields?: struct.MinFields(3) & struct.MaxFields(10) & { 77 [=~"^\\P{Lu}"]: _ 78 } 79 additional?: { 80 foo?: number 81 bar?: number 82 {[!~"^(foo|bar)$"]: string} 83 } 84 map?: [string]: string 85 patterns?: { 86 foo?: number 87 bar?: number 88 89 {[=~"^\\P{Lu}" & !~"^(foo|bar)$"]: string} 90 91 {[=~"^\\P{Lo}" & !~"^(foo|bar)$"]: int} 92 ... 93 } 94 patternsNoProps?: { 95 {[=~"^\\P{Lu}"]: string} 96 97 {[=~"^\\P{Lo}"]: int} 98 ... 99 } 100 complex?: { 101 foo?: number 102 bar?: number 103 104 {[=~"^\\P{Lu}" & !~"^(foo|bar)$"]: string} 105 106 {[=~"^\\P{Lo}" & !~"^(foo|bar)$"]: int} 107 {[!~"^\\P{Lu}" & !~"^\\P{Lo}" & !~"^(foo|bar)$"]: string} 108 } 109 multi?: >=7 | struct.MaxFields(5) & { 110 foo?: number 111 bar?: number 112 ... 113 } 114 })