gRPC migration
Change-Id: Ib390f6dde0d5a8d6db12ccd7da41135570ad1354
diff --git a/vendor/google.golang.org/protobuf/reflect/protodesc/proto.go b/vendor/google.golang.org/protobuf/reflect/protodesc/proto.go
index 00d35e0..a7c5cef 100644
--- a/vendor/google.golang.org/protobuf/reflect/protodesc/proto.go
+++ b/vendor/google.golang.org/protobuf/reflect/protodesc/proto.go
@@ -9,6 +9,7 @@
"strings"
"google.golang.org/protobuf/internal/encoding/defval"
+ "google.golang.org/protobuf/internal/strs"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/reflect/protoreflect"
@@ -20,9 +21,11 @@
func ToFileDescriptorProto(file protoreflect.FileDescriptor) *descriptorpb.FileDescriptorProto {
p := &descriptorpb.FileDescriptorProto{
Name: proto.String(file.Path()),
- Package: proto.String(string(file.Package())),
Options: proto.Clone(file.Options()).(*descriptorpb.FileOptions),
}
+ if file.Package() != "" {
+ p.Package = proto.String(string(file.Package()))
+ }
for i, imports := 0, file.Imports(); i < imports.Len(); i++ {
imp := imports.Get(i)
p.Dependency = append(p.Dependency, imp.Path())
@@ -138,7 +141,14 @@
p.TypeName = fullNameOf(field.Message())
}
if field.HasJSONName() {
- p.JsonName = proto.String(field.JSONName())
+ // A bug in older versions of protoc would always populate the
+ // "json_name" option for extensions when it is meaningless.
+ // When it did so, it would always use the camel-cased field name.
+ if field.IsExtension() {
+ p.JsonName = proto.String(strs.JSONCamelCase(string(field.Name())))
+ } else {
+ p.JsonName = proto.String(field.JSONName())
+ }
}
if field.Syntax() == protoreflect.Proto3 && field.HasOptionalKeyword() {
p.Proto3Optional = proto.Bool(true)