-- in.cue --
import (
	"encoding/json"
)

let defaultPolicy = json.Marshal({ deny: "all" })

#Spec: {
    policy?: string | *defaultPolicy
}

-- out/TestGenerateOpenAPI/out.json --
{
   "openapi": "3.0.0",
   "info": {
      "title": "Generated by cue.",
      "version": "no version"
   },
   "paths": {},
   "components": {
      "schemas": {
         "Spec": {
            "type": "object",
            "properties": {
               "policy": {
                  "type": "string",
                  "default": "{\"deny\":\"all\"}"
               }
            }
         }
      }
   }
}