cue: observe JSON mappings for google.protobuf.Struct
Change-Id: I234767c9bcdb67dee3492827cf598f5a45258959
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/2681
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
diff --git a/encoding/protobuf/testdata/attributes.proto.out.cue b/encoding/protobuf/testdata/attributes.proto.out.cue
index 9c13d65..dc5a1b1 100644
--- a/encoding/protobuf/testdata/attributes.proto.out.cue
+++ b/encoding/protobuf/testdata/attributes.proto.out.cue
@@ -19,6 +19,15 @@
"github.com/golang/protobuf/ptypes/timestamp"
)
+StructWrap: {
+ struct?: {} @protobuf(1,type=google.protobuf.Struct)
+ any?: _ @protobuf(2,type=google.protobuf.Value)
+ listVal?: [...] @protobuf(3,type=google.protobuf.ListValue)
+ boolVal?: bool @protobuf(4,type=google.protobuf.BoolValue)
+ stringVal?: string @protobuf(5,type=google.protobuf.StringValue)
+ numberVal?: number @protobuf(6,type=google.protobuf.NumberValue)
+}
+
// Attributes represents a set of typed name/value pairs. Many of Mixer's
// API either consume and/or return attributes.
//
diff --git a/encoding/protobuf/testdata/istio.io/api/mixer/v1/attributes.proto b/encoding/protobuf/testdata/istio.io/api/mixer/v1/attributes.proto
index 32fa4fc..780005c 100644
--- a/encoding/protobuf/testdata/istio.io/api/mixer/v1/attributes.proto
+++ b/encoding/protobuf/testdata/istio.io/api/mixer/v1/attributes.proto
@@ -21,6 +21,7 @@
import "gogoproto/gogo.proto";
import "google/protobuf/duration.proto";
import "google/protobuf/timestamp.proto";
+import "google/protobuf/struct.proto";
option (gogoproto.goproto_getters_all) = false;
option (gogoproto.equal_all) = false;
@@ -28,6 +29,16 @@
option (gogoproto.stable_marshaler_all) = true;
option cc_enable_arenas = true;
+message StructWrap {
+ google.protobuf.Struct struct = 1;
+
+ google.protobuf.Value any = 2;
+ google.protobuf.ListValue listVal = 3;
+ google.protobuf.BoolValue boolVal = 4;
+ google.protobuf.StringValue stringVal = 5;
+ google.protobuf.NumberValue numberVal = 6;
+}
+
// Attributes represents a set of typed name/value pairs. Many of Mixer's
// API either consume and/or return attributes.
//
diff --git a/encoding/protobuf/testdata/istio.io/api/mixer/v1/attributes_proto_gen.cue b/encoding/protobuf/testdata/istio.io/api/mixer/v1/attributes_proto_gen.cue
index 9c13d65..df7d3ae 100644
--- a/encoding/protobuf/testdata/istio.io/api/mixer/v1/attributes_proto_gen.cue
+++ b/encoding/protobuf/testdata/istio.io/api/mixer/v1/attributes_proto_gen.cue
@@ -19,6 +19,15 @@
"github.com/golang/protobuf/ptypes/timestamp"
)
+StructWrap: {
+ struct?: {} @protobuf(1,type=google.protobuf.Struct)
+ any?: _ @protobuf(2,type=google.protobuf.Value)
+ listVal?: [...] @protobuf(3,type=google.protobuf.ListValue)
+ boolVal?: bool @protobuf(4,type=google.protobuf.BoolValue)
+ stringVal?: string @protobuf(5,type=google.protobuf.StringValue)
+ numberVal?: number @protobuf(6,type=google.protobuf.NumberValue)
+}
+
// Attributes represents a set of typed name/value pairs. Many of Mixer's
// API either consume and/or return attributes.
//