cuelang.org/go@v0.13.0/encoding/jsonschema/testdata/txtar/ifthenelse.txtar (about) 1 -- schema.json -- 2 { 3 "$schema": "https://json-schema.org/draft/2019-09/schema", 4 "$id": "https://foo.example/schema", 5 "if": { 6 "properties": { 7 "a": { 8 "type": "number" 9 } 10 }, 11 "required": [ 12 "a" 13 ] 14 }, 15 "then": { 16 "properties": { 17 "b": { 18 "type": "number" 19 } 20 }, 21 "required": [ 22 "b" 23 ] 24 }, 25 "type": "object", 26 "properties": { 27 "c": { 28 "type": "string" 29 } 30 } 31 } 32 -- out/decode/extract -- 33 @jsonschema(schema="https://json-schema.org/draft/2019-09/schema") 34 @jsonschema(id="https://foo.example/schema") 35 matchIf({ 36 a!: number 37 ... 38 }, { 39 b!: number 40 ... 41 }, _) & { 42 c?: string 43 ... 44 }