this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

encoding/protobuf: always include type as second argument

This significanty simplifies finding the right mapping from
CUE to protobuf.

Also changed map type from map<A,B> to map[A]B. The former
caused issues as the comma caused it to be a separate
attribute argument (<> is not matched). Encosing it in
quotes was also annoying.

We considered using [A]:B, but using the map notation allows
for more extendibility and less ambiguity in case we must
support lists for some reason.

This is a backwards incompatible change.

Issue #5

Change-Id: Ief64d0c91d481fd7b03a4a8842faf377fd364a26
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/9368
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
Reviewed-by: CUE cueckoo <cueckoo@gmail.com>
Reviewed-by: Paul Jolly <paul@myitcv.org.uk>

+468 -444
+16 -1
cmd/cue/cmd/get_go.go
··· 1210 1210 } 1211 1211 1212 1212 // Carry over protobuf field tags with modifications. 1213 - if t := reflect.StructTag(tag).Get("protobuf"); t != "" { 1213 + // TODO: consider trashing the protobuf tag, as the Go versions are 1214 + // lossy and will not allow for an accurate translation in some cases. 1215 + tags := reflect.StructTag(tag) 1216 + if t := tags.Get("protobuf"); t != "" { 1214 1217 split := strings.Split(t, ",") 1215 1218 k := 0 1216 1219 for _, s := range split { ··· 1227 1230 if len(split) >= 2 { 1228 1231 split[0], split[1] = split[1], split[0] 1229 1232 } 1233 + 1234 + // Interpret as map? 1235 + if len(split) > 2 && split[1] == "bytes" { 1236 + tk := tags.Get("protobuf_key") 1237 + tv := tags.Get("protobuf_val") 1238 + if tk != "" && tv != "" { 1239 + tk = strings.SplitN(tk, ",", 2)[0] 1240 + tv = strings.SplitN(tv, ",", 2)[0] 1241 + split[1] = fmt.Sprintf("map[%s]%s", tk, tv) 1242 + } 1243 + } 1244 + 1230 1245 e.addAttr(field, "protobuf", strings.Join(split, ",")) 1231 1246 } 1232 1247
+9 -9
cmd/cue/cmd/testdata/script/def_proto.txt
··· 11 11 // A map of attribute name to its value. 12 12 attributes?: { 13 13 [string]: #AttributeValue 14 - } @protobuf(1,type=map<string,AttributeValue>) 14 + } @protobuf(1,map[string]AttributeValue) 15 15 16 16 // Specifies one attribute value with different type. 17 17 #AttributeValue: {} | { 18 - stringValue: string @protobuf(2,name=string_value) 18 + stringValue: string @protobuf(2,string,name=string_value) 19 19 } | { 20 - int64Value: int64 @protobuf(3,name=int64_value) 20 + int64Value: int64 @protobuf(3,int64,name=int64_value) 21 21 } | { 22 - doubleValue: float64 @protobuf(4,type=double,name=double_value) 22 + doubleValue: float64 @protobuf(4,double,name=double_value) 23 23 } | { 24 - boolValue: bool @protobuf(5,name=bool_value) 24 + boolValue: bool @protobuf(5,bool,name=bool_value) 25 25 } | { 26 - bytesValue: bytes @protobuf(6,name=bytes_value) 26 + bytesValue: bytes @protobuf(6,bytes,name=bytes_value) 27 27 } | { 28 - timestampValue: time.Time @protobuf(7,type=google.protobuf.Timestamp,name=timestamp_value) 28 + timestampValue: time.Time @protobuf(7,google.protobuf.Timestamp,name=timestamp_value) 29 29 } | { 30 30 // Used for values of type STRING_MAP 31 - stringMapValue: #StringMap @protobuf(9,name=string_map_value) 31 + stringMapValue: #StringMap @protobuf(9,StringMap,name=string_map_value) 32 32 } 33 33 34 34 // Defines a string map. ··· 36 36 // Holds a set of name/value pairs. 37 37 entries?: { 38 38 [string]: string 39 - } @protobuf(1,type=map<string,string>) 39 + } @protobuf(1,map[string]string) 40 40 } 41 41 } 42 42 -- policy.proto --
+57 -50
cmd/cue/cmd/testdata/script/get_go_types.txt
··· 70 70 71 71 Alias1 *MyBarzer 72 72 73 - Map map[string]*CustomJSON 73 + // Note: Go encodings of protobuf tags are lossy. So this is a best-effort 74 + // thing. 75 + Map map[string]*CustomJSON `protobuf:"bytes,1,name=intf" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` 74 76 Slice1 []int 75 77 Slice2 []interface{} 76 78 Slice3 *[]json.Unmarshaler ··· 222 224 package pkg1 223 225 224 226 import ( 225 - "time" 226 - p2 "example.com/pkg2:pkgtwo" 227 + "time" 228 + p2 "example.com/pkg2:pkgtwo" 227 229 ) 228 230 229 231 // Foozer foozes a jaman. 230 232 #Foozer: { 231 - Int: int 232 - String: string 233 + Int: int 234 + String: string 233 235 234 - #Inline 235 - NoInline: #NoInline 236 - CustomJSON: #CustomJSON 237 - CustomYAML?: null | #CustomYAML @go(,*CustomYAML) 238 - AnyJSON: _ @go(,json.Marshaler) 239 - AnyText: string @go(,encoding.TextMarshaler) 240 - bar?: int & >10 @go(Bar) 236 + #Inline 237 + NoInline: #NoInline 238 + CustomJSON: #CustomJSON 239 + CustomYAML?: null | #CustomYAML @go(,*CustomYAML) 240 + AnyJSON: _ @go(,json.Marshaler) 241 + AnyText: string @go(,encoding.TextMarshaler) 242 + bar?: int & >10 @go(Bar) 241 243 242 - // Time is mapped to CUE's internal type. 243 - Time: time.Time 244 - Barzer: p2.#Barzer 245 - Alias1?: null | p2.#Barzer @go(,*p2.Barzer) 246 - Map: {[string]: null | #CustomJSON} @go(,map[string]*CustomJSON) 247 - Slice1: [...int] @go(,[]int) 248 - Slice2: [...] @go(,[]interface{}) 249 - Slice3?: null | [...] @go(,*[]json.Unmarshaler) 250 - Array1: 5 * [int] @go(,[5]int) 251 - Array2: 5 * [_] @go(,[5]interface{}) 252 - Array3?: null | 5*[_] @go(,*[5]json.Marshaler) 253 - Intf: #Interface @protobuf(2,varint,name=intf) 254 - Intf2: _ @go(,interface{}) 255 - Intf3: { 256 - Interface: #Interface 257 - } @go(,struct{Interface}) 258 - Intf4: _ @go(,"interface{Foo()}") 244 + // Time is mapped to CUE's internal type. 245 + Time: time.Time 246 + Barzer: p2.#Barzer 247 + Alias1?: null | p2.#Barzer @go(,*p2.Barzer) 248 + Map: {[string]: null | #CustomJSON} @go(,map[string]*CustomJSON) 249 + Slice1: [...int] @go(,[]int) 250 + Slice2: [...] @go(,[]interface{}) 251 + Slice3?: null | [...] @go(,*[]json.Unmarshaler) 252 + Array1: 5 * [int] @go(,[5]int) 253 + Array2: 5 * [_] @go(,[5]interface{}) 254 + Array3?: null | 5*[_] @go(,*[5]json.Marshaler) 255 + Intf: #Interface @protobuf(2,varint,name=intf) 256 + Intf2: _ @go(,interface{}) 257 + Intf3: { 258 + Interface: #Interface 259 + } @go(,struct{Interface}) 260 + Intf4: _ @go(,"interface{Foo()}") 259 261 260 - // Even though this struct as a type implements MarshalJSON, it is known 261 - // that it is really only implemented by the embedded field. 262 - Embed: { 263 - CustomJSON: #CustomJSON 264 - } @go(,struct{CustomJSON}) 262 + // Even though this struct as a type implements MarshalJSON, it is known 263 + // that it is really only implemented by the embedded field. 264 + Embed: { 265 + CustomJSON: #CustomJSON 266 + } @go(,struct{CustomJSON}) 265 267 } 266 268 267 269 #Identifier: string // #enumIdentifier 268 270 269 271 #enumIdentifier: 270 - _#internalIdentifier 272 + _#internalIdentifier 271 273 272 274 _#internalIdentifier: #Identifier & "internal" 273 275 ··· 275 277 #Level: int // #enumLevel 276 278 277 279 #enumLevel: 278 - #Unknown | 279 - #Low | 280 - #Medium | 281 - #High 280 + #Unknown | 281 + #Low | 282 + #Medium | 283 + #High 282 284 283 285 // Block comment. 284 286 // Indented. ··· 317 319 318 320 // A Barzer barzes. 319 321 #Barzer: { 320 - a: int @go(A) @protobuf(2,varint,) 321 - T: t.Time 322 - B?: null | int @go(,*big.Int) 323 - C: int @go(,big.Int) 324 - F: string @go(,big.Float) @xml(,attr) 325 - G?: null | string @go(,*big.Float) 326 - S: string 327 - "x-y": bool @go(XY) 328 - Err: _ @go(,error) 322 + a: int @go(A) @protobuf(2,varint,) 323 + T: t.Time 324 + B?: null | int @go(,*big.Int) 325 + C: int @go(,big.Int) 326 + F: string @go(,big.Float) @xml(,attr) 327 + G?: null | string @go(,*big.Float) 328 + S: string 329 + "x-y": bool @go(XY) 330 + Err: _ @go(,error) 329 331 330 - #Inline 332 + #Inline 331 333 } 332 334 333 335 #Perm: 0o755 ··· 335 337 #Few: 3 336 338 337 339 #Couple: int & 2 340 + 341 + #LongStringConst: "This is a really long string. Why are we using a long string? Because that way it ensures we are using go/constant.Value.ExactString() instead of go/constant.Value.String()" 338 342 339 343 #Inline: A: int 340 344 -- pkg3/pkg3_go_gen.cue -- ··· 388 392 Time: time.Time 389 393 Barzer: p2.#Barzer 390 394 Alias1?: null | p2.#Barzer @go(,*p2.Barzer) 391 - Map: {[string]: null | #CustomJSON} @go(,map[string]*CustomJSON) 395 + 396 + // Note: Go encodings of protobuf tags are lossy. So this is a best-effort 397 + // thing. 398 + Map: {[string]: null | #CustomJSON} @go(,map[string]*CustomJSON) @protobuf(1,map[bytes]bytes,name=intf) 392 399 Slice1: [...int] @go(,[]int) 393 400 Slice2: [...] @go(,[]interface{}) 394 401 Slice3?: null | [...] @go(,*[]json.Unmarshaler)
+18 -18
cmd/cue/cmd/testdata/script/import_proto.txt
··· 4 4 5 5 cmp stderr expect-stderr 6 6 cmp stdout expect-stdout 7 - cmp expect-attributes_proto_gen.cue root/mixer/v1/attributes_proto_gen.cue 8 - cmp expect-client_config_proto_gen.cue root/mixer/v1/config/client/client_config_proto_gen.cue 9 - cmp expect-test_proto_gen.cue root/cue.mod/gen/googleapis.com/acme/test/test_proto_gen.cue 7 + cmp root/mixer/v1/attributes_proto_gen.cue expect-attributes_proto_gen.cue 8 + cmp root/mixer/v1/config/client/client_config_proto_gen.cue expect-client_config_proto_gen.cue 9 + cmp root/cue.mod/gen/googleapis.com/acme/test/test_proto_gen.cue expect-test_proto_gen.cue 10 10 11 11 -- expect-stdout -- 12 12 -- expect-stderr -- ··· 174 174 // A map of attribute name to its value. 175 175 attributes?: { 176 176 [string]: #AttributeValue 177 - } @protobuf(1,type=map<string,AttributeValue>) 177 + } @protobuf(1,map[string]AttributeValue) 178 178 179 179 // Specifies one attribute value with different type. 180 180 #AttributeValue: { 181 181 // The attribute value. 182 182 {} | { 183 - stringValue: string @protobuf(2,name=string_value) 183 + stringValue: string @protobuf(2,string,name=string_value) 184 184 } | { 185 - int64Value: int64 @protobuf(3,name=int64_value) 185 + int64Value: int64 @protobuf(3,int64,name=int64_value) 186 186 } | { 187 - doubleValue: float64 @protobuf(4,type=double,name=double_value) 187 + doubleValue: float64 @protobuf(4,double,name=double_value) 188 188 } | { 189 - boolValue: bool @protobuf(5,name=bool_value) 189 + boolValue: bool @protobuf(5,bool,name=bool_value) 190 190 } | { 191 - bytesValue: bytes @protobuf(6,name=bytes_value) 191 + bytesValue: bytes @protobuf(6,bytes,name=bytes_value) 192 192 } | { 193 - timestampValue: time.Time @protobuf(7,type=google.protobuf.Timestamp,name=timestamp_value) 193 + timestampValue: time.Time @protobuf(7,google.protobuf.Timestamp,name=timestamp_value) 194 194 } | { 195 195 // Used for values of type STRING_MAP 196 - stringMapValue: #StringMap @protobuf(9,name=string_map_value) 196 + stringMapValue: #StringMap @protobuf(9,StringMap,name=string_map_value) 197 197 } | { 198 - testValue: test.#Test @protobuf(10,type=acme.test.Test,name=test_value) 198 + testValue: test.#Test @protobuf(10,acme.test.Test,name=test_value) 199 199 } | { 200 - testValue: test_test.#AnotherTest @protobuf(11,type=acme.test.test.AnotherTest,name=test_value) 200 + testValue: test_test.#AnotherTest @protobuf(11,acme.test.test.AnotherTest,name=test_value) 201 201 } 202 202 } 203 203 ··· 206 206 // Holds a set of name/value pairs. 207 207 entries?: { 208 208 [string]: string 209 - } @protobuf(1,type=map<string,string>) 209 + } @protobuf(1,map[string]string) 210 210 } 211 211 } 212 212 -- expect-client_config_proto_gen.cue -- ··· 217 217 218 218 // Defines the per-service client configuration. 219 219 #ServiceConfig: { 220 - disableCheckCalls?: bool @protobuf(1,name=disable_check_calls) 221 - disableReportCalls?: bool @protobuf(2,name=disable_report_calls) 222 - mixerAttributes?: v1.#Attributes @protobuf(3,type=Attributes,name=mixer_attributes) 220 + disableCheckCalls?: bool @protobuf(1,bool,name=disable_check_calls) 221 + disableReportCalls?: bool @protobuf(2,bool,name=disable_report_calls) 222 + mixerAttributes?: v1.#Attributes @protobuf(3,Attributes,name=mixer_attributes) 223 223 } 224 224 -- expect-test_proto_gen.cue -- 225 225 package test 226 226 227 227 #Test: { 228 - test?: int32 @protobuf(1) 228 + test?: int32 @protobuf(1,int32) 229 229 }
+9 -1
cue/types.go
··· 2275 2275 // and reports the value if found. It reports an error if the attribute is 2276 2276 // invalid or if the first pos-1 entries are not defined. 2277 2277 func (a *Attribute) Lookup(pos int, key string) (val string, found bool, err error) { 2278 - return a.attr.Lookup(pos, key) 2278 + val, found, err = a.attr.Lookup(pos, key) 2279 + 2280 + // TODO: remove at some point. This is an ugly hack to simulate the old 2281 + // behavior of protobufs. 2282 + if !found && a.attr.Name == "protobuf" && key == "type" { 2283 + val, err = a.String(1) 2284 + found = err == nil 2285 + } 2286 + return val, found, err 2279 2287 } 2280 2288 2281 2289 // Expr reports the operation of the underlying expression and the values it
+3 -3
encoding/protobuf/examples_test.go
··· 47 47 // 48 48 // // This is my type. 49 49 // #MyType: { 50 - // stringValue?: string @protobuf(1,name=string_value) // just any 'ole string 50 + // stringValue?: string @protobuf(1,string,name=string_value) // just any 'ole string 51 51 // 52 52 // // A method must start with a capital letter. 53 - // method?: [...string] @protobuf(2) 53 + // method?: [...string] @protobuf(2,string) 54 54 // method?: [...=~"^[A-Z]"] 55 55 // exampleMap?: { 56 56 // [string]: string 57 - // } @protobuf(3,type=map<string,string>,example_map) 57 + // } @protobuf(3,map[string]string,example_map) 58 58 // } 59 59 }
+3 -9
encoding/protobuf/parse.go
··· 30 30 "cuelang.org/go/cue/ast" 31 31 "cuelang.org/go/cue/ast/astutil" 32 32 "cuelang.org/go/cue/errors" 33 - "cuelang.org/go/cue/format" 34 33 "cuelang.org/go/cue/literal" 35 34 "cuelang.org/go/cue/parser" 36 35 "cuelang.org/go/cue/token" ··· 520 519 addComments(f, i, x.Comment, x.InlineComment) 521 520 522 521 o := optionParser{message: s, field: f} 523 - o.tags = fmt.Sprintf("%d,type=map<%s,%s>", x.Sequence, x.KeyType, x.Type) 522 + o.tags = fmt.Sprintf(`%d,map[%s]%s`, x.Sequence, x.KeyType, x.Type) 524 523 if x.Name != name.Name { 525 524 o.tags += "," + x.Name 526 525 } ··· 718 717 719 718 o := optionParser{message: s, field: f} 720 719 721 - // body of @protobuf tag: sequence[,type][,name=<name>][,...] 722 - o.tags += fmt.Sprint(x.Sequence) 723 - b, _ := format.Node(typ) 724 - str := string(b) 725 - if x.Type != strings.TrimLeft(str, "#") { 726 - o.tags += ",type=" + x.Type 727 - } 720 + // body of @protobuf tag: sequence,type[,name=<name>][,...] 721 + o.tags += fmt.Sprintf("%v,%s", x.Sequence, x.Type) 728 722 if x.Name != name.Name { 729 723 o.tags += ",name=" + x.Name 730 724 }
+28 -28
encoding/protobuf/testdata/attributes.proto.out.cue
··· 21 21 ) 22 22 23 23 #StructWrap: { 24 - struct?: {} @protobuf(1,type=google.protobuf.Struct) 25 - any?: _ @protobuf(2,type=google.protobuf.Value) 26 - listVal?: [...] @protobuf(3,type=google.protobuf.ListValue) 27 - boolVal?: bool @protobuf(4,type=google.protobuf.BoolValue) 28 - stringVal?: string @protobuf(5,type=google.protobuf.StringValue) 29 - numberVal?: number @protobuf(6,type=google.protobuf.NumberValue) 24 + struct?: {} @protobuf(1,google.protobuf.Struct) 25 + any?: _ @protobuf(2,google.protobuf.Value) 26 + listVal?: [...] @protobuf(3,google.protobuf.ListValue) 27 + boolVal?: bool @protobuf(4,google.protobuf.BoolValue) 28 + stringVal?: string @protobuf(5,google.protobuf.StringValue) 29 + numberVal?: number @protobuf(6,google.protobuf.NumberValue) 30 30 } 31 31 32 32 // Attributes represents a set of typed name/value pairs. Many of Mixer's ··· 50 50 // A map of attribute name to its value. 51 51 attributes?: { 52 52 [string]: #AttributeValue 53 - } @protobuf(1,type=map<string,AttributeValue>) 53 + } @protobuf(1,map[string]AttributeValue) 54 54 55 55 // Specifies one attribute value with different type. 56 56 #AttributeValue: { 57 57 // The attribute value. 58 58 {} | { 59 59 // Used for values of type STRING, DNS_NAME, EMAIL_ADDRESS, and URI 60 - stringValue: string @protobuf(2,name=string_value) 60 + stringValue: string @protobuf(2,string,name=string_value) 61 61 } | { 62 62 // Used for values of type INT64 63 - int64Value: int64 @protobuf(3,name=int64_value) 63 + int64Value: int64 @protobuf(3,int64,name=int64_value) 64 64 } | { 65 65 // Used for values of type DOUBLE 66 - doubleValue: float64 @protobuf(4,type=double,name=double_value) 66 + doubleValue: float64 @protobuf(4,double,name=double_value) 67 67 } | { 68 68 // Used for values of type BOOL 69 - boolValue: bool @protobuf(5,name=bool_value) 69 + boolValue: bool @protobuf(5,bool,name=bool_value) 70 70 } | { 71 71 // Used for values of type BYTES 72 - bytesValue: bytes @protobuf(6,name=bytes_value) 72 + bytesValue: bytes @protobuf(6,bytes,name=bytes_value) 73 73 } | { 74 74 // Used for values of type TIMESTAMP 75 - timestampValue: time.Time @protobuf(7,type=google.protobuf.Timestamp,name=timestamp_value) 75 + timestampValue: time.Time @protobuf(7,google.protobuf.Timestamp,name=timestamp_value) 76 76 } | { 77 77 // Used for values of type DURATION 78 - durationValue: time.Duration @protobuf(8,type=google.protobuf.Duration,name=duration_value) 78 + durationValue: time.Duration @protobuf(8,google.protobuf.Duration,name=duration_value) 79 79 } | { 80 80 // Used for values of type STRING_MAP 81 - stringMapValue: #StringMap @protobuf(9,name=string_map_value) 81 + stringMapValue: #StringMap @protobuf(9,StringMap,name=string_map_value) 82 82 } | { 83 - testValue: test.#Test @protobuf(10,type=acme.test.Test,name=test_value) 83 + testValue: test.#Test @protobuf(10,acme.test.Test,name=test_value) 84 84 } | { 85 - testValue: test_test.#AnotherTest @protobuf(11,type=acme.test.test.AnotherTest,name=test_value) 85 + testValue: test_test.#AnotherTest @protobuf(11,acme.test.test.AnotherTest,name=test_value) 86 86 } 87 87 } 88 88 ··· 91 91 // Holds a set of name/value pairs. 92 92 entries?: { 93 93 [string]: string 94 - } @protobuf(1,type=map<string,string>) 94 + } @protobuf(1,map[string]string) 95 95 } 96 96 } 97 97 ··· 104 104 // configuration. 105 105 #CompressedAttributes: { 106 106 // The message-level dictionary. 107 - words?: [...string] @protobuf(1) 107 + words?: [...string] @protobuf(1,string) 108 108 109 109 // Holds attributes of type STRING, DNS_NAME, EMAIL_ADDRESS, URI 110 110 strings?: { 111 111 [string]: int32 112 - } @protobuf(2,type=map<sint32,sint32>) 112 + } @protobuf(2,map[sint32]sint32) 113 113 114 114 // Holds attributes of type INT64 115 115 int64s?: { 116 116 [string]: int64 117 - } @protobuf(3,type=map<sint32,int64>) 117 + } @protobuf(3,map[sint32]int64) 118 118 119 119 // Holds attributes of type DOUBLE 120 120 doubles?: { 121 121 [string]: float64 122 - } @protobuf(4,type=map<sint32,double>) 122 + } @protobuf(4,map[sint32]double) 123 123 124 124 // Holds attributes of type BOOL 125 125 bools?: { 126 126 [string]: bool 127 - } @protobuf(5,type=map<sint32,bool>) 127 + } @protobuf(5,map[sint32]bool) 128 128 129 129 // Holds attributes of type TIMESTAMP 130 130 time?: { 131 131 [string]: time_1.Time 132 - } @protobuf(6,type=map<sint32,google.protobuf.Timestamp>,"(gogoproto.nullable)=false","(gogoproto.stdtime)") 132 + } @protobuf(6,map[sint32]google.protobuf.Timestamp,"(gogoproto.nullable)=false","(gogoproto.stdtime)") 133 133 134 134 // Holds attributes of type DURATION 135 135 durations?: { 136 136 [string]: time_1.Duration 137 - } @protobuf(7,type=map<sint32,google.protobuf.Duration>,"(gogoproto.nullable)=false","(gogoproto.stdduration)") 137 + } @protobuf(7,map[sint32]google.protobuf.Duration,"(gogoproto.nullable)=false","(gogoproto.stdduration)") 138 138 139 139 // Holds attributes of type BYTES 140 140 bytes?: { 141 141 [string]: bytes_5 142 - } @protobuf(8,type=map<sint32,bytes>) 142 + } @protobuf(8,map[sint32]bytes) 143 143 144 144 // Holds attributes of type STRING_MAP 145 145 stringMaps?: { 146 146 [string]: #StringMap 147 - } @protobuf(9,type=map<sint32,StringMap>,string_maps,"(gogoproto.nullable)=false") 147 + } @protobuf(9,map[sint32]StringMap,string_maps,"(gogoproto.nullable)=false") 148 148 } 149 149 150 150 // A map of string to string. The keys and values in this map are dictionary ··· 153 153 // Holds a set of name/value pairs. 154 154 entries?: { 155 155 [string]: int32 156 - } @protobuf(1,type=map<sint32,sint32>) 156 + } @protobuf(1,map[sint32]sint32) 157 157 } 158 158 159 159 let bytes_5 = bytes
+30 -30
encoding/protobuf/testdata/client_config.proto.out.cue
··· 35 35 #FailPolicy_value: FAIL_OPEN: 0 36 36 37 37 // Specifies the behavior when the client is unable to connect to Mixer. 38 - policy?: #FailPolicy @protobuf(1) 38 + policy?: #FailPolicy @protobuf(1,FailPolicy) 39 39 40 40 // Max retries on transport error. 41 - maxRetry?: uint32 @protobuf(2,name=max_retry) 41 + maxRetry?: uint32 @protobuf(2,uint32,name=max_retry) 42 42 43 43 // Base time to wait between retries. Will be adjusted by exponential 44 44 // backoff and jitter. 45 - baseRetryWait?: time.Duration @protobuf(3,type=google.protobuf.Duration,name=base_retry_wait) 45 + baseRetryWait?: time.Duration @protobuf(3,google.protobuf.Duration,name=base_retry_wait) 46 46 47 47 // Max time to wait between retries. 48 - maxRetryWait?: time.Duration @protobuf(4,type=google.protobuf.Duration,name=max_retry_wait) 48 + maxRetryWait?: time.Duration @protobuf(4,google.protobuf.Duration,name=max_retry_wait) 49 49 } 50 50 51 51 // Defines the per-service client configuration. 52 52 #ServiceConfig: { 53 53 // If true, do not call Mixer Check. 54 - disableCheckCalls?: bool @protobuf(1,name=disable_check_calls) 54 + disableCheckCalls?: bool @protobuf(1,bool,name=disable_check_calls) 55 55 56 56 // If true, do not call Mixer Report. 57 - disableReportCalls?: bool @protobuf(2,name=disable_report_calls) 57 + disableReportCalls?: bool @protobuf(2,bool,name=disable_report_calls) 58 58 59 59 // Send these attributes to Mixer in both Check and Report. This 60 60 // typically includes the "destination.service" attribute. 61 61 // In case of a per-route override, per-route attributes take precedence 62 62 // over the attributes supplied in the client configuration. 63 - mixerAttributes?: v1.#Attributes @protobuf(3,type=Attributes,name=mixer_attributes) 63 + mixerAttributes?: v1.#Attributes @protobuf(3,Attributes,name=mixer_attributes) 64 64 65 65 // HTTP API specifications to generate API attributes. 66 - httpApiSpec?: [...#HTTPAPISpec] @protobuf(4,name=http_api_spec) 66 + httpApiSpec?: [...#HTTPAPISpec] @protobuf(4,HTTPAPISpec,name=http_api_spec) 67 67 68 68 // Quota specifications to generate quota requirements. 69 - quotaSpec?: [...#QuotaSpec] @protobuf(5,name=quota_spec) 69 + quotaSpec?: [...#QuotaSpec] @protobuf(5,QuotaSpec,name=quota_spec) 70 70 71 71 // Specifies the behavior when the client is unable to connect to Mixer. 72 72 // This is the service-level policy. It overrides 73 73 // [mesh-level 74 74 // policy][istio.mixer.v1.config.client.TransportConfig.network_fail_policy]. 75 - networkFailPolicy?: #NetworkFailPolicy @protobuf(7,name=network_fail_policy) 75 + networkFailPolicy?: #NetworkFailPolicy @protobuf(7,NetworkFailPolicy,name=network_fail_policy) 76 76 77 77 // Default attributes to forward to upstream. This typically 78 78 // includes the "source.ip" and "source.uid" attributes. ··· 86 86 // 3. forwarded attributes from the source filter config (if any); 87 87 // 4. forwarded attributes from the source route config (if any); 88 88 // 5. derived attributes from the request metadata. 89 - forwardAttributes?: v1.#Attributes @protobuf(8,type=Attributes,name=forward_attributes) 89 + forwardAttributes?: v1.#Attributes @protobuf(8,Attributes,name=forward_attributes) 90 90 } 91 91 92 92 // Defines the transport config on how to call Mixer. 93 93 #TransportConfig: { 94 94 // The flag to disable check cache. 95 - disableCheckCache?: bool @protobuf(1,name=disable_check_cache) 95 + disableCheckCache?: bool @protobuf(1,bool,name=disable_check_cache) 96 96 97 97 // The flag to disable quota cache. 98 - disableQuotaCache?: bool @protobuf(2,name=disable_quota_cache) 98 + disableQuotaCache?: bool @protobuf(2,bool,name=disable_quota_cache) 99 99 100 100 // The flag to disable report batch. 101 - disableReportBatch?: bool @protobuf(3,name=disable_report_batch) 101 + disableReportBatch?: bool @protobuf(3,bool,name=disable_report_batch) 102 102 103 103 // Specifies the behavior when the client is unable to connect to Mixer. 104 104 // This is the mesh level policy. The default value for policy is FAIL_OPEN. 105 - networkFailPolicy?: #NetworkFailPolicy @protobuf(4,name=network_fail_policy) 105 + networkFailPolicy?: #NetworkFailPolicy @protobuf(4,NetworkFailPolicy,name=network_fail_policy) 106 106 107 107 // Specify refresh interval to write Mixer client statistics to Envoy share 108 108 // memory. If not specified, the interval is 10 seconds. 109 - statsUpdateInterval?: time.Duration @protobuf(5,type=google.protobuf.Duration,name=stats_update_interval) 109 + statsUpdateInterval?: time.Duration @protobuf(5,google.protobuf.Duration,name=stats_update_interval) 110 110 111 111 // Name of the cluster that will forward check calls to a pool of mixer 112 112 // servers. Defaults to "mixer_server". By using different names for ··· 116 116 // 117 117 // NOTE: Any value other than the default "mixer_server" will require the 118 118 // Istio Grafana dashboards to be reconfigured to use the new name. 119 - checkCluster?: string @protobuf(6,name=check_cluster) 119 + checkCluster?: string @protobuf(6,string,name=check_cluster) 120 120 121 121 // Name of the cluster that will forward report calls to a pool of mixer 122 122 // servers. Defaults to "mixer_server". By using different names for ··· 126 126 // 127 127 // NOTE: Any value other than the default "mixer_server" will require the 128 128 // Istio Grafana dashboards to be reconfigured to use the new name. 129 - reportCluster?: string @protobuf(7,name=report_cluster) 129 + reportCluster?: string @protobuf(7,string,name=report_cluster) 130 130 131 131 // Default attributes to forward to Mixer upstream. This typically 132 132 // includes the "source.ip" and "source.uid" attributes. These 133 133 // attributes are consumed by the proxy in front of mixer. 134 - attributesForMixerProxy?: v1.#Attributes @protobuf(8,type=Attributes,name=attributes_for_mixer_proxy) 134 + attributesForMixerProxy?: v1.#Attributes @protobuf(8,Attributes,name=attributes_for_mixer_proxy) 135 135 } 136 136 137 137 // Defines the client config for HTTP. 138 138 #HttpClientConfig: { 139 139 // The transport config. 140 - transport?: #TransportConfig @protobuf(1) 140 + transport?: #TransportConfig @protobuf(1,TransportConfig) 141 141 142 142 // Map of control configuration indexed by destination.service. This 143 143 // is used to support per-service configuration for cases where a 144 144 // mixerclient serves multiple services. 145 145 serviceConfigs?: { 146 146 [string]: #ServiceConfig 147 - } @protobuf(2,type=map<string,ServiceConfig>,service_configs) 147 + } @protobuf(2,map[string]ServiceConfig,service_configs) 148 148 149 149 // Default destination service name if none was specified in the 150 150 // client request. 151 - defaultDestinationService?: string @protobuf(3,name=default_destination_service) 151 + defaultDestinationService?: string @protobuf(3,string,name=default_destination_service) 152 152 153 153 // Default attributes to send to Mixer in both Check and 154 154 // Report. This typically includes "destination.ip" and 155 155 // "destination.uid" attributes. 156 - mixerAttributes?: v1.#Attributes @protobuf(4,type=Attributes,name=mixer_attributes) 156 + mixerAttributes?: v1.#Attributes @protobuf(4,Attributes,name=mixer_attributes) 157 157 158 158 // Default attributes to forward to upstream. This typically 159 159 // includes the "source.ip" and "source.uid" attributes. 160 - forwardAttributes?: v1.#Attributes @protobuf(5,type=Attributes,name=forward_attributes) 160 + forwardAttributes?: v1.#Attributes @protobuf(5,Attributes,name=forward_attributes) 161 161 } 162 162 163 163 // Defines the client config for TCP. 164 164 #TcpClientConfig: { 165 165 // The transport config. 166 - transport?: #TransportConfig @protobuf(1) 166 + transport?: #TransportConfig @protobuf(1,TransportConfig) 167 167 168 168 // Default attributes to send to Mixer in both Check and 169 169 // Report. This typically includes "destination.ip" and 170 170 // "destination.uid" attributes. 171 - mixerAttributes?: v1.#Attributes @protobuf(2,type=Attributes,name=mixer_attributes) 171 + mixerAttributes?: v1.#Attributes @protobuf(2,Attributes,name=mixer_attributes) 172 172 173 173 // If set to true, disables Mixer check calls. 174 - disableCheckCalls?: bool @protobuf(3,name=disable_check_calls) 174 + disableCheckCalls?: bool @protobuf(3,bool,name=disable_check_calls) 175 175 176 176 // If set to true, disables Mixer check calls. 177 - disableReportCalls?: bool @protobuf(4,name=disable_report_calls) 177 + disableReportCalls?: bool @protobuf(4,bool,name=disable_report_calls) 178 178 179 179 // Quota specifications to generate quota requirements. 180 180 // It applies on the new TCP connections. 181 - connectionQuotaSpec?: #QuotaSpec @protobuf(5,name=connection_quota_spec) 181 + connectionQuotaSpec?: #QuotaSpec @protobuf(5,QuotaSpec,name=connection_quota_spec) 182 182 183 183 // Specify report interval to send periodical reports for long TCP 184 184 // connections. If not specified, the interval is 10 seconds. This interval 185 185 // should not be less than 1 second, otherwise it will be reset to 1 second. 186 - reportInterval?: time.Duration @protobuf(6,type=google.protobuf.Duration,name=report_interval) 186 + reportInterval?: time.Duration @protobuf(6,google.protobuf.Duration,name=report_interval) 187 187 }
+20 -20
encoding/protobuf/testdata/gateway.proto.out.cue
··· 205 205 206 206 #Gateway: { 207 207 // REQUIRED: A list of server specifications. 208 - servers?: [...#Server] @protobuf(1) 208 + servers?: [...#Server] @protobuf(1,Server) 209 209 210 210 // REQUIRED: One or more labels that indicate a specific set of pods/VMs 211 211 // on which this gateway configuration should be applied. The scope of ··· 214 214 // reside in the same namespace as the gateway workload instance. 215 215 selector?: { 216 216 [string]: string 217 - } @protobuf(2,type=map<string,string>) 217 + } @protobuf(2,map[string]string) 218 218 selector?: [name=_]: name 219 219 } 220 220 ··· 282 282 #Server: { 283 283 // REQUIRED: The Port on which the proxy should listen for incoming 284 284 // connections. 285 - port?: #Port @protobuf(1) 285 + port?: #Port @protobuf(1,Port) 286 286 port?: >10 & <100 287 287 288 288 // $hide_from_docs ··· 290 290 // to. Format: `x.x.x.x` or `unix:///path/to/uds` or `unix://@foobar` 291 291 // (Linux abstract namespace). When using Unix domain sockets, the port 292 292 // number should be 0. 293 - bind?: string @protobuf(4) 293 + bind?: string @protobuf(4,string) 294 294 295 295 // REQUIRED. One or more hosts exposed by this gateway. 296 296 // While typically applicable to ··· 316 316 // Private configurations (e.g., `exportTo` set to `.`) will not be 317 317 // available. Refer to the `exportTo` setting in `VirtualService`, 318 318 // `DestinationRule`, and `ServiceEntry` configurations for details. 319 - hosts?: [...string] @protobuf(2) 319 + hosts?: [...string] @protobuf(2,string) 320 320 321 321 #TLSOptions: { 322 322 // If set to true, the load balancer will send a 301 redirect for all 323 323 // http connections, asking the clients to use HTTPS. 324 - httpsRedirect?: bool @protobuf(1,name=https_redirect) 324 + httpsRedirect?: bool @protobuf(1,bool,name=https_redirect) 325 325 326 326 // TLS modes enforced by the proxy 327 327 #TLSmode: ··· 359 359 // Optional: Indicates whether connections to this port should be 360 360 // secured using TLS. The value of this field determines how TLS is 361 361 // enforced. 362 - mode?: #TLSmode @protobuf(2) 362 + mode?: #TLSmode @protobuf(2,TLSmode) 363 363 // Extra comment. 364 364 365 365 // REQUIRED if mode is `SIMPLE` or `MUTUAL`. The path to the file 366 366 // holding the server-side TLS certificate to use. 367 - serverCertificate?: string @protobuf(3,name=server_certificate) 367 + serverCertificate?: string @protobuf(3,string,name=server_certificate) 368 368 369 369 // REQUIRED if mode is `SIMPLE` or `MUTUAL`. The path to the file 370 370 // holding the server's private key. 371 - privateKey?: string @protobuf(4,name=private_key) 371 + privateKey?: string @protobuf(4,string,name=private_key) 372 372 373 373 // REQUIRED if mode is `MUTUAL`. The path to a file containing 374 374 // certificate authority certificates to use in verifying a presented 375 375 // client side certificate. 376 - caCertificates?: string @protobuf(5,name=ca_certificates) 376 + caCertificates?: string @protobuf(5,string,name=ca_certificates) 377 377 378 378 // The credentialName stands for a unique identifier that can be used 379 379 // to identify the serverCertificate and the privateKey. The ··· 391 391 // key, and the CA certificate (if using mutual TLS). Set the 392 392 // `ISTIO_META_USER_SDS` metadata variable in the gateway's proxy to 393 393 // enable the dynamic credential fetching feature. 394 - credentialName?: string @protobuf(10,name=credential_name) 394 + credentialName?: string @protobuf(10,string,name=credential_name) 395 395 396 396 // A list of alternate names to verify the subject identity in the 397 397 // certificate presented by the client. 398 - subjectAltNames?: [...string] @protobuf(6,name=subject_alt_names) 398 + subjectAltNames?: [...string] @protobuf(6,string,name=subject_alt_names) 399 399 400 400 // TLS protocol versions. 401 401 #TLSProtocol: "TLS_AUTO" | // Automatically choose the optimal TLS version. ··· 413 413 } 414 414 415 415 // Optional: Minimum TLS protocol version. 416 - minProtocolVersion?: #TLSProtocol @protobuf(7,name=min_protocol_version) 416 + minProtocolVersion?: #TLSProtocol @protobuf(7,TLSProtocol,name=min_protocol_version) 417 417 418 418 // Optional: Maximum TLS protocol version. 419 - maxProtocolVersion?: #TLSProtocol @protobuf(8,name=max_protocol_version) 419 + maxProtocolVersion?: #TLSProtocol @protobuf(8,TLSProtocol,name=max_protocol_version) 420 420 421 421 // Optional: If specified, only support the specified cipher list. 422 422 // Otherwise default to the default cipher list supported by Envoy. 423 - cipherSuites?: [...string] @protobuf(9,name=cipher_suites) 423 + cipherSuites?: [...string] @protobuf(9,string,name=cipher_suites) 424 424 } 425 425 426 426 // Set of TLS related options that govern the server's behavior. Use 427 427 // these options to control if all http requests should be redirected to 428 428 // https, and the TLS modes to use. 429 - tls?: #TLSOptions @protobuf(3) 429 + tls?: #TLSOptions @protobuf(3,TLSOptions) 430 430 431 431 // The loopback IP endpoint or Unix domain socket to which traffic should 432 432 // be forwarded to by default. Format should be `127.0.0.1:PORT` or 433 433 // `unix:///path/to/socket` or `unix://@foobar` (Linux abstract namespace). 434 - defaultEndpoint?: string @protobuf(5,name=default_endpoint) 434 + defaultEndpoint?: string @protobuf(5,string,name=default_endpoint) 435 435 } 436 436 437 437 // Port describes the properties of a specific port of a service. 438 438 #Port: { 439 439 // REQUIRED: A valid non-negative integer port number. 440 - number?: uint32 @protobuf(1) 440 + number?: uint32 @protobuf(1,uint32) 441 441 442 442 // REQUIRED: The protocol exposed on the port. 443 443 // MUST BE one of HTTP|HTTPS|GRPC|HTTP2|MONGO|TCP|TLS. 444 444 // TLS implies the connection will be routed based on the SNI header to 445 445 // the destination without terminating the TLS connection. 446 - protocol?: string @protobuf(2) 446 + protocol?: string @protobuf(2,string) 447 447 448 448 // Label assigned to the port. 449 - name?: string @protobuf(3) 449 + name?: string @protobuf(3,string) 450 450 }
+124 -124
encoding/protobuf/testdata/istio.io/api/cue.mod/gen/github.com/golang/protobuf/protoc-gen-go/descriptor/descriptor_proto_gen.cue
··· 75 75 // The protocol compiler can output a FileDescriptorSet containing the .proto 76 76 // files it parses. 77 77 #FileDescriptorSet: { 78 - file?: [...#FileDescriptorProto] @protobuf(1) 78 + file?: [...#FileDescriptorProto] @protobuf(1,FileDescriptorProto) 79 79 } 80 80 81 81 // Describes a complete .proto file. 82 82 #FileDescriptorProto: { 83 - name?: string @protobuf(1) // file name, relative to root of source tree 84 - package?: string @protobuf(2) // e.g. "foo", "foo.bar", etc. 83 + name?: string @protobuf(1,string) // file name, relative to root of source tree 84 + package?: string @protobuf(2,string) // e.g. "foo", "foo.bar", etc. 85 85 86 86 // Names of files imported by this file. 87 - dependency?: [...string] @protobuf(3) 87 + dependency?: [...string] @protobuf(3,string) 88 88 89 89 // Indexes of the public imported files in the dependency list above. 90 - publicDependency?: [...int32] @protobuf(10,name=public_dependency) 90 + publicDependency?: [...int32] @protobuf(10,int32,name=public_dependency) 91 91 92 92 // Indexes of the weak imported files in the dependency list. 93 93 // For Google-internal migration only. Do not use. 94 - weakDependency?: [...int32] @protobuf(11,name=weak_dependency) 94 + weakDependency?: [...int32] @protobuf(11,int32,name=weak_dependency) 95 95 96 96 // All top-level definitions in this file. 97 - messageType?: [...#DescriptorProto] @protobuf(4,name=message_type) 98 - enumType?: [...#EnumDescriptorProto] @protobuf(5,name=enum_type) 99 - service?: [...#ServiceDescriptorProto] @protobuf(6) 100 - extension?: [...#FieldDescriptorProto] @protobuf(7) 101 - options?: #FileOptions @protobuf(8) 97 + messageType?: [...#DescriptorProto] @protobuf(4,DescriptorProto,name=message_type) 98 + enumType?: [...#EnumDescriptorProto] @protobuf(5,EnumDescriptorProto,name=enum_type) 99 + service?: [...#ServiceDescriptorProto] @protobuf(6,ServiceDescriptorProto) 100 + extension?: [...#FieldDescriptorProto] @protobuf(7,FieldDescriptorProto) 101 + options?: #FileOptions @protobuf(8,FileOptions) 102 102 103 103 // This field contains optional information about the original source code. 104 104 // You may safely remove this entire field without harming runtime 105 105 // functionality of the descriptors -- the information is needed only by 106 106 // development tools. 107 - sourceCodeInfo?: #SourceCodeInfo @protobuf(9,name=source_code_info) 107 + sourceCodeInfo?: #SourceCodeInfo @protobuf(9,SourceCodeInfo,name=source_code_info) 108 108 109 109 // The syntax of the proto file. 110 110 // The supported values are "proto2" and "proto3". 111 - syntax?: string @protobuf(12) 111 + syntax?: string @protobuf(12,string) 112 112 } 113 113 114 114 // Describes a message type. 115 115 #DescriptorProto: { 116 - name?: string @protobuf(1) 117 - field?: [...#FieldDescriptorProto] @protobuf(2) 118 - extension?: [...#FieldDescriptorProto] @protobuf(6) 119 - nestedType?: [...#DescriptorProto] @protobuf(3,name=nested_type) 120 - enumType?: [...#EnumDescriptorProto] @protobuf(4,name=enum_type) 116 + name?: string @protobuf(1,string) 117 + field?: [...#FieldDescriptorProto] @protobuf(2,FieldDescriptorProto) 118 + extension?: [...#FieldDescriptorProto] @protobuf(6,FieldDescriptorProto) 119 + nestedType?: [...#DescriptorProto] @protobuf(3,DescriptorProto,name=nested_type) 120 + enumType?: [...#EnumDescriptorProto] @protobuf(4,EnumDescriptorProto,name=enum_type) 121 121 122 122 #ExtensionRange: { 123 - start?: int32 @protobuf(1) // Inclusive. 124 - end?: int32 @protobuf(2) // Exclusive. 125 - options?: #ExtensionRangeOptions @protobuf(3) 123 + start?: int32 @protobuf(1,int32) // Inclusive. 124 + end?: int32 @protobuf(2,int32) // Exclusive. 125 + options?: #ExtensionRangeOptions @protobuf(3,ExtensionRangeOptions) 126 126 } 127 - extensionRange?: [...#ExtensionRange] @protobuf(5,name=extension_range) 128 - oneofDecl?: [...#OneofDescriptorProto] @protobuf(8,name=oneof_decl) 129 - options?: #MessageOptions @protobuf(7) 127 + extensionRange?: [...#ExtensionRange] @protobuf(5,ExtensionRange,name=extension_range) 128 + oneofDecl?: [...#OneofDescriptorProto] @protobuf(8,OneofDescriptorProto,name=oneof_decl) 129 + options?: #MessageOptions @protobuf(7,MessageOptions) 130 130 131 131 // Range of reserved tag numbers. Reserved tag numbers may not be used by 132 132 // fields or extension ranges in the same message. Reserved ranges may 133 133 // not overlap. 134 134 #ReservedRange: { 135 - start?: int32 @protobuf(1) // Inclusive. 136 - end?: int32 @protobuf(2) // Exclusive. 135 + start?: int32 @protobuf(1,int32) // Inclusive. 136 + end?: int32 @protobuf(2,int32) // Exclusive. 137 137 } 138 - reservedRange?: [...#ReservedRange] @protobuf(9,name=reserved_range) 138 + reservedRange?: [...#ReservedRange] @protobuf(9,ReservedRange,name=reserved_range) 139 139 140 140 // Reserved field names, which may not be used by fields in the same message. 141 141 // A given name may only be reserved once. 142 - reservedName?: [...string] @protobuf(10,name=reserved_name) 142 + reservedName?: [...string] @protobuf(10,string,name=reserved_name) 143 143 } 144 144 145 145 #ExtensionRangeOptions: { 146 146 // The parser stores options it doesn't recognize here. See above. 147 - uninterpretedOption?: [...#UninterpretedOption] @protobuf(999,name=uninterpreted_option) 147 + uninterpretedOption?: [...#UninterpretedOption] @protobuf(999,UninterpretedOption,name=uninterpreted_option) 148 148 } 149 149 150 150 // Describes a field within a message. ··· 215 215 "LABEL_REQUIRED": 2 216 216 "LABEL_REPEATED": 3 217 217 } 218 - name?: string @protobuf(1) 219 - number?: int32 @protobuf(3) 220 - label?: #Label @protobuf(4) 218 + name?: string @protobuf(1,string) 219 + number?: int32 @protobuf(3,int32) 220 + label?: #Label @protobuf(4,Label) 221 221 222 222 // If type_name is set, this need not be set. If both this and type_name 223 223 // are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. 224 - type?: #Type @protobuf(5) 224 + type?: #Type @protobuf(5,Type) 225 225 226 226 // For message and enum types, this is the name of the type. If the name 227 227 // starts with a '.', it is fully-qualified. Otherwise, C++-like scoping 228 228 // rules are used to find the type (i.e. first the nested types within this 229 229 // message are searched, then within the parent, on up to the root 230 230 // namespace). 231 - typeName?: string @protobuf(6,name=type_name) 231 + typeName?: string @protobuf(6,string,name=type_name) 232 232 233 233 // For extensions, this is the name of the type being extended. It is 234 234 // resolved in the same manner as type_name. 235 - extendee?: string @protobuf(2) 235 + extendee?: string @protobuf(2,string) 236 236 237 237 // For numeric types, contains the original text representation of the value. 238 238 // For booleans, "true" or "false". 239 239 // For strings, contains the default text contents (not escaped in any way). 240 240 // For bytes, contains the C escaped value. All bytes >= 128 are escaped. 241 241 // TODO(kenton): Base-64 encode? 242 - defaultValue?: string @protobuf(7,name=default_value) 242 + defaultValue?: string @protobuf(7,string,name=default_value) 243 243 244 244 // If set, gives the index of a oneof in the containing type's oneof_decl 245 245 // list. This field is a member of that oneof. 246 - oneofIndex?: int32 @protobuf(9,name=oneof_index) 246 + oneofIndex?: int32 @protobuf(9,int32,name=oneof_index) 247 247 248 248 // JSON name of this field. The value is set by protocol compiler. If the 249 249 // user has set a "json_name" option on this field, that option's value 250 250 // will be used. Otherwise, it's deduced from the field's name by converting 251 251 // it to camelCase. 252 - jsonName?: string @protobuf(10,name=json_name) 253 - options?: #FieldOptions @protobuf(8) 252 + jsonName?: string @protobuf(10,string,name=json_name) 253 + options?: #FieldOptions @protobuf(8,FieldOptions) 254 254 } 255 255 256 256 // Describes a oneof. 257 257 #OneofDescriptorProto: { 258 - name?: string @protobuf(1) 259 - options?: #OneofOptions @protobuf(2) 258 + name?: string @protobuf(1,string) 259 + options?: #OneofOptions @protobuf(2,OneofOptions) 260 260 } 261 261 262 262 // Describes an enum type. 263 263 #EnumDescriptorProto: { 264 - name?: string @protobuf(1) 265 - value?: [...#EnumValueDescriptorProto] @protobuf(2) 266 - options?: #EnumOptions @protobuf(3) 264 + name?: string @protobuf(1,string) 265 + value?: [...#EnumValueDescriptorProto] @protobuf(2,EnumValueDescriptorProto) 266 + options?: #EnumOptions @protobuf(3,EnumOptions) 267 267 268 268 // Range of reserved numeric values. Reserved values may not be used by 269 269 // entries in the same enum. Reserved ranges may not overlap. ··· 272 272 // is inclusive such that it can appropriately represent the entire int32 273 273 // domain. 274 274 #EnumReservedRange: { 275 - start?: int32 @protobuf(1) // Inclusive. 276 - end?: int32 @protobuf(2) // Inclusive. 275 + start?: int32 @protobuf(1,int32) // Inclusive. 276 + end?: int32 @protobuf(2,int32) // Inclusive. 277 277 } 278 278 279 279 // Range of reserved numeric values. Reserved numeric values may not be used 280 280 // by enum values in the same enum declaration. Reserved ranges may not 281 281 // overlap. 282 - reservedRange?: [...#EnumReservedRange] @protobuf(4,name=reserved_range) 282 + reservedRange?: [...#EnumReservedRange] @protobuf(4,EnumReservedRange,name=reserved_range) 283 283 284 284 // Reserved enum value names, which may not be reused. A given name may only 285 285 // be reserved once. 286 - reservedName?: [...string] @protobuf(5,name=reserved_name) 286 + reservedName?: [...string] @protobuf(5,string,name=reserved_name) 287 287 } 288 288 289 289 // Describes a value within an enum. 290 290 #EnumValueDescriptorProto: { 291 - name?: string @protobuf(1) 292 - number?: int32 @protobuf(2) 293 - options?: #EnumValueOptions @protobuf(3) 291 + name?: string @protobuf(1,string) 292 + number?: int32 @protobuf(2,int32) 293 + options?: #EnumValueOptions @protobuf(3,EnumValueOptions) 294 294 } 295 295 296 296 // Describes a service. 297 297 #ServiceDescriptorProto: { 298 - name?: string @protobuf(1) 299 - method?: [...#MethodDescriptorProto] @protobuf(2) 300 - options?: #ServiceOptions @protobuf(3) 298 + name?: string @protobuf(1,string) 299 + method?: [...#MethodDescriptorProto] @protobuf(2,MethodDescriptorProto) 300 + options?: #ServiceOptions @protobuf(3,ServiceOptions) 301 301 } 302 302 303 303 // Describes a method of a service. 304 304 #MethodDescriptorProto: { 305 - name?: string @protobuf(1) 305 + name?: string @protobuf(1,string) 306 306 307 307 // Input and output type names. These are resolved in the same way as 308 308 // FieldDescriptorProto.type_name, but must refer to a message type. 309 - inputType?: string @protobuf(2,name=input_type) 310 - outputType?: string @protobuf(3,name=output_type) 311 - options?: #MethodOptions @protobuf(4) 309 + inputType?: string @protobuf(2,string,name=input_type) 310 + outputType?: string @protobuf(3,string,name=output_type) 311 + options?: #MethodOptions @protobuf(4,MethodOptions) 312 312 313 313 // Identifies if client streams multiple client messages 314 - clientStreaming?: bool @protobuf(5,name=client_streaming,"default=false") 314 + clientStreaming?: bool @protobuf(5,bool,name=client_streaming,"default=false") 315 315 316 316 // Identifies if server streams multiple server messages 317 - serverStreaming?: bool @protobuf(6,name=server_streaming,"default=false") 317 + serverStreaming?: bool @protobuf(6,bool,name=server_streaming,"default=false") 318 318 } 319 319 320 320 #FileOptions: { ··· 322 322 // placed. By default, the proto package is used, but this is often 323 323 // inappropriate because proto packages do not normally start with backwards 324 324 // domain names. 325 - javaPackage?: string @protobuf(1,name=java_package) 325 + javaPackage?: string @protobuf(1,string,name=java_package) 326 326 327 327 // If set, all the classes from the .proto file are wrapped in a single 328 328 // outer class with the given name. This applies to both Proto1 329 329 // (equivalent to the old "--one_java_file" option) and Proto2 (where 330 330 // a .proto always translates to a single class, but you may want to 331 331 // explicitly choose the class name). 332 - javaOuterClassname?: string @protobuf(8,name=java_outer_classname) 332 + javaOuterClassname?: string @protobuf(8,string,name=java_outer_classname) 333 333 334 334 // If set true, then the Java code generator will generate a separate .java 335 335 // file for each top-level message, enum, and service defined in the .proto ··· 337 337 // named by java_outer_classname. However, the outer class will still be 338 338 // generated to contain the file's getDescriptor() method as well as any 339 339 // top-level extensions defined in the file. 340 - javaMultipleFiles?: bool @protobuf(10,name=java_multiple_files,"default=false") 340 + javaMultipleFiles?: bool @protobuf(10,bool,name=java_multiple_files,"default=false") 341 341 342 342 // This option does nothing. 343 - javaGenerateEqualsAndHash?: bool @protobuf(20,name=java_generate_equals_and_hash,deprecated) 343 + javaGenerateEqualsAndHash?: bool @protobuf(20,bool,name=java_generate_equals_and_hash,deprecated) 344 344 345 345 // If set true, then the Java2 code generator will generate code that 346 346 // throws an exception whenever an attempt is made to assign a non-UTF-8 ··· 348 348 // Message reflection will do the same. 349 349 // However, an extension field still accepts non-UTF-8 byte sequences. 350 350 // This option has no effect on when used with the lite runtime. 351 - javaStringCheckUtf8?: bool @protobuf(27,name=java_string_check_utf8,"default=false") 351 + javaStringCheckUtf8?: bool @protobuf(27,bool,name=java_string_check_utf8,"default=false") 352 352 353 353 // Generated classes can be optimized for speed or code size. 354 354 #OptimizeMode: "SPEED" | // Generate complete code for parsing, serialization, ··· 362 362 "CODE_SIZE": 2 // Use ReflectionOps to implement these methods. 363 363 "LITE_RUNTIME": 3 364 364 } 365 - optimizeFor?: #OptimizeMode @protobuf(9,name=optimize_for,"default=SPEED") 365 + optimizeFor?: #OptimizeMode @protobuf(9,OptimizeMode,name=optimize_for,"default=SPEED") 366 366 367 367 // Sets the Go package where structs generated from this .proto will be 368 368 // placed. If omitted, the Go package will be derived from the following: 369 369 // - The basename of the package import path, if provided. 370 370 // - Otherwise, the package statement in the .proto file, if present. 371 371 // - Otherwise, the basename of the .proto file, without extension. 372 - goPackage?: string @protobuf(11,name=go_package) 372 + goPackage?: string @protobuf(11,string,name=go_package) 373 373 374 374 // Should generic services be generated in each language? "Generic" services 375 375 // are not specific to any particular RPC system. They are generated by the ··· 381 381 // that generate code specific to your particular RPC system. Therefore, 382 382 // these default to false. Old code which depends on generic services should 383 383 // explicitly set them to true. 384 - ccGenericServices?: bool @protobuf(16,name=cc_generic_services,"default=false") 385 - javaGenericServices?: bool @protobuf(17,name=java_generic_services,"default=false") 386 - pyGenericServices?: bool @protobuf(18,name=py_generic_services,"default=false") 387 - phpGenericServices?: bool @protobuf(42,name=php_generic_services,"default=false") 384 + ccGenericServices?: bool @protobuf(16,bool,name=cc_generic_services,"default=false") 385 + javaGenericServices?: bool @protobuf(17,bool,name=java_generic_services,"default=false") 386 + pyGenericServices?: bool @protobuf(18,bool,name=py_generic_services,"default=false") 387 + phpGenericServices?: bool @protobuf(42,bool,name=php_generic_services,"default=false") 388 388 389 389 // Is this file deprecated? 390 390 // Depending on the target platform, this can emit Deprecated annotations 391 391 // for everything in the file, or it will be completely ignored; in the very 392 392 // least, this is a formalization for deprecating files. 393 - deprecated?: bool @protobuf(23,"default=false") 393 + deprecated?: bool @protobuf(23,bool,"default=false") 394 394 395 395 // Enables the use of arenas for the proto messages in this file. This applies 396 396 // only to generated classes for C++. 397 - ccEnableArenas?: bool @protobuf(31,name=cc_enable_arenas,"default=false") 397 + ccEnableArenas?: bool @protobuf(31,bool,name=cc_enable_arenas,"default=false") 398 398 399 399 // Sets the objective c class prefix which is prepended to all objective c 400 400 // generated classes from this .proto. There is no default. 401 - objcClassPrefix?: string @protobuf(36,name=objc_class_prefix) 401 + objcClassPrefix?: string @protobuf(36,string,name=objc_class_prefix) 402 402 403 403 // Namespace for generated classes; defaults to the package. 404 - csharpNamespace?: string @protobuf(37,name=csharp_namespace) 404 + csharpNamespace?: string @protobuf(37,string,name=csharp_namespace) 405 405 406 406 // By default Swift generators will take the proto package and CamelCase it 407 407 // replacing '.' with underscore and use that to prefix the types/symbols 408 408 // defined. When this options is provided, they will use this value instead 409 409 // to prefix the types/symbols defined. 410 - swiftPrefix?: string @protobuf(39,name=swift_prefix) 410 + swiftPrefix?: string @protobuf(39,string,name=swift_prefix) 411 411 412 412 // Sets the php class prefix which is prepended to all php generated classes 413 413 // from this .proto. Default is empty. 414 - phpClassPrefix?: string @protobuf(40,name=php_class_prefix) 414 + phpClassPrefix?: string @protobuf(40,string,name=php_class_prefix) 415 415 416 416 // Use this option to change the namespace of php generated classes. Default 417 417 // is empty. When this option is empty, the package name will be used for 418 418 // determining the namespace. 419 - phpNamespace?: string @protobuf(41,name=php_namespace) 419 + phpNamespace?: string @protobuf(41,string,name=php_namespace) 420 420 421 421 // Use this option to change the namespace of php generated metadata classes. 422 422 // Default is empty. When this option is empty, the proto file name will be 423 423 // used for determining the namespace. 424 - phpMetadataNamespace?: string @protobuf(44,name=php_metadata_namespace) 424 + phpMetadataNamespace?: string @protobuf(44,string,name=php_metadata_namespace) 425 425 426 426 // Use this option to change the package of ruby generated classes. Default 427 427 // is empty. When this option is not set, the package name will be used for 428 428 // determining the ruby package. 429 - rubyPackage?: string @protobuf(45,name=ruby_package) 429 + rubyPackage?: string @protobuf(45,string,name=ruby_package) 430 430 431 431 // The parser stores options it doesn't recognize here. 432 432 // See the documentation for the "Options" section above. 433 - uninterpretedOption?: [...#UninterpretedOption] @protobuf(999,name=uninterpreted_option) 433 + uninterpretedOption?: [...#UninterpretedOption] @protobuf(999,UninterpretedOption,name=uninterpreted_option) 434 434 } 435 435 436 436 #MessageOptions: { ··· 452 452 // 453 453 // Because this is an option, the above two restrictions are not enforced by 454 454 // the protocol compiler. 455 - messageSetWireFormat?: bool @protobuf(1,name=message_set_wire_format,"default=false") 455 + messageSetWireFormat?: bool @protobuf(1,bool,name=message_set_wire_format,"default=false") 456 456 457 457 // Disables the generation of the standard "descriptor()" accessor, which can 458 458 // conflict with a field of the same name. This is meant to make migration 459 459 // from proto1 easier; new code should avoid fields named "descriptor". 460 - noStandardDescriptorAccessor?: bool @protobuf(2,name=no_standard_descriptor_accessor,"default=false") 460 + noStandardDescriptorAccessor?: bool @protobuf(2,bool,name=no_standard_descriptor_accessor,"default=false") 461 461 462 462 // Is this message deprecated? 463 463 // Depending on the target platform, this can emit Deprecated annotations 464 464 // for the message, or it will be completely ignored; in the very least, 465 465 // this is a formalization for deprecating messages. 466 - deprecated?: bool @protobuf(3,"default=false") 466 + deprecated?: bool @protobuf(3,bool,"default=false") 467 467 468 468 // Whether the message is an automatically generated map entry type for the 469 469 // maps field. ··· 486 486 // NOTE: Do not set the option in .proto files. Always use the maps syntax 487 487 // instead. The option should only be implicitly set by the proto compiler 488 488 // parser. 489 - mapEntry?: bool @protobuf(7,name=map_entry) 489 + mapEntry?: bool @protobuf(7,bool,name=map_entry) 490 490 491 491 // The parser stores options it doesn't recognize here. See above. 492 - uninterpretedOption?: [...#UninterpretedOption] @protobuf(999,name=uninterpreted_option) 492 + uninterpretedOption?: [...#UninterpretedOption] @protobuf(999,UninterpretedOption,name=uninterpreted_option) 493 493 } 494 494 495 495 #FieldOptions: { ··· 497 497 // representation of the field than it normally would. See the specific 498 498 // options below. This option is not yet implemented in the open source 499 499 // release -- sorry, we'll try to include it in a future version! 500 - ctype?: #CType @protobuf(1,"default=STRING") 500 + ctype?: #CType @protobuf(1,CType,"default=STRING") 501 501 #CType: 502 502 // Default mode. 503 503 "STRING" | ··· 515 515 // writing the tag and type for each element, the entire array is encoded as 516 516 // a single length-delimited blob. In proto3, only explicit setting it to 517 517 // false will avoid using packed encoding. 518 - packed?: bool @protobuf(2) 518 + packed?: bool @protobuf(2,bool) 519 519 520 520 // The jstype option determines the JavaScript type used for values of the 521 521 // field. The option is permitted only for 64 bit integral and fixed types ··· 528 528 // 529 529 // This option is an enum to permit additional types to be added, e.g. 530 530 // goog.math.Integer. 531 - jstype?: #JSType @protobuf(6,"default=JS_NORMAL") 531 + jstype?: #JSType @protobuf(6,JSType,"default=JS_NORMAL") 532 532 #JSType: 533 533 // Use the default type. 534 534 "JS_NORMAL" | ··· 573 573 // implementation must either *always* check its required fields, or *never* 574 574 // check its required fields, regardless of whether or not the message has 575 575 // been parsed. 576 - lazy?: bool @protobuf(5,"default=false") 576 + lazy?: bool @protobuf(5,bool,"default=false") 577 577 578 578 // Is this field deprecated? 579 579 // Depending on the target platform, this can emit Deprecated annotations 580 580 // for accessors, or it will be completely ignored; in the very least, this 581 581 // is a formalization for deprecating fields. 582 - deprecated?: bool @protobuf(3,"default=false") 582 + deprecated?: bool @protobuf(3,bool,"default=false") 583 583 584 584 // For Google-internal migration only. Do not use. 585 - weak?: bool @protobuf(10,"default=false") 585 + weak?: bool @protobuf(10,bool,"default=false") 586 586 587 587 // The parser stores options it doesn't recognize here. See above. 588 - uninterpretedOption?: [...#UninterpretedOption] @protobuf(999,name=uninterpreted_option) 588 + uninterpretedOption?: [...#UninterpretedOption] @protobuf(999,UninterpretedOption,name=uninterpreted_option) 589 589 } 590 590 591 591 #OneofOptions: { 592 592 // The parser stores options it doesn't recognize here. See above. 593 - uninterpretedOption?: [...#UninterpretedOption] @protobuf(999,name=uninterpreted_option) 593 + uninterpretedOption?: [...#UninterpretedOption] @protobuf(999,UninterpretedOption,name=uninterpreted_option) 594 594 } 595 595 596 596 #EnumOptions: { 597 597 // Set this option to true to allow mapping different tag names to the same 598 598 // value. 599 - allowAlias?: bool @protobuf(2,name=allow_alias) 599 + allowAlias?: bool @protobuf(2,bool,name=allow_alias) 600 600 601 601 // Is this enum deprecated? 602 602 // Depending on the target platform, this can emit Deprecated annotations 603 603 // for the enum, or it will be completely ignored; in the very least, this 604 604 // is a formalization for deprecating enums. 605 - deprecated?: bool @protobuf(3,"default=false") 605 + deprecated?: bool @protobuf(3,bool,"default=false") 606 606 607 607 // The parser stores options it doesn't recognize here. See above. 608 - uninterpretedOption?: [...#UninterpretedOption] @protobuf(999,name=uninterpreted_option) 608 + uninterpretedOption?: [...#UninterpretedOption] @protobuf(999,UninterpretedOption,name=uninterpreted_option) 609 609 } 610 610 611 611 #EnumValueOptions: { ··· 613 613 // Depending on the target platform, this can emit Deprecated annotations 614 614 // for the enum value, or it will be completely ignored; in the very least, 615 615 // this is a formalization for deprecating enum values. 616 - deprecated?: bool @protobuf(1,"default=false") 616 + deprecated?: bool @protobuf(1,bool,"default=false") 617 617 618 618 // The parser stores options it doesn't recognize here. See above. 619 - uninterpretedOption?: [...#UninterpretedOption] @protobuf(999,name=uninterpreted_option) 619 + uninterpretedOption?: [...#UninterpretedOption] @protobuf(999,UninterpretedOption,name=uninterpreted_option) 620 620 } 621 621 622 622 #ServiceOptions: { ··· 629 629 // Depending on the target platform, this can emit Deprecated annotations 630 630 // for the service, or it will be completely ignored; in the very least, 631 631 // this is a formalization for deprecating services. 632 - deprecated?: bool @protobuf(33,"default=false") 632 + deprecated?: bool @protobuf(33,bool,"default=false") 633 633 634 634 // The parser stores options it doesn't recognize here. See above. 635 - uninterpretedOption?: [...#UninterpretedOption] @protobuf(999,name=uninterpreted_option) 635 + uninterpretedOption?: [...#UninterpretedOption] @protobuf(999,UninterpretedOption,name=uninterpreted_option) 636 636 } 637 637 638 638 #MethodOptions: { ··· 645 645 // Depending on the target platform, this can emit Deprecated annotations 646 646 // for the method, or it will be completely ignored; in the very least, 647 647 // this is a formalization for deprecating methods. 648 - deprecated?: bool @protobuf(33,"default=false") 648 + deprecated?: bool @protobuf(33,bool,"default=false") 649 649 650 650 // Is this method side-effect-free (or safe in HTTP parlance), or idempotent, 651 651 // or neither? HTTP based RPC implementation may choose GET verb for safe ··· 659 659 "NO_SIDE_EFFECTS": 1 660 660 "IDEMPOTENT": 2 661 661 } 662 - idempotencyLevel?: #IdempotencyLevel @protobuf(34,name=idempotency_level,"default=IDEMPOTENCY_UNKNOWN") 662 + idempotencyLevel?: #IdempotencyLevel @protobuf(34,IdempotencyLevel,name=idempotency_level,"default=IDEMPOTENCY_UNKNOWN") 663 663 664 664 // The parser stores options it doesn't recognize here. See above. 665 - uninterpretedOption?: [...#UninterpretedOption] @protobuf(999,name=uninterpreted_option) 665 + uninterpretedOption?: [...#UninterpretedOption] @protobuf(999,UninterpretedOption,name=uninterpreted_option) 666 666 } 667 667 668 668 // A message representing a option the parser does not recognize. This only ··· 678 678 // E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents 679 679 // "foo.(bar.baz).qux". 680 680 #NamePart: { 681 - namePart?: string @protobuf(1,name=name_part) 682 - isExtension?: bool @protobuf(2,name=is_extension) 681 + namePart?: string @protobuf(1,string,name=name_part) 682 + isExtension?: bool @protobuf(2,bool,name=is_extension) 683 683 } 684 - name?: [...#NamePart] @protobuf(2) 684 + name?: [...#NamePart] @protobuf(2,NamePart) 685 685 686 686 // The value of the uninterpreted option, in whatever type the tokenizer 687 687 // identified it as during parsing. Exactly one of these should be set. 688 - identifierValue?: string @protobuf(3,name=identifier_value) 689 - positiveIntValue?: uint64 @protobuf(4,name=positive_int_value) 690 - negativeIntValue?: int64 @protobuf(5,name=negative_int_value) 691 - doubleValue?: float64 @protobuf(6,type=double,name=double_value) 692 - stringValue?: bytes @protobuf(7,name=string_value) 693 - aggregateValue?: string @protobuf(8,name=aggregate_value) 688 + identifierValue?: string @protobuf(3,string,name=identifier_value) 689 + positiveIntValue?: uint64 @protobuf(4,uint64,name=positive_int_value) 690 + negativeIntValue?: int64 @protobuf(5,int64,name=negative_int_value) 691 + doubleValue?: float64 @protobuf(6,double,name=double_value) 692 + stringValue?: bytes @protobuf(7,bytes,name=string_value) 693 + aggregateValue?: string @protobuf(8,string,name=aggregate_value) 694 694 } 695 695 696 696 // Encapsulates information about the original source file from which a ··· 739 739 // - Code which tries to interpret locations should probably be designed to 740 740 // ignore those that it doesn't understand, as more types of locations could 741 741 // be recorded in the future. 742 - location?: [...#Location] @protobuf(1) 742 + location?: [...#Location] @protobuf(1,Location) 743 743 744 744 #Location: { 745 745 // Identifies which part of the FileDescriptorProto was defined at this ··· 765 765 // [ 4, 3, 2, 7 ] 766 766 // this path refers to the whole field declaration (from the beginning 767 767 // of the label to the terminating semicolon). 768 - path?: [...int32] @protobuf(1,packed) 768 + path?: [...int32] @protobuf(1,int32,packed) 769 769 770 770 // Always has exactly three or four elements: start line, start column, 771 771 // end line (optional, otherwise assumed same as start line), end column. 772 772 // These are packed into a single field for efficiency. Note that line 773 773 // and column numbers are zero-based -- typically you will want to add 774 774 // 1 to each before displaying to a user. 775 - span?: [...int32] @protobuf(2,packed) 775 + span?: [...int32] @protobuf(2,int32,packed) 776 776 777 777 // If this SourceCodeInfo represents a complete declaration, these are any 778 778 // comments appearing before and after the declaration which appear to be ··· 821 821 // optional int32 grault = 6; 822 822 // 823 823 // // ignored detached comments. 824 - leadingComments?: string @protobuf(3,name=leading_comments) 825 - trailingComments?: string @protobuf(4,name=trailing_comments) 826 - leadingDetachedComments?: [...string] @protobuf(6,name=leading_detached_comments) 824 + leadingComments?: string @protobuf(3,string,name=leading_comments) 825 + trailingComments?: string @protobuf(4,string,name=trailing_comments) 826 + leadingDetachedComments?: [...string] @protobuf(6,string,name=leading_detached_comments) 827 827 } 828 828 } 829 829 ··· 833 833 #GeneratedCodeInfo: { 834 834 // An Annotation connects some span of text in generated code to an element 835 835 // of its generating .proto file. 836 - annotation?: [...#Annotation] @protobuf(1) 836 + annotation?: [...#Annotation] @protobuf(1,Annotation) 837 837 838 838 #Annotation: { 839 839 // Identifies the element in the original source .proto file. This field 840 840 // is formatted the same as SourceCodeInfo.Location.path. 841 - path?: [...int32] @protobuf(1,packed) 841 + path?: [...int32] @protobuf(1,int32,packed) 842 842 843 843 // Identifies the filesystem path to the original source .proto. 844 - sourceFile?: string @protobuf(2,name=source_file) 844 + sourceFile?: string @protobuf(2,string,name=source_file) 845 845 846 846 // Identifies the starting offset in bytes in the generated code 847 847 // that relates to the identified object. 848 - begin?: int32 @protobuf(3) 848 + begin?: int32 @protobuf(3,int32) 849 849 850 850 // Identifies the ending offset in bytes in the generated code that 851 851 // relates to the identified offset. The end offset should be one past 852 852 // the last relevant byte (so the length of the text = end - begin). 853 - end?: int32 @protobuf(4) 853 + end?: int32 @protobuf(4,int32) 854 854 } 855 855 }
+3 -3
encoding/protobuf/testdata/istio.io/api/cue.mod/gen/google.golang.org/genproto/googleapis/rpc/status/status_proto_gen.cue
··· 69 69 #Status: { 70 70 // The status code, which should be an enum value of 71 71 // [google.rpc.Code][google.rpc.Code]. 72 - code?: int32 @protobuf(1) 72 + code?: int32 @protobuf(1,int32) 73 73 74 74 // A developer-facing error message, which should be in English. Any 75 75 // user-facing error message should be localized and sent in the 76 76 // [google.rpc.Status.details][google.rpc.Status.details] field, or localized 77 77 // by the client. 78 - message?: string @protobuf(2) 78 + message?: string @protobuf(2,string) 79 79 80 80 // A list of messages that carry the error details. There is a common set of 81 81 // message types for APIs to use. ··· 83 83 // A URL/resource name that uniquely identifies the type of the serialized protocol buffer message. This string must contain at least one "/" character. The last segment of the URL's path must represent the fully qualified name of the type (as in `type.googleapis.com/google.protobuf.Duration`). The name should be in a canonical form (e.g., leading "." is not accepted). 84 84 // The remaining fields of this object correspond to fields of the proto messsage. If the embedded message is well-known and has a custom JSON representation, that representation is assigned to the 'value' field. 85 85 "@type": string 86 - }] @protobuf(3,type=google.protobuf.Any) 86 + }] @protobuf(3,google.protobuf.Any) 87 87 }
+1 -1
encoding/protobuf/testdata/istio.io/api/cue.mod/gen/googleapis.com/acme/test/test/test_proto_gen.cue
··· 1 1 package test_test 2 2 3 3 #AnotherTest: { 4 - test?: int32 @protobuf(1) 4 + test?: int32 @protobuf(1,int32) 5 5 }
+1 -1
encoding/protobuf/testdata/istio.io/api/cue.mod/gen/googleapis.com/acme/test/test_proto_gen.cue
··· 4 4 // doc comment 5 5 @protobuf(option (yoyo.foo)=true) // line comment 6 6 @protobuf(option (yoyo.bar)=false) 7 - test?: int32 @protobuf(1) 7 + test?: int32 @protobuf(1,int32) 8 8 }
+28 -28
encoding/protobuf/testdata/istio.io/api/mixer/v1/attributes_proto_gen.cue
··· 21 21 ) 22 22 23 23 #StructWrap: { 24 - struct?: {} @protobuf(1,type=google.protobuf.Struct) 25 - any?: _ @protobuf(2,type=google.protobuf.Value) 26 - listVal?: [...] @protobuf(3,type=google.protobuf.ListValue) 27 - boolVal?: bool @protobuf(4,type=google.protobuf.BoolValue) 28 - stringVal?: string @protobuf(5,type=google.protobuf.StringValue) 29 - numberVal?: number @protobuf(6,type=google.protobuf.NumberValue) 24 + struct?: {} @protobuf(1,google.protobuf.Struct) 25 + any?: _ @protobuf(2,google.protobuf.Value) 26 + listVal?: [...] @protobuf(3,google.protobuf.ListValue) 27 + boolVal?: bool @protobuf(4,google.protobuf.BoolValue) 28 + stringVal?: string @protobuf(5,google.protobuf.StringValue) 29 + numberVal?: number @protobuf(6,google.protobuf.NumberValue) 30 30 } 31 31 32 32 // Attributes represents a set of typed name/value pairs. Many of Mixer's ··· 50 50 // A map of attribute name to its value. 51 51 attributes?: { 52 52 [string]: #AttributeValue 53 - } @protobuf(1,type=map<string,AttributeValue>) 53 + } @protobuf(1,map[string]AttributeValue) 54 54 55 55 // Specifies one attribute value with different type. 56 56 #AttributeValue: { 57 57 // The attribute value. 58 58 {} | { 59 59 // Used for values of type STRING, DNS_NAME, EMAIL_ADDRESS, and URI 60 - stringValue: string @protobuf(2,name=string_value) 60 + stringValue: string @protobuf(2,string,name=string_value) 61 61 } | { 62 62 // Used for values of type INT64 63 - int64Value: int64 @protobuf(3,name=int64_value) 63 + int64Value: int64 @protobuf(3,int64,name=int64_value) 64 64 } | { 65 65 // Used for values of type DOUBLE 66 - doubleValue: float64 @protobuf(4,type=double,name=double_value) 66 + doubleValue: float64 @protobuf(4,double,name=double_value) 67 67 } | { 68 68 // Used for values of type BOOL 69 - boolValue: bool @protobuf(5,name=bool_value) 69 + boolValue: bool @protobuf(5,bool,name=bool_value) 70 70 } | { 71 71 // Used for values of type BYTES 72 - bytesValue: bytes @protobuf(6,name=bytes_value) 72 + bytesValue: bytes @protobuf(6,bytes,name=bytes_value) 73 73 } | { 74 74 // Used for values of type TIMESTAMP 75 - timestampValue: time.Time @protobuf(7,type=google.protobuf.Timestamp,name=timestamp_value) 75 + timestampValue: time.Time @protobuf(7,google.protobuf.Timestamp,name=timestamp_value) 76 76 } | { 77 77 // Used for values of type DURATION 78 - durationValue: time.Duration @protobuf(8,type=google.protobuf.Duration,name=duration_value) 78 + durationValue: time.Duration @protobuf(8,google.protobuf.Duration,name=duration_value) 79 79 } | { 80 80 // Used for values of type STRING_MAP 81 - stringMapValue: #StringMap @protobuf(9,name=string_map_value) 81 + stringMapValue: #StringMap @protobuf(9,StringMap,name=string_map_value) 82 82 } | { 83 - testValue: test.#Test @protobuf(10,type=acme.test.Test,name=test_value) 83 + testValue: test.#Test @protobuf(10,acme.test.Test,name=test_value) 84 84 } | { 85 - testValue: test_test.#AnotherTest @protobuf(11,type=acme.test.test.AnotherTest,name=test_value) 85 + testValue: test_test.#AnotherTest @protobuf(11,acme.test.test.AnotherTest,name=test_value) 86 86 } 87 87 } 88 88 ··· 91 91 // Holds a set of name/value pairs. 92 92 entries?: { 93 93 [string]: string 94 - } @protobuf(1,type=map<string,string>) 94 + } @protobuf(1,map[string]string) 95 95 } 96 96 } 97 97 ··· 104 104 // configuration. 105 105 #CompressedAttributes: { 106 106 // The message-level dictionary. 107 - words?: [...string] @protobuf(1) 107 + words?: [...string] @protobuf(1,string) 108 108 109 109 // Holds attributes of type STRING, DNS_NAME, EMAIL_ADDRESS, URI 110 110 strings?: { 111 111 [string]: int32 112 - } @protobuf(2,type=map<sint32,sint32>) 112 + } @protobuf(2,map[sint32]sint32) 113 113 114 114 // Holds attributes of type INT64 115 115 int64s?: { 116 116 [string]: int64 117 - } @protobuf(3,type=map<sint32,int64>) 117 + } @protobuf(3,map[sint32]int64) 118 118 119 119 // Holds attributes of type DOUBLE 120 120 doubles?: { 121 121 [string]: float64 122 - } @protobuf(4,type=map<sint32,double>) 122 + } @protobuf(4,map[sint32]double) 123 123 124 124 // Holds attributes of type BOOL 125 125 bools?: { 126 126 [string]: bool 127 - } @protobuf(5,type=map<sint32,bool>) 127 + } @protobuf(5,map[sint32]bool) 128 128 129 129 // Holds attributes of type TIMESTAMP 130 130 time?: { 131 131 [string]: time_1.Time 132 - } @protobuf(6,type=map<sint32,google.protobuf.Timestamp>,"(gogoproto.nullable)=false","(gogoproto.stdtime)") 132 + } @protobuf(6,map[sint32]google.protobuf.Timestamp,"(gogoproto.nullable)=false","(gogoproto.stdtime)") 133 133 134 134 // Holds attributes of type DURATION 135 135 durations?: { 136 136 [string]: time_1.Duration 137 - } @protobuf(7,type=map<sint32,google.protobuf.Duration>,"(gogoproto.nullable)=false","(gogoproto.stdduration)") 137 + } @protobuf(7,map[sint32]google.protobuf.Duration,"(gogoproto.nullable)=false","(gogoproto.stdduration)") 138 138 139 139 // Holds attributes of type BYTES 140 140 bytes?: { 141 141 [string]: bytes_5 142 - } @protobuf(8,type=map<sint32,bytes>) 142 + } @protobuf(8,map[sint32]bytes) 143 143 144 144 // Holds attributes of type STRING_MAP 145 145 stringMaps?: { 146 146 [string]: #StringMap 147 - } @protobuf(9,type=map<sint32,StringMap>,string_maps,"(gogoproto.nullable)=false") 147 + } @protobuf(9,map[sint32]StringMap,string_maps,"(gogoproto.nullable)=false") 148 148 } 149 149 150 150 // A map of string to string. The keys and values in this map are dictionary ··· 153 153 // Holds a set of name/value pairs. 154 154 entries?: { 155 155 [string]: int32 156 - } @protobuf(1,type=map<sint32,sint32>) 156 + } @protobuf(1,map[sint32]sint32) 157 157 } 158 158 159 159 let bytes_5 = bytes
+14 -14
encoding/protobuf/testdata/istio.io/api/mixer/v1/config/client/api_spec_proto_gen.cue
··· 74 74 // List of attributes that are generated when *any* of the HTTP 75 75 // patterns match. This list typically includes the "api.service" 76 76 // and "api.version" attributes. 77 - attributes?: v1.#Attributes @protobuf(1,type=Attributes) 77 + attributes?: v1.#Attributes @protobuf(1,Attributes) 78 78 79 79 // List of HTTP patterns to match. 80 - patterns?: [...#HTTPAPISpecPattern] @protobuf(2) 80 + patterns?: [...#HTTPAPISpecPattern] @protobuf(2,HTTPAPISpecPattern) 81 81 82 82 // List of APIKey that describes how to extract an API-KEY from an 83 83 // HTTP request. The first API-Key match found in the list is used, ··· 88 88 // 89 89 // `query: key, `query: api_key`, and then `header: x-api-key` 90 90 // 91 - apiKeys?: [...#APIKey] @protobuf(3,name=api_keys) 91 + apiKeys?: [...#APIKey] @protobuf(3,APIKey,name=api_keys) 92 92 } 93 93 94 94 // HTTPAPISpecPattern defines a single pattern to match against ··· 108 108 // List of attributes that are generated if the HTTP request matches 109 109 // the specified http_method and uri_template. This typically 110 110 // includes the "api.operation" attribute. 111 - attributes?: v1.#Attributes @protobuf(1,type=Attributes) 111 + attributes?: v1.#Attributes @protobuf(1,Attributes) 112 112 113 113 // HTTP request method to match against as defined by 114 114 // [rfc7231](https://tools.ietf.org/html/rfc7231#page-21). For 115 115 // example: GET, HEAD, POST, PUT, DELETE. 116 - httpMethod?: string @protobuf(2,name=http_method) 116 + httpMethod?: string @protobuf(2,string,name=http_method) 117 117 {} | { 118 118 // URI template to match against as defined by 119 119 // [rfc6570](https://tools.ietf.org/html/rfc6570). For example, the ··· 124 124 // /dictionary/{term:1}/{term} 125 125 // /search{?q*,lang} 126 126 // 127 - uriTemplate: string @protobuf(3,name=uri_template) 127 + uriTemplate: string @protobuf(3,string,name=uri_template) 128 128 } | { 129 129 // EXPERIMENTAL: 130 130 // ··· 134 134 // 135 135 // "^/pets/(.*?)?" 136 136 // 137 - regex: string @protobuf(4) 137 + regex: string @protobuf(4,string) 138 138 } 139 139 } 140 140 ··· 153 153 // 154 154 // GET /something?api_key=abcdef12345 155 155 // 156 - query: string @protobuf(1) 156 + query: string @protobuf(1,string) 157 157 } | { 158 158 // API key is sent in a request header. `header` represents the 159 159 // header name. ··· 164 164 // GET /something HTTP/1.1 165 165 // X-API-Key: abcdef12345 166 166 // 167 - header: string @protobuf(2) 167 + header: string @protobuf(2,string) 168 168 } | { 169 169 // API key is sent in a 170 170 // [cookie](https://swagger.io/docs/specification/authentication/cookie-authentication), ··· 175 175 // GET /something HTTP/1.1 176 176 // Cookie: X-API-KEY=abcdef12345 177 177 // 178 - cookie: string @protobuf(3) 178 + cookie: string @protobuf(3,string) 179 179 } 180 180 } 181 181 ··· 191 191 #HTTPAPISpecReference: { 192 192 // REQUIRED. The short name of the HTTPAPISpec. This is the resource 193 193 // name defined by the metadata name field. 194 - name?: string @protobuf(1) 194 + name?: string @protobuf(1,string) 195 195 196 196 // Optional namespace of the HTTPAPISpec. Defaults to the encompassing 197 197 // HTTPAPISpecBinding's metadata namespace field. 198 - namespace?: string @protobuf(2) 198 + namespace?: string @protobuf(2,string) 199 199 } 200 200 201 201 // HTTPAPISpecBinding defines the binding between HTTPAPISpecs and one or more ··· 218 218 // ``` 219 219 #HTTPAPISpecBinding: { 220 220 // REQUIRED. One or more services to map the listed HTTPAPISpec onto. 221 - services?: [...#IstioService] @protobuf(1) 221 + services?: [...#IstioService] @protobuf(1,IstioService) 222 222 223 223 // REQUIRED. One or more HTTPAPISpec references that should be mapped to 224 224 // the specified service(s). The aggregate collection of match 225 225 // conditions defined in the HTTPAPISpecs should not overlap. 226 - apiSpecs?: [...#HTTPAPISpecReference] @protobuf(2,name=api_specs) 226 + apiSpecs?: [...#HTTPAPISpecReference] @protobuf(2,HTTPAPISpecReference,name=api_specs) 227 227 }
+30 -30
encoding/protobuf/testdata/istio.io/api/mixer/v1/config/client/client_config_proto_gen.cue
··· 35 35 #FailPolicy_value: "FAIL_OPEN": 0 36 36 37 37 // Specifies the behavior when the client is unable to connect to Mixer. 38 - policy?: #FailPolicy @protobuf(1) 38 + policy?: #FailPolicy @protobuf(1,FailPolicy) 39 39 40 40 // Max retries on transport error. 41 - maxRetry?: uint32 @protobuf(2,name=max_retry) 41 + maxRetry?: uint32 @protobuf(2,uint32,name=max_retry) 42 42 43 43 // Base time to wait between retries. Will be adjusted by exponential 44 44 // backoff and jitter. 45 - baseRetryWait?: time.Duration @protobuf(3,type=google.protobuf.Duration,name=base_retry_wait) 45 + baseRetryWait?: time.Duration @protobuf(3,google.protobuf.Duration,name=base_retry_wait) 46 46 47 47 // Max time to wait between retries. 48 - maxRetryWait?: time.Duration @protobuf(4,type=google.protobuf.Duration,name=max_retry_wait) 48 + maxRetryWait?: time.Duration @protobuf(4,google.protobuf.Duration,name=max_retry_wait) 49 49 } 50 50 51 51 // Defines the per-service client configuration. 52 52 #ServiceConfig: { 53 53 // If true, do not call Mixer Check. 54 - disableCheckCalls?: bool @protobuf(1,name=disable_check_calls) 54 + disableCheckCalls?: bool @protobuf(1,bool,name=disable_check_calls) 55 55 56 56 // If true, do not call Mixer Report. 57 - disableReportCalls?: bool @protobuf(2,name=disable_report_calls) 57 + disableReportCalls?: bool @protobuf(2,bool,name=disable_report_calls) 58 58 59 59 // Send these attributes to Mixer in both Check and Report. This 60 60 // typically includes the "destination.service" attribute. 61 61 // In case of a per-route override, per-route attributes take precedence 62 62 // over the attributes supplied in the client configuration. 63 - mixerAttributes?: v1.#Attributes @protobuf(3,type=Attributes,name=mixer_attributes) 63 + mixerAttributes?: v1.#Attributes @protobuf(3,Attributes,name=mixer_attributes) 64 64 65 65 // HTTP API specifications to generate API attributes. 66 - httpApiSpec?: [...#HTTPAPISpec] @protobuf(4,name=http_api_spec) 66 + httpApiSpec?: [...#HTTPAPISpec] @protobuf(4,HTTPAPISpec,name=http_api_spec) 67 67 68 68 // Quota specifications to generate quota requirements. 69 - quotaSpec?: [...#QuotaSpec] @protobuf(5,name=quota_spec) 69 + quotaSpec?: [...#QuotaSpec] @protobuf(5,QuotaSpec,name=quota_spec) 70 70 71 71 // Specifies the behavior when the client is unable to connect to Mixer. 72 72 // This is the service-level policy. It overrides 73 73 // [mesh-level 74 74 // policy][istio.mixer.v1.config.client.TransportConfig.network_fail_policy]. 75 - networkFailPolicy?: #NetworkFailPolicy @protobuf(7,name=network_fail_policy) 75 + networkFailPolicy?: #NetworkFailPolicy @protobuf(7,NetworkFailPolicy,name=network_fail_policy) 76 76 77 77 // Default attributes to forward to upstream. This typically 78 78 // includes the "source.ip" and "source.uid" attributes. ··· 86 86 // 3. forwarded attributes from the source filter config (if any); 87 87 // 4. forwarded attributes from the source route config (if any); 88 88 // 5. derived attributes from the request metadata. 89 - forwardAttributes?: v1.#Attributes @protobuf(8,type=Attributes,name=forward_attributes) 89 + forwardAttributes?: v1.#Attributes @protobuf(8,Attributes,name=forward_attributes) 90 90 } 91 91 92 92 // Defines the transport config on how to call Mixer. 93 93 #TransportConfig: { 94 94 // The flag to disable check cache. 95 - disableCheckCache?: bool @protobuf(1,name=disable_check_cache) 95 + disableCheckCache?: bool @protobuf(1,bool,name=disable_check_cache) 96 96 97 97 // The flag to disable quota cache. 98 - disableQuotaCache?: bool @protobuf(2,name=disable_quota_cache) 98 + disableQuotaCache?: bool @protobuf(2,bool,name=disable_quota_cache) 99 99 100 100 // The flag to disable report batch. 101 - disableReportBatch?: bool @protobuf(3,name=disable_report_batch) 101 + disableReportBatch?: bool @protobuf(3,bool,name=disable_report_batch) 102 102 103 103 // Specifies the behavior when the client is unable to connect to Mixer. 104 104 // This is the mesh level policy. The default value for policy is FAIL_OPEN. 105 - networkFailPolicy?: #NetworkFailPolicy @protobuf(4,name=network_fail_policy) 105 + networkFailPolicy?: #NetworkFailPolicy @protobuf(4,NetworkFailPolicy,name=network_fail_policy) 106 106 107 107 // Specify refresh interval to write Mixer client statistics to Envoy share 108 108 // memory. If not specified, the interval is 10 seconds. 109 - statsUpdateInterval?: time.Duration @protobuf(5,type=google.protobuf.Duration,name=stats_update_interval) 109 + statsUpdateInterval?: time.Duration @protobuf(5,google.protobuf.Duration,name=stats_update_interval) 110 110 111 111 // Name of the cluster that will forward check calls to a pool of mixer 112 112 // servers. Defaults to "mixer_server". By using different names for ··· 116 116 // 117 117 // NOTE: Any value other than the default "mixer_server" will require the 118 118 // Istio Grafana dashboards to be reconfigured to use the new name. 119 - checkCluster?: string @protobuf(6,name=check_cluster) 119 + checkCluster?: string @protobuf(6,string,name=check_cluster) 120 120 121 121 // Name of the cluster that will forward report calls to a pool of mixer 122 122 // servers. Defaults to "mixer_server". By using different names for ··· 126 126 // 127 127 // NOTE: Any value other than the default "mixer_server" will require the 128 128 // Istio Grafana dashboards to be reconfigured to use the new name. 129 - reportCluster?: string @protobuf(7,name=report_cluster) 129 + reportCluster?: string @protobuf(7,string,name=report_cluster) 130 130 131 131 // Default attributes to forward to Mixer upstream. This typically 132 132 // includes the "source.ip" and "source.uid" attributes. These 133 133 // attributes are consumed by the proxy in front of mixer. 134 - attributesForMixerProxy?: v1.#Attributes @protobuf(8,type=Attributes,name=attributes_for_mixer_proxy) 134 + attributesForMixerProxy?: v1.#Attributes @protobuf(8,Attributes,name=attributes_for_mixer_proxy) 135 135 } 136 136 137 137 // Defines the client config for HTTP. 138 138 #HttpClientConfig: { 139 139 // The transport config. 140 - transport?: #TransportConfig @protobuf(1) 140 + transport?: #TransportConfig @protobuf(1,TransportConfig) 141 141 142 142 // Map of control configuration indexed by destination.service. This 143 143 // is used to support per-service configuration for cases where a 144 144 // mixerclient serves multiple services. 145 145 serviceConfigs?: { 146 146 [string]: #ServiceConfig 147 - } @protobuf(2,type=map<string,ServiceConfig>,service_configs) 147 + } @protobuf(2,map[string]ServiceConfig,service_configs) 148 148 149 149 // Default destination service name if none was specified in the 150 150 // client request. 151 - defaultDestinationService?: string @protobuf(3,name=default_destination_service) 151 + defaultDestinationService?: string @protobuf(3,string,name=default_destination_service) 152 152 153 153 // Default attributes to send to Mixer in both Check and 154 154 // Report. This typically includes "destination.ip" and 155 155 // "destination.uid" attributes. 156 - mixerAttributes?: v1.#Attributes @protobuf(4,type=Attributes,name=mixer_attributes) 156 + mixerAttributes?: v1.#Attributes @protobuf(4,Attributes,name=mixer_attributes) 157 157 158 158 // Default attributes to forward to upstream. This typically 159 159 // includes the "source.ip" and "source.uid" attributes. 160 - forwardAttributes?: v1.#Attributes @protobuf(5,type=Attributes,name=forward_attributes) 160 + forwardAttributes?: v1.#Attributes @protobuf(5,Attributes,name=forward_attributes) 161 161 } 162 162 163 163 // Defines the client config for TCP. 164 164 #TcpClientConfig: { 165 165 // The transport config. 166 - transport?: #TransportConfig @protobuf(1) 166 + transport?: #TransportConfig @protobuf(1,TransportConfig) 167 167 168 168 // Default attributes to send to Mixer in both Check and 169 169 // Report. This typically includes "destination.ip" and 170 170 // "destination.uid" attributes. 171 - mixerAttributes?: v1.#Attributes @protobuf(2,type=Attributes,name=mixer_attributes) 171 + mixerAttributes?: v1.#Attributes @protobuf(2,Attributes,name=mixer_attributes) 172 172 173 173 // If set to true, disables Mixer check calls. 174 - disableCheckCalls?: bool @protobuf(3,name=disable_check_calls) 174 + disableCheckCalls?: bool @protobuf(3,bool,name=disable_check_calls) 175 175 176 176 // If set to true, disables Mixer check calls. 177 - disableReportCalls?: bool @protobuf(4,name=disable_report_calls) 177 + disableReportCalls?: bool @protobuf(4,bool,name=disable_report_calls) 178 178 179 179 // Quota specifications to generate quota requirements. 180 180 // It applies on the new TCP connections. 181 - connectionQuotaSpec?: #QuotaSpec @protobuf(5,name=connection_quota_spec) 181 + connectionQuotaSpec?: #QuotaSpec @protobuf(5,QuotaSpec,name=connection_quota_spec) 182 182 183 183 // Specify report interval to send periodical reports for long TCP 184 184 // connections. If not specified, the interval is 10 seconds. This interval 185 185 // should not be less than 1 second, otherwise it will be reset to 1 second. 186 - reportInterval?: time.Duration @protobuf(6,type=google.protobuf.Duration,name=report_interval) 186 + reportInterval?: time.Duration @protobuf(6,google.protobuf.Duration,name=report_interval) 187 187 }
+13 -13
encoding/protobuf/testdata/istio.io/api/mixer/v1/config/client/quota_proto_gen.cue
··· 56 56 // Determines the quotas used for individual requests. 57 57 #QuotaSpec: { 58 58 // A list of Quota rules. 59 - rules?: [...#QuotaRule] @protobuf(1) 59 + rules?: [...#QuotaRule] @protobuf(1,QuotaRule) 60 60 } 61 61 62 62 // Specifies a rule with list of matches and list of quotas. ··· 64 64 #QuotaRule: { 65 65 // If empty, match all request. 66 66 // If any of match is true, it is matched. 67 - match?: [...#AttributeMatch] @protobuf(1) 67 + match?: [...#AttributeMatch] @protobuf(1,AttributeMatch) 68 68 69 69 // The list of quotas to charge. 70 - quotas?: [...#Quota] @protobuf(2) 70 + quotas?: [...#Quota] @protobuf(2,Quota) 71 71 } 72 72 73 73 // Describes how to match a given string in HTTP headers. Match is ··· 75 75 #StringMatch: { 76 76 {} | { 77 77 // exact string match 78 - exact: string @protobuf(1) 78 + exact: string @protobuf(1,string) 79 79 } | { 80 80 // prefix-based match 81 - prefix: string @protobuf(2) 81 + prefix: string @protobuf(2,string) 82 82 } | { 83 83 // ECMAscript style regex-based match 84 - regex: string @protobuf(3) 84 + regex: string @protobuf(3,string) 85 85 } 86 86 } 87 87 ··· 99 99 // exact: POST 100 100 clause?: { 101 101 [string]: #StringMatch 102 - } @protobuf(1,type=map<string,StringMatch>) 102 + } @protobuf(1,map[string]StringMatch) 103 103 } 104 104 105 105 // Specifies a quota to use with quota name and amount. 106 106 #Quota: { 107 107 // The quota name to charge 108 - quota?: string @protobuf(1) 108 + quota?: string @protobuf(1,string) 109 109 110 110 // The quota amount to charge 111 - charge?: int64 @protobuf(2) 111 + charge?: int64 @protobuf(2,int64) 112 112 } 113 113 114 114 // QuotaSpecBinding defines the binding between QuotaSpecs and one or more 115 115 // IstioService. 116 116 #QuotaSpecBinding: { 117 117 // REQUIRED. One or more services to map the listed QuotaSpec onto. 118 - services?: [...#IstioService] @protobuf(1) 118 + services?: [...#IstioService] @protobuf(1,IstioService) 119 119 120 120 // QuotaSpecReference uniquely identifies the QuotaSpec used in the 121 121 // Binding. 122 122 #QuotaSpecReference: { 123 123 // REQUIRED. The short name of the QuotaSpec. This is the resource 124 124 // name defined by the metadata name field. 125 - name?: string @protobuf(1) 125 + name?: string @protobuf(1,string) 126 126 127 127 // Optional namespace of the QuotaSpec. Defaults to the value of the 128 128 // metadata namespace field. 129 - namespace?: string @protobuf(2) 129 + namespace?: string @protobuf(2,string) 130 130 } 131 131 132 132 // REQUIRED. One or more QuotaSpec references that should be mapped to 133 133 // the specified service(s). The aggregate collection of match 134 134 // conditions defined in the QuotaSpecs should not overlap. 135 - quotaSpecs?: [...#QuotaSpecReference] @protobuf(2,name=quota_specs) 135 + quotaSpecs?: [...#QuotaSpecReference] @protobuf(2,QuotaSpecReference,name=quota_specs) 136 136 }
+5 -5
encoding/protobuf/testdata/istio.io/api/mixer/v1/config/client/service_proto_gen.cue
··· 27 27 // (e.g. on Kubernetes, "reviews" + "default" + "svc.cluster.local" -> "reviews.default.svc.cluster.local"). 28 28 #IstioService: { 29 29 // The short name of the service such as "foo". 30 - name?: string @protobuf(1) 30 + name?: string @protobuf(1,string) 31 31 32 32 // Optional namespace of the service. Defaults to value of metadata namespace field. 33 - namespace?: string @protobuf(2) 33 + namespace?: string @protobuf(2,string) 34 34 35 35 // Domain suffix used to construct the service FQDN in implementations that support such specification. 36 - domain?: string @protobuf(3) 36 + domain?: string @protobuf(3,string) 37 37 38 38 // The service FQDN. 39 - service?: string @protobuf(4) 39 + service?: string @protobuf(4,string) 40 40 41 41 // Optional one or more labels that uniquely identify the service version. 42 42 // ··· 44 44 // 45 45 labels?: { 46 46 [string]: string 47 - } @protobuf(5,type=map<string,string>) 47 + } @protobuf(5,map[string]string) 48 48 }
+33 -33
encoding/protobuf/testdata/istio.io/api/mixer/v1/mixer_proto_gen.cue
··· 26 26 // parameters for a quota allocation 27 27 #QuotaParams: { 28 28 // Amount of quota to allocate 29 - amount?: int64 @protobuf(1) 29 + amount?: int64 @protobuf(1,int64) 30 30 31 31 // When true, supports returning less quota than what was requested. 32 - bestEffort?: bool @protobuf(2,name=best_effort) 32 + bestEffort?: bool @protobuf(2,bool,name=best_effort) 33 33 } 34 34 35 35 // The attributes to use for this request. 36 36 // 37 37 // Mixer's configuration determines how these attributes are used to 38 38 // establish the result returned in the response. 39 - attributes?: #CompressedAttributes @protobuf(1,"(gogoproto.nullable)=false") 39 + attributes?: #CompressedAttributes @protobuf(1,CompressedAttributes,"(gogoproto.nullable)=false") 40 40 41 41 // The number of words in the global dictionary, used with to populate the attributes. 42 42 // This value is used as a quick way to determine whether the client is using a dictionary that 43 43 // the server understands. 44 - globalWordCount?: uint32 @protobuf(2,name=global_word_count) 44 + globalWordCount?: uint32 @protobuf(2,uint32,name=global_word_count) 45 45 46 46 // Used for deduplicating `Check` calls in the case of failed RPCs and retries. This should be a UUID 47 47 // per call, where the same UUID is used for retries of the same call. 48 - deduplicationId?: string @protobuf(3,name=deduplication_id) 48 + deduplicationId?: string @protobuf(3,string,name=deduplication_id) 49 49 50 50 // The individual quotas to allocate 51 51 quotas?: { 52 52 [string]: #QuotaParams 53 - } @protobuf(4,type=map<string,QuotaParams>,"(gogoproto.nullable)=false") 53 + } @protobuf(4,map[string]QuotaParams,"(gogoproto.nullable)=false") 54 54 } 55 55 56 56 // The response generated by the Check method. ··· 59 59 #PreconditionResult: { 60 60 // A status code of OK indicates all preconditions were satisfied. Any other code indicates not 61 61 // all preconditions were satisfied and details describe why. 62 - status?: status_1.#Status @protobuf(1,type=google.rpc.Status,"(gogoproto.nullable)=false") 62 + status?: status_1.#Status @protobuf(1,google.rpc.Status,"(gogoproto.nullable)=false") 63 63 64 64 // The amount of time for which this result can be considered valid. 65 - validDuration?: time.Duration @protobuf(2,type=google.protobuf.Duration,name=valid_duration,"(gogoproto.nullable)=false","(gogoproto.stdduration)") 65 + validDuration?: time.Duration @protobuf(2,google.protobuf.Duration,name=valid_duration,"(gogoproto.nullable)=false","(gogoproto.stdduration)") 66 66 67 67 // The number of uses for which this result can be considered valid. 68 - validUseCount?: int32 @protobuf(3,name=valid_use_count) 68 + validUseCount?: int32 @protobuf(3,int32,name=valid_use_count) 69 69 70 70 // The total set of attributes that were used in producing the result 71 71 // along with matching conditions. 72 - referencedAttributes?: #ReferencedAttributes @protobuf(5,name=referenced_attributes) 72 + referencedAttributes?: #ReferencedAttributes @protobuf(5,ReferencedAttributes,name=referenced_attributes) 73 73 74 74 // An optional routing directive, used to manipulate the traffic metadata 75 75 // whenever all preconditions are satisfied. 76 - routeDirective?: #RouteDirective @protobuf(6,name=route_directive) 76 + routeDirective?: #RouteDirective @protobuf(6,RouteDirective,name=route_directive) 77 77 } 78 78 79 79 // Expresses the result of a quota allocation. 80 80 #QuotaResult: { 81 81 // The amount of time for which this result can be considered valid. 82 - validDuration?: time.Duration @protobuf(1,type=google.protobuf.Duration,name=valid_duration,"(gogoproto.nullable)=false","(gogoproto.stdduration)") 82 + validDuration?: time.Duration @protobuf(1,google.protobuf.Duration,name=valid_duration,"(gogoproto.nullable)=false","(gogoproto.stdduration)") 83 83 84 84 // The amount of granted quota. When `QuotaParams.best_effort` is true, this will be >= 0. 85 85 // If `QuotaParams.best_effort` is false, this will be either 0 or >= `QuotaParams.amount`. 86 - grantedAmount?: int64 @protobuf(2,name=granted_amount) 86 + grantedAmount?: int64 @protobuf(2,int64,name=granted_amount) 87 87 88 88 // The total set of attributes that were used in producing the result 89 89 // along with matching conditions. 90 - referencedAttributes?: #ReferencedAttributes @protobuf(5,name=referenced_attributes,"(gogoproto.nullable)=false") 90 + referencedAttributes?: #ReferencedAttributes @protobuf(5,ReferencedAttributes,name=referenced_attributes,"(gogoproto.nullable)=false") 91 91 } 92 92 93 93 // The precondition check results. 94 - precondition?: #PreconditionResult @protobuf(2,"(gogoproto.nullable)=false") 94 + precondition?: #PreconditionResult @protobuf(2,PreconditionResult,"(gogoproto.nullable)=false") 95 95 96 96 // The resulting quota, one entry per requested quota. 97 97 quotas?: { 98 98 [string]: #QuotaResult 99 - } @protobuf(3,type=map<string,QuotaResult>,"(gogoproto.nullable)=false") 99 + } @protobuf(3,map[string]QuotaResult,"(gogoproto.nullable)=false") 100 100 } 101 101 102 102 // Describes the attributes that were used to determine the response. ··· 119 119 #AttributeMatch: { 120 120 // The name of the attribute. This is a dictionary index encoded in a manner identical 121 121 // to all strings in the [CompressedAttributes][istio.mixer.v1.CompressedAttributes] message. 122 - name?: int32 @protobuf(1,type=sint32) 122 + name?: int32 @protobuf(1,sint32) 123 123 124 124 // The kind of match against the attribute value. 125 - condition?: #Condition @protobuf(2) 125 + condition?: #Condition @protobuf(2,Condition) 126 126 127 127 // If a REGEX condition is provided for a STRING_MAP attribute, 128 128 // clients should use the regex value to match against map keys. 129 - regex?: string @protobuf(3) 129 + regex?: string @protobuf(3,string) 130 130 131 131 // A key in a STRING_MAP. When multiple keys from a STRING_MAP 132 132 // attribute were referenced, there will be multiple AttributeMatch ··· 138 138 // 139 139 // If no map_key value is provided for a STRING_MAP attribute, the 140 140 // entire STRING_MAP will be used. 141 - mapKey?: int32 @protobuf(4,type=sint32,name=map_key) 141 + mapKey?: int32 @protobuf(4,sint32,name=map_key) 142 142 } 143 143 144 144 // The message-level dictionary. Refer to [CompressedAttributes][istio.mixer.v1.CompressedAttributes] for information 145 145 // on using dictionaries. 146 - words?: [...string] @protobuf(1) 146 + words?: [...string] @protobuf(1,string) 147 147 148 148 // Describes a set of attributes. 149 - attributeMatches?: [...#AttributeMatch] @protobuf(2,name=attribute_matches,"(gogoproto.nullable)=false") 149 + attributeMatches?: [...#AttributeMatch] @protobuf(2,AttributeMatch,name=attribute_matches,"(gogoproto.nullable)=false") 150 150 } 151 151 152 152 // Operation on HTTP headers to replace, append, or remove a header. Header ··· 166 166 } 167 167 168 168 // Header name. 169 - name?: string @protobuf(1) 169 + name?: string @protobuf(1,string) 170 170 171 171 // Header value. 172 - value?: string @protobuf(2) 172 + value?: string @protobuf(2,string) 173 173 174 174 // Header operation. 175 - operation?: #Operation @protobuf(3) 175 + operation?: #Operation @protobuf(3,Operation) 176 176 } 177 177 178 178 // Expresses the routing manipulation actions to be performed on behalf of 179 179 // Mixer in response to a precondition check. 180 180 #RouteDirective: { 181 181 // Operations on the request headers. 182 - requestHeaderOperations?: [...#HeaderOperation] @protobuf(1,name=request_header_operations,"(gogoproto.nullable)=false") 182 + requestHeaderOperations?: [...#HeaderOperation] @protobuf(1,HeaderOperation,name=request_header_operations,"(gogoproto.nullable)=false") 183 183 184 184 // Operations on the response headers. 185 - responseHeaderOperations?: [...#HeaderOperation] @protobuf(2,name=response_header_operations,"(gogoproto.nullable)=false") 185 + responseHeaderOperations?: [...#HeaderOperation] @protobuf(2,HeaderOperation,name=response_header_operations,"(gogoproto.nullable)=false") 186 186 187 187 // If set, enables a direct response without proxying the request to the routing 188 188 // destination. Required to be a value in the 2xx or 3xx range. 189 - directResponseCode?: uint32 @protobuf(3,name=direct_response_code) 189 + directResponseCode?: uint32 @protobuf(3,uint32,name=direct_response_code) 190 190 191 191 // Supplies the response body for the direct response. 192 192 // If this setting is omitted, no body is included in the generated response. 193 - directResponseBody?: string @protobuf(4,name=direct_response_body) 193 + directResponseBody?: string @protobuf(4,string,name=direct_response_body) 194 194 } 195 195 196 196 // Used to report telemetry after performing one or more actions. ··· 220 220 // Each `Attributes` element represents the state of a single action. Multiple actions 221 221 // can be provided in a single message in order to improve communication efficiency. The 222 222 // client can accumulate a set of actions and send them all in one single message. 223 - attributes?: [...#CompressedAttributes] @protobuf(1,"(gogoproto.nullable)=false") 223 + attributes?: [...#CompressedAttributes] @protobuf(1,CompressedAttributes,"(gogoproto.nullable)=false") 224 224 225 225 // Indicates how to decode the attributes sets in this request. 226 - repeatedAttributesSemantics?: #RepeatedAttributesSemantics @protobuf(4,name=repeated_attributes_semantics) 226 + repeatedAttributesSemantics?: #RepeatedAttributesSemantics @protobuf(4,RepeatedAttributesSemantics,name=repeated_attributes_semantics) 227 227 228 228 // The default message-level dictionary for all the attributes. 229 229 // Individual attribute messages can have their own dictionaries, but if they don't ··· 231 231 // 232 232 // This makes it possible to share the same dictionary for all attributes in this 233 233 // request, which can substantially reduce the overall request size. 234 - defaultWords?: [...string] @protobuf(2,name=default_words) 234 + defaultWords?: [...string] @protobuf(2,string,name=default_words) 235 235 236 236 // The number of words in the global dictionary. 237 237 // To detect global dictionary out of sync between client and server. 238 - globalWordCount?: uint32 @protobuf(3,name=global_word_count) 238 + globalWordCount?: uint32 @protobuf(3,uint32,name=global_word_count) 239 239 } 240 240 241 241 // Used to carry responses to telemetry reports
+20 -20
encoding/protobuf/testdata/istio.io/api/networking/v1alpha3/gateway_proto_gen.cue
··· 205 205 206 206 #Gateway: { 207 207 // REQUIRED: A list of server specifications. 208 - servers?: [...#Server] @protobuf(1) 208 + servers?: [...#Server] @protobuf(1,Server) 209 209 210 210 // REQUIRED: One or more labels that indicate a specific set of pods/VMs 211 211 // on which this gateway configuration should be applied. The scope of ··· 214 214 // reside in the same namespace as the gateway workload instance. 215 215 selector?: { 216 216 [string]: string 217 - } @protobuf(2,type=map<string,string>) 217 + } @protobuf(2,map[string]string) 218 218 selector?: {[name=_]: name} 219 219 } 220 220 ··· 282 282 #Server: { 283 283 // REQUIRED: The Port on which the proxy should listen for incoming 284 284 // connections. 285 - port?: #Port @protobuf(1) 285 + port?: #Port @protobuf(1,Port) 286 286 port?: >10 & <100 287 287 288 288 // $hide_from_docs ··· 290 290 // to. Format: `x.x.x.x` or `unix:///path/to/uds` or `unix://@foobar` 291 291 // (Linux abstract namespace). When using Unix domain sockets, the port 292 292 // number should be 0. 293 - bind?: string @protobuf(4) 293 + bind?: string @protobuf(4,string) 294 294 295 295 // REQUIRED. One or more hosts exposed by this gateway. 296 296 // While typically applicable to ··· 316 316 // Private configurations (e.g., `exportTo` set to `.`) will not be 317 317 // available. Refer to the `exportTo` setting in `VirtualService`, 318 318 // `DestinationRule`, and `ServiceEntry` configurations for details. 319 - hosts?: [...string] @protobuf(2) 319 + hosts?: [...string] @protobuf(2,string) 320 320 321 321 #TLSOptions: { 322 322 // If set to true, the load balancer will send a 301 redirect for all 323 323 // http connections, asking the clients to use HTTPS. 324 - httpsRedirect?: bool @protobuf(1,name=https_redirect) 324 + httpsRedirect?: bool @protobuf(1,bool,name=https_redirect) 325 325 326 326 // TLS modes enforced by the proxy 327 327 #TLSmode: ··· 359 359 // Optional: Indicates whether connections to this port should be 360 360 // secured using TLS. The value of this field determines how TLS is 361 361 // enforced. 362 - mode?: #TLSmode @protobuf(2) 362 + mode?: #TLSmode @protobuf(2,TLSmode) 363 363 // Extra comment. 364 364 365 365 // REQUIRED if mode is `SIMPLE` or `MUTUAL`. The path to the file 366 366 // holding the server-side TLS certificate to use. 367 - serverCertificate?: string @protobuf(3,name=server_certificate) 367 + serverCertificate?: string @protobuf(3,string,name=server_certificate) 368 368 369 369 // REQUIRED if mode is `SIMPLE` or `MUTUAL`. The path to the file 370 370 // holding the server's private key. 371 - privateKey?: string @protobuf(4,name=private_key) 371 + privateKey?: string @protobuf(4,string,name=private_key) 372 372 373 373 // REQUIRED if mode is `MUTUAL`. The path to a file containing 374 374 // certificate authority certificates to use in verifying a presented 375 375 // client side certificate. 376 - caCertificates?: string @protobuf(5,name=ca_certificates) 376 + caCertificates?: string @protobuf(5,string,name=ca_certificates) 377 377 378 378 // The credentialName stands for a unique identifier that can be used 379 379 // to identify the serverCertificate and the privateKey. The ··· 391 391 // key, and the CA certificate (if using mutual TLS). Set the 392 392 // `ISTIO_META_USER_SDS` metadata variable in the gateway's proxy to 393 393 // enable the dynamic credential fetching feature. 394 - credentialName?: string @protobuf(10,name=credential_name) 394 + credentialName?: string @protobuf(10,string,name=credential_name) 395 395 396 396 // A list of alternate names to verify the subject identity in the 397 397 // certificate presented by the client. 398 - subjectAltNames?: [...string] @protobuf(6,name=subject_alt_names) 398 + subjectAltNames?: [...string] @protobuf(6,string,name=subject_alt_names) 399 399 400 400 // TLS protocol versions. 401 401 #TLSProtocol: "TLS_AUTO" | // Automatically choose the optimal TLS version. ··· 413 413 } 414 414 415 415 // Optional: Minimum TLS protocol version. 416 - minProtocolVersion?: #TLSProtocol @protobuf(7,name=min_protocol_version) 416 + minProtocolVersion?: #TLSProtocol @protobuf(7,TLSProtocol,name=min_protocol_version) 417 417 418 418 // Optional: Maximum TLS protocol version. 419 - maxProtocolVersion?: #TLSProtocol @protobuf(8,name=max_protocol_version) 419 + maxProtocolVersion?: #TLSProtocol @protobuf(8,TLSProtocol,name=max_protocol_version) 420 420 421 421 // Optional: If specified, only support the specified cipher list. 422 422 // Otherwise default to the default cipher list supported by Envoy. 423 - cipherSuites?: [...string] @protobuf(9,name=cipher_suites) 423 + cipherSuites?: [...string] @protobuf(9,string,name=cipher_suites) 424 424 } 425 425 426 426 // Set of TLS related options that govern the server's behavior. Use 427 427 // these options to control if all http requests should be redirected to 428 428 // https, and the TLS modes to use. 429 - tls?: #TLSOptions @protobuf(3) 429 + tls?: #TLSOptions @protobuf(3,TLSOptions) 430 430 431 431 // The loopback IP endpoint or Unix domain socket to which traffic should 432 432 // be forwarded to by default. Format should be `127.0.0.1:PORT` or 433 433 // `unix:///path/to/socket` or `unix://@foobar` (Linux abstract namespace). 434 - defaultEndpoint?: string @protobuf(5,name=default_endpoint) 434 + defaultEndpoint?: string @protobuf(5,string,name=default_endpoint) 435 435 } 436 436 437 437 // Port describes the properties of a specific port of a service. 438 438 #Port: { 439 439 // REQUIRED: A valid non-negative integer port number. 440 - number?: uint32 @protobuf(1) 440 + number?: uint32 @protobuf(1,uint32) 441 441 442 442 // REQUIRED: The protocol exposed on the port. 443 443 // MUST BE one of HTTP|HTTPS|GRPC|HTTP2|MONGO|TCP|TLS. 444 444 // TLS implies the connection will be routed based on the SNI header to 445 445 // the destination without terminating the TLS connection. 446 - protocol?: string @protobuf(2) 446 + protocol?: string @protobuf(2,string) 447 447 448 448 // Label assigned to the port. 449 - name?: string @protobuf(3) 449 + name?: string @protobuf(3,string) 450 450 }
+3 -3
encoding/protobuf/testdata/trailcomment.proto.out.cue
··· 3 3 4 4 #Bar: { 5 5 {} | { 6 - a: string @protobuf(1) 6 + a: string @protobuf(1,string) 7 7 8 8 // hello world 9 9 10 10 } | { 11 - b: string @protobuf(2) 11 + b: string @protobuf(2,string) 12 12 13 13 // hello world 14 14 15 15 } 16 - c?: int32 @protobuf(3) 16 + c?: int32 @protobuf(3,int32) 17 17 // hello world 18 18 19 19 }