cuelang.org/go@v0.13.0/encoding/openapi/testdata/embed.txtar (about) 1 -- in.cue -- 2 #Foo: string 3 4 #LoadBalancerSettings: { 5 {} | { 6 consistentHash: #ConsistentHashLB 7 b: #Foo 8 } 9 #ConsistentHashLB: {} | { 10 httpHeaderName: string 11 } 12 } 13 14 -- out/TestGenerateOpenAPI/out.json -- 15 { 16 "openapi": "3.0.0", 17 "info": { 18 "title": "Generated by cue.", 19 "version": "no version" 20 }, 21 "paths": {}, 22 "components": { 23 "schemas": { 24 "Foo": { 25 "type": "string" 26 }, 27 "LoadBalancerSettings": { 28 "type": "object", 29 "oneOf": [ 30 { 31 "not": { 32 "anyOf": [ 33 { 34 "required": [ 35 "consistentHash", 36 "b" 37 ], 38 "properties": { 39 "consistentHash": { 40 "$ref": "#/components/schemas/LoadBalancerSettings.ConsistentHashLB" 41 }, 42 "b": { 43 "$ref": "#/components/schemas/Foo" 44 } 45 } 46 } 47 ] 48 } 49 }, 50 { 51 "required": [ 52 "consistentHash", 53 "b" 54 ], 55 "properties": { 56 "consistentHash": { 57 "$ref": "#/components/schemas/LoadBalancerSettings.ConsistentHashLB" 58 }, 59 "b": { 60 "$ref": "#/components/schemas/Foo" 61 } 62 } 63 } 64 ] 65 }, 66 "LoadBalancerSettings.ConsistentHashLB": { 67 "type": "object", 68 "oneOf": [ 69 { 70 "not": { 71 "anyOf": [ 72 { 73 "required": [ 74 "httpHeaderName" 75 ], 76 "properties": { 77 "httpHeaderName": { 78 "type": "string" 79 } 80 } 81 } 82 ] 83 } 84 }, 85 { 86 "required": [ 87 "httpHeaderName" 88 ], 89 "properties": { 90 "httpHeaderName": { 91 "type": "string" 92 } 93 } 94 } 95 ] 96 } 97 } 98 } 99 }