jsonpb: Handle Struct and NullValue WKTs.
diff --git a/jsonpb/jsonpb.go b/jsonpb/jsonpb.go index d1f6f28..768564e 100644 --- a/jsonpb/jsonpb.go +++ b/jsonpb/jsonpb.go
@@ -41,6 +41,7 @@ import ( "bytes" "encoding/json" + "errors" "fmt" "io" "reflect" @@ -125,6 +126,10 @@ out.write(x) out.write(`s"`) return out.err + case "Struct": + // Let marshalValue handle the `fields` map. + // TODO: pass the correct Properties if needed. + return m.marshalValue(out, &proto.Properties{}, s.Field(0), indent) case "Timestamp": // "RFC 3339, where generated output will always be Z-normalized // and uses 3, 6 or 9 fractional digits." @@ -138,6 +143,17 @@ out.write(x) out.write(`Z"`) return out.err + case "Value": + // Value has a single oneof. + kind := s.Field(0) + if kind.IsNil() { + // "absence of any variant indicates an error" + return errors.New("nil Value") + } + // oneof -> *T -> T -> T.F + x := kind.Elem().Elem().Field(0) + // TODO: pass the correct Properties if needed. + return m.marshalValue(out, &proto.Properties{}, x, indent) } } @@ -304,6 +320,19 @@ return out.err } + // Handle well-known types. + // Most are handled up in marshalObject (because 99% are messages). + type wkt interface { + XXX_WellKnownType() string + } + if wkt, ok := v.Interface().(wkt); ok { + switch wkt.XXX_WellKnownType() { + case "NullValue": + out.write("null") + return out.err + } + } + // Handle enumerations. if !m.EnumsAsInts && prop.Enum != "" { // Unknown enum values will are stringified by the proto library as their
diff --git a/jsonpb/jsonpb_test.go b/jsonpb/jsonpb_test.go index a970063..3d70b87 100644 --- a/jsonpb/jsonpb_test.go +++ b/jsonpb/jsonpb_test.go
@@ -40,6 +40,7 @@ pb "github.com/golang/protobuf/jsonpb/jsonpb_test_proto" proto3pb "github.com/golang/protobuf/proto/proto3_proto" durpb "github.com/golang/protobuf/ptypes/duration" + stpb "github.com/golang/protobuf/ptypes/struct" tspb "github.com/golang/protobuf/ptypes/timestamp" wpb "github.com/golang/protobuf/ptypes/wrappers" ) @@ -321,6 +322,12 @@ {"proto2 extension", marshaler, realNumber, realNumberJSON}, {"Duration", marshaler, &pb.KnownTypes{Dur: &durpb.Duration{Seconds: 3}}, `{"dur":"3.000s"}`}, + {"Struct", marshaler, &pb.KnownTypes{St: &stpb.Struct{ + Fields: map[string]*stpb.Value{ + "one": &stpb.Value{Kind: &stpb.Value_StringValue{"loneliest number"}}, + "two": &stpb.Value{Kind: &stpb.Value_NullValue{stpb.NullValue_NULL_VALUE}}, + }, + }}, `{"st":{"one":"loneliest number","two":null}}`}, {"Timestamp", marshaler, &pb.KnownTypes{Ts: &tspb.Timestamp{Seconds: 14e8, Nanos: 21e6}}, `{"ts":"2014-05-13T16:53:20.021Z"}`}, {"DoubleValue", marshaler, &pb.KnownTypes{Dbl: &wpb.DoubleValue{Value: 1.2}}, `{"dbl":1.2}`},
diff --git a/jsonpb/jsonpb_test_proto/Makefile b/jsonpb/jsonpb_test_proto/Makefile index d6e9768..3f845ba 100644 --- a/jsonpb/jsonpb_test_proto/Makefile +++ b/jsonpb/jsonpb_test_proto/Makefile
@@ -30,4 +30,4 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. regenerate: - protoc --go_out=Mgoogle/protobuf/duration.proto=github.com/golang/protobuf/ptypes/duration,Mgoogle/protobuf/timestamp.proto=github.com/golang/protobuf/ptypes/timestamp,Mgoogle/protobuf/wrappers.proto=github.com/golang/protobuf/ptypes/wrappers:. *.proto + protoc --go_out=Mgoogle/protobuf/duration.proto=github.com/golang/protobuf/ptypes/duration,Mgoogle/protobuf/struct.proto=github.com/golang/protobuf/ptypes/struct,Mgoogle/protobuf/timestamp.proto=github.com/golang/protobuf/ptypes/timestamp,Mgoogle/protobuf/wrappers.proto=github.com/golang/protobuf/ptypes/wrappers:. *.proto
diff --git a/jsonpb/jsonpb_test_proto/test_objects.pb.go b/jsonpb/jsonpb_test_proto/test_objects.pb.go index de58e89..a1263fb 100644 --- a/jsonpb/jsonpb_test_proto/test_objects.pb.go +++ b/jsonpb/jsonpb_test_proto/test_objects.pb.go
@@ -8,8 +8,9 @@ import fmt "fmt" import math "math" import google_protobuf "github.com/golang/protobuf/ptypes/duration" -import google_protobuf1 "github.com/golang/protobuf/ptypes/timestamp" -import google_protobuf2 "github.com/golang/protobuf/ptypes/wrappers" +import google_protobuf1 "github.com/golang/protobuf/ptypes/struct" +import google_protobuf2 "github.com/golang/protobuf/ptypes/timestamp" +import google_protobuf3 "github.com/golang/protobuf/ptypes/wrappers" // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -519,16 +520,17 @@ type KnownTypes struct { Dur *google_protobuf.Duration `protobuf:"bytes,1,opt,name=dur" json:"dur,omitempty"` - Ts *google_protobuf1.Timestamp `protobuf:"bytes,2,opt,name=ts" json:"ts,omitempty"` - Dbl *google_protobuf2.DoubleValue `protobuf:"bytes,3,opt,name=dbl" json:"dbl,omitempty"` - Flt *google_protobuf2.FloatValue `protobuf:"bytes,4,opt,name=flt" json:"flt,omitempty"` - I64 *google_protobuf2.Int64Value `protobuf:"bytes,5,opt,name=i64" json:"i64,omitempty"` - U64 *google_protobuf2.UInt64Value `protobuf:"bytes,6,opt,name=u64" json:"u64,omitempty"` - I32 *google_protobuf2.Int32Value `protobuf:"bytes,7,opt,name=i32" json:"i32,omitempty"` - U32 *google_protobuf2.UInt32Value `protobuf:"bytes,8,opt,name=u32" json:"u32,omitempty"` - Bool *google_protobuf2.BoolValue `protobuf:"bytes,9,opt,name=bool" json:"bool,omitempty"` - Str *google_protobuf2.StringValue `protobuf:"bytes,10,opt,name=str" json:"str,omitempty"` - Bytes *google_protobuf2.BytesValue `protobuf:"bytes,11,opt,name=bytes" json:"bytes,omitempty"` + St *google_protobuf1.Struct `protobuf:"bytes,12,opt,name=st" json:"st,omitempty"` + Ts *google_protobuf2.Timestamp `protobuf:"bytes,2,opt,name=ts" json:"ts,omitempty"` + Dbl *google_protobuf3.DoubleValue `protobuf:"bytes,3,opt,name=dbl" json:"dbl,omitempty"` + Flt *google_protobuf3.FloatValue `protobuf:"bytes,4,opt,name=flt" json:"flt,omitempty"` + I64 *google_protobuf3.Int64Value `protobuf:"bytes,5,opt,name=i64" json:"i64,omitempty"` + U64 *google_protobuf3.UInt64Value `protobuf:"bytes,6,opt,name=u64" json:"u64,omitempty"` + I32 *google_protobuf3.Int32Value `protobuf:"bytes,7,opt,name=i32" json:"i32,omitempty"` + U32 *google_protobuf3.UInt32Value `protobuf:"bytes,8,opt,name=u32" json:"u32,omitempty"` + Bool *google_protobuf3.BoolValue `protobuf:"bytes,9,opt,name=bool" json:"bool,omitempty"` + Str *google_protobuf3.StringValue `protobuf:"bytes,10,opt,name=str" json:"str,omitempty"` + Bytes *google_protobuf3.BytesValue `protobuf:"bytes,11,opt,name=bytes" json:"bytes,omitempty"` XXX_unrecognized []byte `json:"-"` } @@ -544,70 +546,77 @@ return nil } -func (m *KnownTypes) GetTs() *google_protobuf1.Timestamp { +func (m *KnownTypes) GetSt() *google_protobuf1.Struct { + if m != nil { + return m.St + } + return nil +} + +func (m *KnownTypes) GetTs() *google_protobuf2.Timestamp { if m != nil { return m.Ts } return nil } -func (m *KnownTypes) GetDbl() *google_protobuf2.DoubleValue { +func (m *KnownTypes) GetDbl() *google_protobuf3.DoubleValue { if m != nil { return m.Dbl } return nil } -func (m *KnownTypes) GetFlt() *google_protobuf2.FloatValue { +func (m *KnownTypes) GetFlt() *google_protobuf3.FloatValue { if m != nil { return m.Flt } return nil } -func (m *KnownTypes) GetI64() *google_protobuf2.Int64Value { +func (m *KnownTypes) GetI64() *google_protobuf3.Int64Value { if m != nil { return m.I64 } return nil } -func (m *KnownTypes) GetU64() *google_protobuf2.UInt64Value { +func (m *KnownTypes) GetU64() *google_protobuf3.UInt64Value { if m != nil { return m.U64 } return nil } -func (m *KnownTypes) GetI32() *google_protobuf2.Int32Value { +func (m *KnownTypes) GetI32() *google_protobuf3.Int32Value { if m != nil { return m.I32 } return nil } -func (m *KnownTypes) GetU32() *google_protobuf2.UInt32Value { +func (m *KnownTypes) GetU32() *google_protobuf3.UInt32Value { if m != nil { return m.U32 } return nil } -func (m *KnownTypes) GetBool() *google_protobuf2.BoolValue { +func (m *KnownTypes) GetBool() *google_protobuf3.BoolValue { if m != nil { return m.Bool } return nil } -func (m *KnownTypes) GetStr() *google_protobuf2.StringValue { +func (m *KnownTypes) GetStr() *google_protobuf3.StringValue { if m != nil { return m.Str } return nil } -func (m *KnownTypes) GetBytes() *google_protobuf2.BytesValue { +func (m *KnownTypes) GetBytes() *google_protobuf3.BytesValue { if m != nil { return m.Bytes } @@ -637,65 +646,66 @@ } var fileDescriptor1 = []byte{ - // 947 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x7c, 0x95, 0xd1, 0x72, 0xdb, 0x44, - 0x14, 0x86, 0x6b, 0xad, 0x65, 0x49, 0xeb, 0x26, 0x98, 0x9d, 0x14, 0x54, 0x53, 0xa0, 0xe3, 0x81, - 0x0e, 0x14, 0x50, 0x07, 0xb7, 0xd3, 0x61, 0x0a, 0x37, 0xa4, 0x31, 0xd0, 0x81, 0x94, 0x99, 0x4d, - 0x43, 0x2f, 0x3d, 0x72, 0xa3, 0x18, 0x15, 0x49, 0xab, 0x39, 0x92, 0x49, 0x3d, 0x70, 0xc1, 0x43, - 0xc0, 0x23, 0xc0, 0x23, 0xf0, 0x7c, 0x9c, 0xb3, 0x2b, 0x69, 0x9d, 0xb8, 0x26, 0x37, 0xf1, 0xea, - 0xff, 0xcf, 0xaf, 0xd5, 0xb7, 0x47, 0x47, 0x5c, 0xd4, 0x49, 0x55, 0xcf, 0xd5, 0xe2, 0x65, 0xf2, - 0xa2, 0xae, 0xa2, 0x12, 0x54, 0xad, 0xc4, 0xe0, 0x65, 0xa5, 0x8a, 0x72, 0x31, 0x7e, 0x6f, 0xa9, - 0xd4, 0x32, 0x4b, 0xee, 0xe9, 0xab, 0x8b, 0xd5, 0xf9, 0xbd, 0xb3, 0x15, 0xc4, 0x75, 0xaa, 0x0a, - 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14, 0xb4, 0xa0, 0x18, 0x81, 0x82, 0x16, 0x14, 0x74, 0xa0, - 0x18, 0x81, 0x82, 0x0e, 0x14, 0x74, 0xa0, 0x18, 0x81, 0x82, 0x0e, 0x14, 0x58, 0x50, 0x8c, 0x40, - 0x81, 0x05, 0x05, 0x16, 0x14, 0x23, 0x50, 0x60, 0x41, 0x81, 0x05, 0xc5, 0x08, 0x14, 0x9c, 0x6c, - 0x54, 0x75, 0xa0, 0x18, 0x81, 0x02, 0x0b, 0x0a, 0x3a, 0x50, 0x8c, 0x40, 0x41, 0x07, 0x0a, 0x2c, - 0x28, 0x46, 0xa0, 0xc0, 0x82, 0x02, 0x0b, 0x8a, 0x11, 0x28, 0xb0, 0xa0, 0xa0, 0x03, 0xc5, 0x08, - 0x14, 0x18, 0x50, 0xff, 0x62, 0x43, 0x3d, 0x4f, 0xcf, 0x96, 0x49, 0x2d, 0xee, 0x72, 0xf7, 0x85, - 0xca, 0x14, 0xe8, 0x7e, 0xda, 0x9f, 0x1e, 0x44, 0xa6, 0xa9, 0x23, 0x23, 0x47, 0x8f, 0x49, 0x93, - 0xc6, 0x22, 0x3e, 0xa3, 0x3c, 0xe3, 0x26, 0x78, 0xbb, 0xdc, 0x03, 0xd0, 0xff, 0xc5, 0x1d, 0x3e, - 0xa8, 0x74, 0xd7, 0xea, 0x03, 0x1c, 0x4e, 0xf7, 0x5b, 0xb7, 0xe9, 0x65, 0xd9, 0xa8, 0xe2, 0x63, - 0x03, 0x44, 0x3b, 0x69, 0x9f, 0xdb, 0x4e, 0x02, 0xd4, 0x58, 0x3d, 0x30, 0x07, 0x1c, 0x1e, 0xe8, - 0xcc, 0x37, 0x5a, 0x67, 0x73, 0xee, 0xb2, 0xd5, 0xc5, 0xa7, 0x3c, 0x80, 0x79, 0x6b, 0xbe, 0xa1, - 0x63, 0xb7, 0xcc, 0x3e, 0x34, 0xbf, 0x26, 0x1f, 0x72, 0xd7, 0x6c, 0xda, 0xe3, 0x4c, 0xce, 0x8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x47, 0xa3, 0x8e, 0xc7, 0xd1, 0xe7, 0xed, - 0x8e, 0xbf, 0x3f, 0x6d, 0xe3, 0x71, 0x26, 0x52, 0x3c, 0xda, 0xfd, 0xff, 0x89, 0xef, 0xfc, 0x2b, - 0xed, 0xef, 0xeb, 0xd9, 0x1e, 0xec, 0x40, 0x49, 0xcd, 0x6d, 0xec, 0xda, 0x47, 0xf9, 0xf4, 0x9a, - 0xf2, 0x1d, 0xf9, 0x66, 0x5e, 0x36, 0xf9, 0x68, 0x14, 0x9f, 0x73, 0xd7, 0x7e, 0x60, 0x5e, 0xf7, - 0x00, 0x7a, 0x8e, 0x9a, 0x02, 0xe3, 0x7c, 0x74, 0x9b, 0xf7, 0x8b, 0x38, 0x4f, 0xae, 0xf4, 0xd4, - 0xef, 0xfa, 0xd5, 0xd3, 0xca, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xa1, 0xac, 0xb6, 0x4e, 0x44, - 0x08, 0x00, 0x00, + // 973 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x7c, 0x55, 0xdd, 0x72, 0xdb, 0x44, + 0x14, 0xae, 0xb5, 0x96, 0x25, 0xad, 0x93, 0x60, 0x76, 0x52, 0xaa, 0x86, 0x00, 0x1d, 0x0f, 0x14, + 0x28, 0xa0, 0x0e, 0x6e, 0xa7, 0xc3, 0x14, 0x6e, 0x48, 0x63, 0xa0, 0x03, 0x29, 0x33, 0x9b, 0x86, + 0x5e, 0x7a, 0xe4, 0x44, 0x31, 0x2a, 0x92, 0x56, 0xb3, 0x5a, 0x91, 0x7a, 0xe0, 0x82, 0x87, 0xe0, + 0x15, 0xe0, 0x11, 0xb8, 0xe4, 0xd9, 0x38, 0x67, 0x57, 0xd2, 0x3a, 0x76, 0x4d, 0x6e, 0xe2, 0xa3, + 0xef, 0x47, 0xab, 0x6f, 0xcf, 0x9e, 0xa5, 0x4c, 0x25, 0x95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 0x92, 0x30, 0x00, 0xa4, 0x07, 0x9a, 0x63, 0x5d, 0x36, 0x76, 0x4a, 0xa6, 0xc5, 0x22, 0xa4, 0x00, + 0x05, 0x68, 0xa7, 0x4b, 0x63, 0x37, 0x5f, 0xc2, 0x7e, 0x85, 0x43, 0x40, 0x76, 0xc0, 0xee, 0x08, + 0xab, 0xf1, 0xdf, 0x0e, 0xf5, 0x78, 0x52, 0x26, 0xb1, 0xaa, 0x30, 0x28, 0xd9, 0x06, 0x45, 0x30, + 0x28, 0xd9, 0x06, 0x25, 0xbb, 0xa0, 0x08, 0x06, 0x25, 0xbb, 0xa0, 0x64, 0x17, 0x14, 0xc1, 0xa0, + 0x64, 0x17, 0x94, 0xb4, 0x41, 0x11, 0x0c, 0x4a, 0xda, 0xa0, 0xa4, 0x0d, 0x8a, 0x60, 0x50, 0xd2, + 0x06, 0x25, 0x6d, 0x50, 0x04, 0x83, 0x92, 0xa7, 0x2b, 0xaa, 0x2e, 0x28, 0x82, 0x41, 0x49, 0x1b, + 0x94, 0xec, 0x82, 0x22, 0x18, 0x94, 0xec, 0x82, 0x92, 0x36, 0x28, 0x82, 0x41, 0x49, 0x1b, 0x94, + 0xb4, 0x41, 0x11, 0x0c, 0x4a, 0xda, 0xa0, 0x64, 0x17, 0x14, 0xc1, 0xa0, 0xa4, 0x09, 0xea, 0x1f, + 0x68, 0xa8, 0x17, 0xe9, 0xc5, 0x22, 0x51, 0xec, 0x1e, 0x75, 0xcf, 0x45, 0x26, 0xa4, 0xee, 0xa7, + 0xbd, 0xc9, 0x7e, 0x64, 0x5a, 0x3e, 0x32, 0x70, 0xf4, 0x04, 0x31, 0x6e, 0x28, 0xec, 0x33, 0xf4, + 0x33, 0x6c, 0x0c, 0x6f, 0x1b, 0x7b, 0x20, 0xf5, 0x7f, 0x76, 0x97, 0x0e, 0x2a, 0xdd, 0xb5, 0x7a, + 0x03, 0x87, 0x93, 0xbd, 0x96, 0x6d, 0x7a, 0x99, 0x37, 0x28, 0x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10, 0x9f, 0xb7, 0xf7, 0x07, 0x07, 0x16, 0x8b, 0x60, 0x05, 0xf3, 0x4c, 0x8f, + 0xf7, 0xe1, 0xe4, 0x70, 0x73, 0x05, 0x7a, 0x4c, 0xfc, 0x84, 0xf1, 0x71, 0x24, 0xc2, 0x29, 0x26, + 0x97, 0x99, 0xd2, 0x43, 0x1f, 0x5b, 0x76, 0x9d, 0xaf, 0x07, 0x4e, 0x43, 0x07, 0x1e, 0xd2, 0xd3, + 0xe6, 0x22, 0x78, 0x1d, 0x5d, 0x37, 0x61, 0x43, 0x07, 0x1e, 0xae, 0xa6, 0x06, 0xfa, 0x60, 0xcb, + 0x6a, 0xce, 0x56, 0xf9, 0x40, 0xd4, 0xf6, 0x30, 0x23, 0xbd, 0xed, 0xf6, 0x0f, 0x26, 0xad, 0x3d, + 0x0c, 0x4f, 0xb4, 0x07, 0xba, 0xff, 0x3f, 0xf6, 0x1d, 0xbf, 0xd6, 0xfc, 0xbe, 0xbe, 0x04, 0x82, + 0x2d, 0x51, 0xe2, 0x29, 0x30, 0x74, 0xcd, 0x43, 0x7f, 0x3c, 0xcf, 0x74, 0x8b, 0xbf, 0x19, 0xac, + 0x8d, 0x3f, 0x10, 0xd9, 0xe7, 0xd4, 0xb5, 0x37, 0xd1, 0xeb, 0x3e, 0x40, 0x0f, 0x5c, 0x23, 0x30, + 0xcc, 0xc7, 0x77, 0x68, 0xbf, 0x88, 0xf3, 0x64, 0xad, 0xf9, 0x7e, 0xd7, 0x67, 0x54, 0x23, 0xff, + 0x05, 0x00, 0x00, 0xff, 0xff, 0x87, 0xe6, 0xa7, 0x10, 0x8b, 0x08, 0x00, 0x00, }
diff --git a/jsonpb/jsonpb_test_proto/test_objects.proto b/jsonpb/jsonpb_test_proto/test_objects.proto index 394c424..4346935 100644 --- a/jsonpb/jsonpb_test_proto/test_objects.proto +++ b/jsonpb/jsonpb_test_proto/test_objects.proto
@@ -32,6 +32,7 @@ syntax = "proto2"; import "google/protobuf/duration.proto"; +import "google/protobuf/struct.proto"; import "google/protobuf/timestamp.proto"; import "google/protobuf/wrappers.proto"; @@ -115,6 +116,7 @@ message KnownTypes { optional google.protobuf.Duration dur = 1; + optional google.protobuf.Struct st = 12; optional google.protobuf.Timestamp ts = 2; optional google.protobuf.DoubleValue dbl = 3;