cuelang.org/go@v0.13.0/encoding/openapi/testdata/issue1643.txtar (about) 1 -- in.cue -- 2 #One:{ 3 field1: #Id, 4 if true { #Two} 5 } 6 #Two: { field2: string } 7 #Id: 1 | 2 8 9 -- out/TestGenerateOpenAPI/out.json -- 10 { 11 "openapi": "3.0.0", 12 "info": { 13 "title": "Generated by cue.", 14 "version": "no version" 15 }, 16 "paths": {}, 17 "components": { 18 "schemas": { 19 "Id": { 20 "type": "integer", 21 "enum": [ 22 1, 23 2 24 ] 25 }, 26 "One": { 27 "type": "object", 28 "required": [ 29 "field1", 30 "field2" 31 ], 32 "properties": { 33 "field1": { 34 "$ref": "#/components/schemas/Id" 35 }, 36 "field2": { 37 "type": "string" 38 } 39 } 40 }, 41 "Two": { 42 "type": "object", 43 "required": [ 44 "field2" 45 ], 46 "properties": { 47 "field2": { 48 "type": "string" 49 } 50 } 51 } 52 } 53 } 54 }