cuelang.org/go@v0.13.0/encoding/openapi/testdata/issue3718.txtar (about) 1 -- in.cue -- 2 import ( 3 "encoding/json" 4 ) 5 6 let defaultPolicy = json.Marshal({ deny: "all" }) 7 8 #Spec: { 9 policy?: string | *defaultPolicy 10 } 11 12 -- out/TestGenerateOpenAPI/out.json -- 13 { 14 "openapi": "3.0.0", 15 "info": { 16 "title": "Generated by cue.", 17 "version": "no version" 18 }, 19 "paths": {}, 20 "components": { 21 "schemas": { 22 "Spec": { 23 "type": "object", 24 "properties": { 25 "policy": { 26 "type": "string", 27 "default": "{\"deny\":\"all\"}" 28 } 29 } 30 } 31 } 32 } 33 }