cuelang.org/go@v0.13.0/encoding/openapi/testdata/structural.txtar (about)

     1  #ExpandReferences
     2  -- in.cue --
     3  import "time"
     4  
     5  #Attributes: {
     6  	//  A map of attribute name to its value.
     7  	attributes: {
     8  		[string]: #AttrValue
     9  	}
    10  }
    11  
    12  //  The attribute value.
    13  #AttrValue: {}
    14  
    15  #AttrValue: {
    16  	//  Used for values of type STRING, DNS_NAME, EMAIL_ADDRESS, and URI
    17  	stringValue: string @protobuf(2,name=string_value)
    18  } | {
    19  	//  Used for values of type INT64
    20  	int64Value: int64 @protobuf(3,name=int64_value)
    21  } | {
    22  	//  Used for values of type DOUBLE
    23  	doubleValue: float64 @protobuf(4,type=double,name=double_value)
    24  } | {
    25  	//  Used for values of type BOOL
    26  	boolValue: bool @protobuf(5,name=bool_value)
    27  } | {
    28  	//  Used for values of type BYTES
    29  	bytesValue: bytes @protobuf(6,name=bytes_value)
    30  } | {
    31  	//  Used for values of type TIMESTAMP
    32  	timestampValue: time.Time @protobuf(7,type=google.protobuf.Timestamp,name=timestamp_value)
    33  } | {
    34  	//  Used for values of type DURATION
    35  	durationValue: time.Duration @protobuf(8,type=google.protobuf.Duration,name=duration_value)
    36  } | {
    37  	//  Used for values of type STRING_MAP
    38  	stringMapValue: #Attributes_StringMap @protobuf(9,type=StringMap,name=string_map_value)
    39  }
    40  
    41  #Attributes_StringMap: {
    42  	//  Holds a set of name/value pairs.
    43  	entries: {
    44  		[string]: string
    45  	} @protobuf(1,type=map<string,string>)
    46  }
    47  
    48  -- out/TestGenerateOpenAPI/out.json --
    49  {
    50     "openapi": "3.0.0",
    51     "info": {
    52        "title": "Generated by cue.",
    53        "version": "no version"
    54     },
    55     "paths": {},
    56     "components": {
    57        "schemas": {
    58           "AttrValue": {
    59              "description": "The attribute value.",
    60              "type": "object",
    61              "properties": {
    62                 "stringValue": {
    63                    "description": "Used for values of type STRING, DNS_NAME, EMAIL_ADDRESS, and URI",
    64                    "type": "string"
    65                 },
    66                 "int64Value": {
    67                    "description": "Used for values of type INT64",
    68                    "type": "integer",
    69                    "format": "int64"
    70                 },
    71                 "doubleValue": {
    72                    "description": "Used for values of type DOUBLE",
    73                    "type": "number",
    74                    "format": "double"
    75                 },
    76                 "boolValue": {
    77                    "description": "Used for values of type BOOL",
    78                    "type": "boolean"
    79                 },
    80                 "bytesValue": {
    81                    "description": "Used for values of type BYTES",
    82                    "type": "string",
    83                    "format": "binary"
    84                 },
    85                 "timestampValue": {
    86                    "description": "Used for values of type TIMESTAMP",
    87                    "type": "string",
    88                    "format": "date-time"
    89                 },
    90                 "durationValue": {
    91                    "description": "Used for values of type DURATION",
    92                    "type": "string"
    93                 },
    94                 "stringMapValue": {
    95                    "description": "Used for values of type STRING_MAP",
    96                    "type": "object",
    97                    "required": [
    98                       "entries"
    99                    ],
   100                    "properties": {
   101                       "entries": {
   102                          "description": "Holds a set of name/value pairs.",
   103                          "type": "object",
   104                          "additionalProperties": {
   105                             "type": "string"
   106                          }
   107                       }
   108                    }
   109                 }
   110              },
   111              "oneOf": [
   112                 {
   113                    "required": [
   114                       "stringValue"
   115                    ]
   116                 },
   117                 {
   118                    "required": [
   119                       "int64Value"
   120                    ]
   121                 },
   122                 {
   123                    "required": [
   124                       "doubleValue"
   125                    ]
   126                 },
   127                 {
   128                    "required": [
   129                       "boolValue"
   130                    ]
   131                 },
   132                 {
   133                    "required": [
   134                       "bytesValue"
   135                    ]
   136                 },
   137                 {
   138                    "required": [
   139                       "timestampValue"
   140                    ]
   141                 },
   142                 {
   143                    "required": [
   144                       "durationValue"
   145                    ]
   146                 },
   147                 {
   148                    "required": [
   149                       "stringMapValue"
   150                    ]
   151                 }
   152              ]
   153           },
   154           "Attributes": {
   155              "type": "object",
   156              "required": [
   157                 "attributes"
   158              ],
   159              "properties": {
   160                 "attributes": {
   161                    "description": "A map of attribute name to its value.",
   162                    "type": "object",
   163                    "additionalProperties": {
   164                       "type": "object",
   165                       "properties": {
   166                          "stringValue": {
   167                             "description": "Used for values of type STRING, DNS_NAME, EMAIL_ADDRESS, and URI",
   168                             "type": "string"
   169                          },
   170                          "int64Value": {
   171                             "description": "Used for values of type INT64",
   172                             "type": "integer",
   173                             "format": "int64"
   174                          },
   175                          "doubleValue": {
   176                             "description": "Used for values of type DOUBLE",
   177                             "type": "number",
   178                             "format": "double"
   179                          },
   180                          "boolValue": {
   181                             "description": "Used for values of type BOOL",
   182                             "type": "boolean"
   183                          },
   184                          "bytesValue": {
   185                             "description": "Used for values of type BYTES",
   186                             "type": "string",
   187                             "format": "binary"
   188                          },
   189                          "timestampValue": {
   190                             "description": "Used for values of type TIMESTAMP",
   191                             "type": "string",
   192                             "format": "date-time"
   193                          },
   194                          "durationValue": {
   195                             "description": "Used for values of type DURATION",
   196                             "type": "string"
   197                          },
   198                          "stringMapValue": {
   199                             "description": "Used for values of type STRING_MAP",
   200                             "type": "object",
   201                             "required": [
   202                                "entries"
   203                             ],
   204                             "properties": {
   205                                "entries": {
   206                                   "description": "Holds a set of name/value pairs.",
   207                                   "type": "object",
   208                                   "additionalProperties": {
   209                                      "type": "string"
   210                                   }
   211                                }
   212                             }
   213                          }
   214                       },
   215                       "oneOf": [
   216                          {
   217                             "required": [
   218                                "stringValue"
   219                             ]
   220                          },
   221                          {
   222                             "required": [
   223                                "int64Value"
   224                             ]
   225                          },
   226                          {
   227                             "required": [
   228                                "doubleValue"
   229                             ]
   230                          },
   231                          {
   232                             "required": [
   233                                "boolValue"
   234                             ]
   235                          },
   236                          {
   237                             "required": [
   238                                "bytesValue"
   239                             ]
   240                          },
   241                          {
   242                             "required": [
   243                                "timestampValue"
   244                             ]
   245                          },
   246                          {
   247                             "required": [
   248                                "durationValue"
   249                             ]
   250                          },
   251                          {
   252                             "required": [
   253                                "stringMapValue"
   254                             ]
   255                          }
   256                       ]
   257                    }
   258                 }
   259              }
   260           },
   261           "Attributes_StringMap": {
   262              "type": "object",
   263              "required": [
   264                 "entries"
   265              ],
   266              "properties": {
   267                 "entries": {
   268                    "description": "Holds a set of name/value pairs.",
   269                    "type": "object",
   270                    "additionalProperties": {
   271                       "type": "string"
   272                    }
   273                 }
   274              }
   275           }
   276        }
   277     }
   278  }