jsonpb: Accept both camelCase and orig_name as field names for oneof fields.
Fixes #148.
diff --git a/jsonpb/jsonpb.go b/jsonpb/jsonpb.go
index a9e778c..c4094ac 100644
--- a/jsonpb/jsonpb.go
+++ b/jsonpb/jsonpb.go
@@ -517,30 +517,39 @@
return err
}
+ consumeField := func(prop *proto.Properties) (json.RawMessage, bool) {
+ // Be liberal in what names we accept; both orig_name and camelName are okay.
+ fieldNames := acceptedJSONFieldNames(prop)
+
+ vOrig, okOrig := jsonFields[fieldNames.orig]
+ vCamel, okCamel := jsonFields[fieldNames.camel]
+ if !okOrig && !okCamel {
+ return nil, false
+ }
+ // If, for some reason, both are present in the data, favour the camelName.
+ var raw json.RawMessage
+ if okOrig {
+ raw = vOrig
+ delete(jsonFields, fieldNames.orig)
+ }
+ if okCamel {
+ raw = vCamel
+ delete(jsonFields, fieldNames.camel)
+ }
+ return raw, true
+ }
+
sprops := proto.GetProperties(targetType)
for i := 0; i < target.NumField(); i++ {
ft := target.Type().Field(i)
if strings.HasPrefix(ft.Name, "XXX_") {
continue
}
- // Be liberal in what names we accept; both orig_name and camelName are okay.
- fieldNames := acceptedJSONFieldNames(ft)
- vOrig, okOrig := jsonFields[fieldNames.orig]
- vCamel, okCamel := jsonFields[fieldNames.camel]
- if !okOrig && !okCamel {
+ valueForField, ok := consumeField(sprops.Prop[i])
+ if !ok {
continue
}
- // If, for some reason, both are present in the data, favour the camelName.
- var valueForField json.RawMessage
- if okOrig {
- valueForField = vOrig
- delete(jsonFields, fieldNames.orig)
- }
- if okCamel {
- valueForField = vCamel
- delete(jsonFields, fieldNames.camel)
- }
// Handle enums, which have an underlying type of int32,
// and may appear as strings. We do this while handling
@@ -570,14 +579,17 @@
}
}
// Check for any oneof fields.
- for fname, raw := range jsonFields {
- if oop, ok := sprops.OneofTypes[fname]; ok {
+ if len(jsonFields) > 0 {
+ for _, oop := range sprops.OneofTypes {
+ raw, ok := consumeField(oop.Prop)
+ if !ok {
+ continue
+ }
nv := reflect.New(oop.Type.Elem())
target.Field(oop.Field).Set(nv)
if err := unmarshalValue(nv.Elem().Field(0), raw); err != nil {
return err
}
- delete(jsonFields, fname)
}
}
if len(jsonFields) > 0 {
@@ -663,9 +675,7 @@
orig, camel string
}
-func acceptedJSONFieldNames(f reflect.StructField) fieldNames {
- var prop proto.Properties
- prop.Init(f.Type, f.Name, f.Tag.Get("protobuf"), &f)
+func acceptedJSONFieldNames(prop *proto.Properties) fieldNames {
opts := fieldNames{orig: prop.OrigName, camel: prop.OrigName}
if prop.JSONName != "" {
opts.camel = prop.JSONName
diff --git a/jsonpb/jsonpb_test.go b/jsonpb/jsonpb_test.go
index c04da85..a8f9572 100644
--- a/jsonpb/jsonpb_test.go
+++ b/jsonpb/jsonpb_test.go
@@ -379,6 +379,8 @@
{"map<string, string>", `{"strry":{"\"one\"":"two","three":"four"}}`, &pb.Mappy{Strry: map[string]string{`"one"`: "two", "three": "four"}}},
{"map<int32, Object>", `{"objjy":{"1":{"dub":1}}}`, &pb.Mappy{Objjy: map[int32]*pb.Simple3{1: &pb.Simple3{Dub: 1}}}},
{"oneof", `{"salary":31000}`, &pb.MsgWithOneof{Union: &pb.MsgWithOneof_Salary{31000}}},
+ {"oneof spec name", `{"country":"Australia"}`, &pb.MsgWithOneof{Union: &pb.MsgWithOneof_Country{"Australia"}}},
+ {"oneof orig_name", `{"Country":"Australia"}`, &pb.MsgWithOneof{Union: &pb.MsgWithOneof_Country{"Australia"}}},
{"orig_name input", `{"o_bool":true}`, &pb.Simple{OBool: proto.Bool(true)}},
{"camelName input", `{"oBool":true}`, &pb.Simple{OBool: proto.Bool(true)}},
diff --git a/jsonpb/jsonpb_test_proto/test_objects.pb.go b/jsonpb/jsonpb_test_proto/test_objects.pb.go
index a1263fb..4672283 100644
--- a/jsonpb/jsonpb_test_proto/test_objects.pb.go
+++ b/jsonpb/jsonpb_test_proto/test_objects.pb.go
@@ -337,6 +337,7 @@
// Types that are valid to be assigned to Union:
// *MsgWithOneof_Title
// *MsgWithOneof_Salary
+ // *MsgWithOneof_Country
Union isMsgWithOneof_Union `protobuf_oneof:"union"`
XXX_unrecognized []byte `json:"-"`
}
@@ -356,9 +357,13 @@
type MsgWithOneof_Salary struct {
Salary int64 `protobuf:"varint,2,opt,name=salary,oneof"`
}
+type MsgWithOneof_Country struct {
+ Country string `protobuf:"bytes,3,opt,name=Country,json=country,oneof"`
+}
-func (*MsgWithOneof_Title) isMsgWithOneof_Union() {}
-func (*MsgWithOneof_Salary) isMsgWithOneof_Union() {}
+func (*MsgWithOneof_Title) isMsgWithOneof_Union() {}
+func (*MsgWithOneof_Salary) isMsgWithOneof_Union() {}
+func (*MsgWithOneof_Country) isMsgWithOneof_Union() {}
func (m *MsgWithOneof) GetUnion() isMsgWithOneof_Union {
if m != nil {
@@ -381,11 +386,19 @@
return 0
}
+func (m *MsgWithOneof) GetCountry() string {
+ if x, ok := m.GetUnion().(*MsgWithOneof_Country); ok {
+ return x.Country
+ }
+ return ""
+}
+
// XXX_OneofFuncs is for the internal use of the proto package.
func (*MsgWithOneof) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
return _MsgWithOneof_OneofMarshaler, _MsgWithOneof_OneofUnmarshaler, _MsgWithOneof_OneofSizer, []interface{}{
(*MsgWithOneof_Title)(nil),
(*MsgWithOneof_Salary)(nil),
+ (*MsgWithOneof_Country)(nil),
}
}
@@ -399,6 +412,9 @@
case *MsgWithOneof_Salary:
b.EncodeVarint(2<<3 | proto.WireVarint)
b.EncodeVarint(uint64(x.Salary))
+ case *MsgWithOneof_Country:
+ b.EncodeVarint(3<<3 | proto.WireBytes)
+ b.EncodeStringBytes(x.Country)
case nil:
default:
return fmt.Errorf("MsgWithOneof.Union has unexpected type %T", x)
@@ -423,6 +439,13 @@
x, err := b.DecodeVarint()
m.Union = &MsgWithOneof_Salary{int64(x)}
return true, err
+ case 3: // union.Country
+ if wire != proto.WireBytes {
+ return true, proto.ErrInternalBadWireType
+ }
+ x, err := b.DecodeStringBytes()
+ m.Union = &MsgWithOneof_Country{x}
+ return true, err
default:
return false, nil
}
@@ -439,6 +462,10 @@
case *MsgWithOneof_Salary:
n += proto.SizeVarint(2<<3 | proto.WireVarint)
n += proto.SizeVarint(uint64(x.Salary))
+ case *MsgWithOneof_Country:
+ n += proto.SizeVarint(3<<3 | proto.WireBytes)
+ n += proto.SizeVarint(uint64(len(x.Country)))
+ n += len(x.Country)
case nil:
default:
panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
@@ -646,66 +673,67 @@
}
var fileDescriptor1 = []byte{
- // 973 bytes of a gzipped FileDescriptorProto
+ // 988 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, 0x9a, 0x89, 0xf9, 0xcb, 0xe4, 0x5c,
- 0x55, 0x51, 0x29, 0x85, 0x12, 0x6c, 0xf0, 0xb2, 0x12, 0x45, 0x39, 0x3f, 0x78, 0x77, 0x21, 0xc4,
- 0x22, 0x4b, 0xee, 0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ea, 0x55, 0x1b, 0xa0, 0x61, 0x6c, 0x13, 0x2c, 0xf3,
+ 0xf1, 0x1d, 0xde, 0xce, 0xa2, 0x65, 0xbc, 0xd6, 0x7c, 0x7f, 0xd0, 0xfd, 0x25, 0xe4, 0xff, 0x00,
+ 0x00, 0x00, 0xff, 0xff, 0x39, 0x6b, 0x15, 0x0e, 0xa7, 0x08, 0x00, 0x00,
}
diff --git a/jsonpb/jsonpb_test_proto/test_objects.proto b/jsonpb/jsonpb_test_proto/test_objects.proto
index 4346935..ea4a048 100644
--- a/jsonpb/jsonpb_test_proto/test_objects.proto
+++ b/jsonpb/jsonpb_test_proto/test_objects.proto
@@ -94,6 +94,7 @@
oneof union {
string title = 1;
int64 salary = 2;
+ string Country = 3;
}
}