#ExpandReferences
-- in.cue --
import "time"

#Attributes: {
	//  A map of attribute name to its value.
	attributes: {
		[string]: #AttrValue
	}
}

//  The attribute value.
#AttrValue: {}

#AttrValue: {
	//  Used for values of type STRING, DNS_NAME, EMAIL_ADDRESS, and URI
	stringValue: string @protobuf(2,name=string_value)
} | {
	//  Used for values of type INT64
	int64Value: int64 @protobuf(3,name=int64_value)
} | {
	//  Used for values of type DOUBLE
	doubleValue: float64 @protobuf(4,type=double,name=double_value)
} | {
	//  Used for values of type BOOL
	boolValue: bool @protobuf(5,name=bool_value)
} | {
	//  Used for values of type BYTES
	bytesValue: bytes @protobuf(6,name=bytes_value)
} | {
	//  Used for values of type TIMESTAMP
	timestampValue: time.Time @protobuf(7,type=google.protobuf.Timestamp,name=timestamp_value)
} | {
	//  Used for values of type DURATION
	durationValue: time.Duration @protobuf(8,type=google.protobuf.Duration,name=duration_value)
} | {
	//  Used for values of type STRING_MAP
	stringMapValue: #Attributes_StringMap @protobuf(9,type=StringMap,name=string_map_value)
}

#Attributes_StringMap: {
	//  Holds a set of name/value pairs.
	entries: {
		[string]: string
	} @protobuf(1,type=map<string,string>)
}

-- out/TestGenerateOpenAPI/out.json --
{
   "openapi": "3.0.0",
   "info": {
      "title": "Generated by cue.",
      "version": "no version"
   },
   "paths": {},
   "components": {
      "schemas": {
         "AttrValue": {
            "description": "The attribute value.",
            "type": "object",
            "properties": {
               "stringValue": {
                  "description": "Used for values of type STRING, DNS_NAME, EMAIL_ADDRESS, and URI",
                  "type": "string"
               },
               "int64Value": {
                  "description": "Used for values of type INT64",
                  "type": "integer",
                  "format": "int64"
               },
               "doubleValue": {
                  "description": "Used for values of type DOUBLE",
                  "type": "number",
                  "format": "double"
               },
               "boolValue": {
                  "description": "Used for values of type BOOL",
                  "type": "boolean"
               },
               "bytesValue": {
                  "description": "Used for values of type BYTES",
                  "type": "string",
                  "format": "binary"
               },
               "timestampValue": {
                  "description": "Used for values of type TIMESTAMP",
                  "type": "string",
                  "format": "date-time"
               },
               "durationValue": {
                  "description": "Used for values of type DURATION",
                  "type": "string"
               },
               "stringMapValue": {
                  "description": "Used for values of type STRING_MAP",
                  "type": "object",
                  "required": [
                     "entries"
                  ],
                  "properties": {
                     "entries": {
                        "description": "Holds a set of name/value pairs.",
                        "type": "object",
                        "additionalProperties": {
                           "type": "string"
                        }
                     }
                  }
               }
            },
            "oneOf": [
               {
                  "required": [
                     "stringValue"
                  ]
               },
               {
                  "required": [
                     "int64Value"
                  ]
               },
               {
                  "required": [
                     "doubleValue"
                  ]
               },
               {
                  "required": [
                     "boolValue"
                  ]
               },
               {
                  "required": [
                     "bytesValue"
                  ]
               },
               {
                  "required": [
                     "timestampValue"
                  ]
               },
               {
                  "required": [
                     "durationValue"
                  ]
               },
               {
                  "required": [
                     "stringMapValue"
                  ]
               }
            ]
         },
         "Attributes": {
            "type": "object",
            "required": [
               "attributes"
            ],
            "properties": {
               "attributes": {
                  "description": "A map of attribute name to its value.",
                  "type": "object",
                  "additionalProperties": {
                     "type": "object",
                     "properties": {
                        "stringValue": {
                           "description": "Used for values of type STRING, DNS_NAME, EMAIL_ADDRESS, and URI",
                           "type": "string"
                        },
                        "int64Value": {
                           "description": "Used for values of type INT64",
                           "type": "integer",
                           "format": "int64"
                        },
                        "doubleValue": {
                           "description": "Used for values of type DOUBLE",
                           "type": "number",
                           "format": "double"
                        },
                        "boolValue": {
                           "description": "Used for values of type BOOL",
                           "type": "boolean"
                        },
                        "bytesValue": {
                           "description": "Used for values of type BYTES",
                           "type": "string",
                           "format": "binary"
                        },
                        "timestampValue": {
                           "description": "Used for values of type TIMESTAMP",
                           "type": "string",
                           "format": "date-time"
                        },
                        "durationValue": {
                           "description": "Used for values of type DURATION",
                           "type": "string"
                        },
                        "stringMapValue": {
                           "description": "Used for values of type STRING_MAP",
                           "type": "object",
                           "required": [
                              "entries"
                           ],
                           "properties": {
                              "entries": {
                                 "description": "Holds a set of name/value pairs.",
                                 "type": "object",
                                 "additionalProperties": {
                                    "type": "string"
                                 }
                              }
                           }
                        }
                     },
                     "oneOf": [
                        {
                           "required": [
                              "stringValue"
                           ]
                        },
                        {
                           "required": [
                              "int64Value"
                           ]
                        },
                        {
                           "required": [
                              "doubleValue"
                           ]
                        },
                        {
                           "required": [
                              "boolValue"
                           ]
                        },
                        {
                           "required": [
                              "bytesValue"
                           ]
                        },
                        {
                           "required": [
                              "timestampValue"
                           ]
                        },
                        {
                           "required": [
                              "durationValue"
                           ]
                        },
                        {
                           "required": [
                              "stringMapValue"
                           ]
                        }
                     ]
                  }
               }
            }
         },
         "Attributes_StringMap": {
            "type": "object",
            "required": [
               "entries"
            ],
            "properties": {
               "entries": {
                  "description": "Holds a set of name/value pairs.",
                  "type": "object",
                  "additionalProperties": {
                     "type": "string"
                  }
               }
            }
         }
      }
   }
}
