From 06e5c080c18291d5fc9635173444047681937b9e Mon Sep 17 00:00:00 2001 From: Joshua Humphries <2035234+jhump@users.noreply.github.com> Date: Wed, 4 Sep 2024 15:26:01 -0400 Subject: [PATCH] Update desc/sourceinfo to not wrap descriptors (#622) The `desc/sourceinfo` package previously wrapped descriptors, by returning an implementation of the various `protoreflect.Descriptor` interfaces that _embedded_ the original descriptor values. However, these various interfaces are all defined as "[do not implement](https://github.com/protocolbuffers/protobuf-go/blob/c33baa8f3a0d35fd5a39e43c22a50a050f707d34/reflect/protoreflect/type.go#L111)". So, to avoid future issues where the protobuf runtime may type-assert implementations to their own internal types (which would panic/fail with the concrete wrapper types in this package), we no longer wrap this way. This also happens to resolve #618 (since there's no more wrapping, an incorrect typed-nil wrapper can't escape). --- desc/descriptor_test.go | 18 +- desc/imports.go | 36 - desc/load.go | 7 +- .../testfiles/desc_test1-compact.proto | 7 + .../testfiles/desc_test1-custom-sort.proto | 9 + .../testfiles/desc_test1-default.proto | 9 + .../desc_test1-multiline-style-comments.proto | 9 + .../desc_test1-no-trailing-comments.proto | 9 + .../desc_test1-only-doc-comments.proto | 9 + ...-sorted-AND-multiline-style-comments.proto | 9 + .../testfiles/desc_test1-sorted.proto | 9 + .../desc_test1-trailing-on-next-line.proto | 9 + desc/sourceinfo/export_test.go | 17 + desc/sourceinfo/registry.go | 171 +++-- desc/sourceinfo/registry_test.go | 35 + desc/sourceinfo/update.go | 314 +++++++++ desc/sourceinfo/update_test.go | 138 ++++ desc/sourceinfo/wrappers.go | 636 ------------------ internal/testprotos/desc_test1.pb.go | 55 +- internal/testprotos/desc_test1.pb.srcinfo.go | 219 +++--- internal/testprotos/desc_test1.proto | 8 + internal/testprotos/desc_test1.protoset | Bin 6764 -> 7133 bytes 22 files changed, 879 insertions(+), 854 deletions(-) create mode 100644 desc/sourceinfo/export_test.go create mode 100644 desc/sourceinfo/update.go create mode 100644 desc/sourceinfo/update_test.go delete mode 100644 desc/sourceinfo/wrappers.go diff --git a/desc/descriptor_test.go b/desc/descriptor_test.go index 09c281ed..8704b733 100644 --- a/desc/descriptor_test.go +++ b/desc/descriptor_test.go @@ -472,8 +472,22 @@ func TestFileDescriptorObjectGraph(t *testing.T) { }, }, }}, - "enums": {(*FileDescriptor).GetEnumTypes, nil}, - "services": {(*FileDescriptor).GetServices, nil}, + "enums": {(*FileDescriptor).GetEnumTypes, nil}, + "services": {(*FileDescriptor).GetServices, []descCase{ + { + name: "testprotos.SomeService", + references: map[string]childCases{ + "methods": {(*ServiceDescriptor).GetMethods, []descCase{ + { + name: "testprotos.SomeService.SomeRPC", + }, + { + name: "testprotos.SomeService.SomeOtherRPC", + }, + }}, + }, + }, + }}, "extensions": {(*FileDescriptor).GetExtensions, []descCase{ { name: "testprotos.xtm", diff --git a/desc/imports.go b/desc/imports.go index 8e6a0d6e..dc6b7358 100644 --- a/desc/imports.go +++ b/desc/imports.go @@ -34,10 +34,6 @@ var ( // package or when the alternate path is only used from one file (so you don't // want the alternate path used when loading every other file), use an // ImportResolver instead. -// -// Deprecated: the new protobuf runtime (v1.4+) verifies that import paths are -// correct and that descriptors can be linked during package initialization. So -// registering alternate paths is no longer useful or necessary. func RegisterImportPath(registerPath, importPath string) { if len(importPath) == 0 { panic("import path cannot be empty") @@ -60,10 +56,6 @@ func RegisterImportPath(registerPath, importPath string) { // ResolveImport resolves the given import path. If it has been registered as an // alternate via RegisterImportPath, the registered path is returned. Otherwise, // the given import path is returned unchanged. -// -// Deprecated: the new protobuf runtime (v1.4+) verifies that import paths are -// correct and that descriptors can be linked during package initialization. So -// registering alternate paths is no longer useful or necessary. func ResolveImport(importPath string) string { importPath = clean(importPath) globalImportPathMu.RLock() @@ -244,10 +236,6 @@ func (r *ImportResolver) registerImportPathFrom(registerPath, importPath, source // LoadFileDescriptor is the same as the package function of the same name, but // any alternate paths configured in this resolver are used when linking the // given descriptor proto. -// -// Deprecated: the new protobuf runtime (v1.4+) verifies that import paths are -// correct and that descriptors can be linked during package initialization. So -// registering alternate paths is no longer useful or necessary. func (r *ImportResolver) LoadFileDescriptor(filePath string) (*FileDescriptor, error) { return LoadFileDescriptor(filePath) } @@ -255,10 +243,6 @@ func (r *ImportResolver) LoadFileDescriptor(filePath string) (*FileDescriptor, e // LoadMessageDescriptor is the same as the package function of the same name, // but any alternate paths configured in this resolver are used when linking // files for the returned descriptor. -// -// Deprecated: the new protobuf runtime (v1.4+) verifies that import paths are -// correct and that descriptors can be linked during package initialization. So -// registering alternate paths is no longer useful or necessary. func (r *ImportResolver) LoadMessageDescriptor(msgName string) (*MessageDescriptor, error) { return LoadMessageDescriptor(msgName) } @@ -266,10 +250,6 @@ func (r *ImportResolver) LoadMessageDescriptor(msgName string) (*MessageDescript // LoadMessageDescriptorForMessage is the same as the package function of the // same name, but any alternate paths configured in this resolver are used when // linking files for the returned descriptor. -// -// Deprecated: the new protobuf runtime (v1.4+) verifies that import paths are -// correct and that descriptors can be linked during package initialization. So -// registering alternate paths is no longer useful or necessary. func (r *ImportResolver) LoadMessageDescriptorForMessage(msg proto.Message) (*MessageDescriptor, error) { return LoadMessageDescriptorForMessage(msg) } @@ -277,10 +257,6 @@ func (r *ImportResolver) LoadMessageDescriptorForMessage(msg proto.Message) (*Me // LoadMessageDescriptorForType is the same as the package function of the same // name, but any alternate paths configured in this resolver are used when // linking files for the returned descriptor. -// -// Deprecated: the new protobuf runtime (v1.4+) verifies that import paths are -// correct and that descriptors can be linked during package initialization. So -// registering alternate paths is no longer useful or necessary. func (r *ImportResolver) LoadMessageDescriptorForType(msgType reflect.Type) (*MessageDescriptor, error) { return LoadMessageDescriptorForType(msgType) } @@ -288,10 +264,6 @@ func (r *ImportResolver) LoadMessageDescriptorForType(msgType reflect.Type) (*Me // LoadEnumDescriptorForEnum is the same as the package function of the same // name, but any alternate paths configured in this resolver are used when // linking files for the returned descriptor. -// -// Deprecated: the new protobuf runtime (v1.4+) verifies that import paths are -// correct and that descriptors can be linked during package initialization. So -// registering alternate paths is no longer useful or necessary. func (r *ImportResolver) LoadEnumDescriptorForEnum(enum protoEnum) (*EnumDescriptor, error) { return LoadEnumDescriptorForEnum(enum) } @@ -299,10 +271,6 @@ func (r *ImportResolver) LoadEnumDescriptorForEnum(enum protoEnum) (*EnumDescrip // LoadEnumDescriptorForType is the same as the package function of the same // name, but any alternate paths configured in this resolver are used when // linking files for the returned descriptor. -// -// Deprecated: the new protobuf runtime (v1.4+) verifies that import paths are -// correct and that descriptors can be linked during package initialization. So -// registering alternate paths is no longer useful or necessary. func (r *ImportResolver) LoadEnumDescriptorForType(enumType reflect.Type) (*EnumDescriptor, error) { return LoadEnumDescriptorForType(enumType) } @@ -310,10 +278,6 @@ func (r *ImportResolver) LoadEnumDescriptorForType(enumType reflect.Type) (*Enum // LoadFieldDescriptorForExtension is the same as the package function of the // same name, but any alternate paths configured in this resolver are used when // linking files for the returned descriptor. -// -// Deprecated: the new protobuf runtime (v1.4+) verifies that import paths are -// correct and that descriptors can be linked during package initialization. So -// registering alternate paths is no longer useful or necessary. func (r *ImportResolver) LoadFieldDescriptorForExtension(ext *proto.ExtensionDesc) (*FieldDescriptor, error) { return LoadFieldDescriptorForExtension(ext) } diff --git a/desc/load.go b/desc/load.go index 8776ab0b..8fd09ac1 100644 --- a/desc/load.go +++ b/desc/load.go @@ -1,6 +1,7 @@ package desc import ( + "errors" "fmt" "reflect" "sync" @@ -33,7 +34,7 @@ var ( // re-processed if the same file is fetched again later. func LoadFileDescriptor(file string) (*FileDescriptor, error) { d, err := sourceinfo.GlobalFiles.FindFileByPath(file) - if err == protoregistry.NotFound { + if errors.Is(err, protoregistry.NotFound) { // for backwards compatibility, see if this matches a known old // alias for the file (older versions of libraries that registered // the files using incorrect/non-canonical paths) @@ -42,7 +43,7 @@ func LoadFileDescriptor(file string) (*FileDescriptor, error) { } } if err != nil { - if err != protoregistry.NotFound { + if !errors.Is(err, protoregistry.NotFound) { return nil, internal.ErrNoSuchFile(file) } return nil, err @@ -64,7 +65,7 @@ func LoadFileDescriptor(file string) (*FileDescriptor, error) { func LoadMessageDescriptor(message string) (*MessageDescriptor, error) { mt, err := sourceinfo.GlobalTypes.FindMessageByName(protoreflect.FullName(message)) if err != nil { - if err == protoregistry.NotFound { + if errors.Is(err, protoregistry.NotFound) { return nil, nil } return nil, err diff --git a/desc/protoprint/testfiles/desc_test1-compact.proto b/desc/protoprint/testfiles/desc_test1-compact.proto index 97518501..c5f26d6c 100644 --- a/desc/protoprint/testfiles/desc_test1-compact.proto +++ b/desc/protoprint/testfiles/desc_test1-compact.proto @@ -107,3 +107,10 @@ extend AnotherTestMessage { // Comment for xui optional uint64 xui = 103; } +// Comment for SomeService +service SomeService { + // Comment for SomeRPC + rpc SomeRPC ( TestMessage ) returns ( TestMessage ); + // Comment for SomeOtherRPC + rpc SomeOtherRPC ( AnotherTestMessage ) returns ( AnotherTestMessage ); +} diff --git a/desc/protoprint/testfiles/desc_test1-custom-sort.proto b/desc/protoprint/testfiles/desc_test1-custom-sort.proto index 518282da..8d655e17 100644 --- a/desc/protoprint/testfiles/desc_test1-custom-sort.proto +++ b/desc/protoprint/testfiles/desc_test1-custom-sort.proto @@ -18,6 +18,15 @@ extend AnotherTestMessage { optional string xs = 101; } +// Comment for SomeService +service SomeService { + // Comment for SomeRPC + rpc SomeRPC ( TestMessage ) returns ( TestMessage ); + + // Comment for SomeOtherRPC + rpc SomeOtherRPC ( AnotherTestMessage ) returns ( AnotherTestMessage ); +} + // Comment for TestMessage message TestMessage { // Comment for NestedEnum diff --git a/desc/protoprint/testfiles/desc_test1-default.proto b/desc/protoprint/testfiles/desc_test1-default.proto index 08476be2..d5f98cb6 100644 --- a/desc/protoprint/testfiles/desc_test1-default.proto +++ b/desc/protoprint/testfiles/desc_test1-default.proto @@ -144,3 +144,12 @@ extend AnotherTestMessage { // Comment for xui optional uint64 xui = 103; } + +// Comment for SomeService +service SomeService { + // Comment for SomeRPC + rpc SomeRPC ( TestMessage ) returns ( TestMessage ); + + // Comment for SomeOtherRPC + rpc SomeOtherRPC ( AnotherTestMessage ) returns ( AnotherTestMessage ); +} diff --git a/desc/protoprint/testfiles/desc_test1-multiline-style-comments.proto b/desc/protoprint/testfiles/desc_test1-multiline-style-comments.proto index e9dc6090..bf4efeb1 100644 --- a/desc/protoprint/testfiles/desc_test1-multiline-style-comments.proto +++ b/desc/protoprint/testfiles/desc_test1-multiline-style-comments.proto @@ -144,3 +144,12 @@ extend AnotherTestMessage { /* Comment for xui */ optional uint64 xui = 103; } + +/* Comment for SomeService */ +service SomeService { + /* Comment for SomeRPC */ + rpc SomeRPC ( TestMessage ) returns ( TestMessage ); + + /* Comment for SomeOtherRPC */ + rpc SomeOtherRPC ( AnotherTestMessage ) returns ( AnotherTestMessage ); +} diff --git a/desc/protoprint/testfiles/desc_test1-no-trailing-comments.proto b/desc/protoprint/testfiles/desc_test1-no-trailing-comments.proto index 08476be2..d5f98cb6 100644 --- a/desc/protoprint/testfiles/desc_test1-no-trailing-comments.proto +++ b/desc/protoprint/testfiles/desc_test1-no-trailing-comments.proto @@ -144,3 +144,12 @@ extend AnotherTestMessage { // Comment for xui optional uint64 xui = 103; } + +// Comment for SomeService +service SomeService { + // Comment for SomeRPC + rpc SomeRPC ( TestMessage ) returns ( TestMessage ); + + // Comment for SomeOtherRPC + rpc SomeOtherRPC ( AnotherTestMessage ) returns ( AnotherTestMessage ); +} diff --git a/desc/protoprint/testfiles/desc_test1-only-doc-comments.proto b/desc/protoprint/testfiles/desc_test1-only-doc-comments.proto index 08476be2..d5f98cb6 100644 --- a/desc/protoprint/testfiles/desc_test1-only-doc-comments.proto +++ b/desc/protoprint/testfiles/desc_test1-only-doc-comments.proto @@ -144,3 +144,12 @@ extend AnotherTestMessage { // Comment for xui optional uint64 xui = 103; } + +// Comment for SomeService +service SomeService { + // Comment for SomeRPC + rpc SomeRPC ( TestMessage ) returns ( TestMessage ); + + // Comment for SomeOtherRPC + rpc SomeOtherRPC ( AnotherTestMessage ) returns ( AnotherTestMessage ); +} diff --git a/desc/protoprint/testfiles/desc_test1-sorted-AND-multiline-style-comments.proto b/desc/protoprint/testfiles/desc_test1-sorted-AND-multiline-style-comments.proto index 7cbae792..0312ea15 100644 --- a/desc/protoprint/testfiles/desc_test1-sorted-AND-multiline-style-comments.proto +++ b/desc/protoprint/testfiles/desc_test1-sorted-AND-multiline-style-comments.proto @@ -127,6 +127,15 @@ message TestMessage { } } +/* Comment for SomeService */ +service SomeService { + /* Comment for SomeOtherRPC */ + rpc SomeOtherRPC ( AnotherTestMessage ) returns ( AnotherTestMessage ); + + /* Comment for SomeRPC */ + rpc SomeRPC ( TestMessage ) returns ( TestMessage ); +} + /* Comment for AnotherTestMessage extensions (2) */ extend AnotherTestMessage { /* Comment for xtm */ diff --git a/desc/protoprint/testfiles/desc_test1-sorted.proto b/desc/protoprint/testfiles/desc_test1-sorted.proto index 04a4b35e..22332954 100644 --- a/desc/protoprint/testfiles/desc_test1-sorted.proto +++ b/desc/protoprint/testfiles/desc_test1-sorted.proto @@ -127,6 +127,15 @@ message TestMessage { } } +// Comment for SomeService +service SomeService { + // Comment for SomeOtherRPC + rpc SomeOtherRPC ( AnotherTestMessage ) returns ( AnotherTestMessage ); + + // Comment for SomeRPC + rpc SomeRPC ( TestMessage ) returns ( TestMessage ); +} + // Comment for AnotherTestMessage extensions (2) extend AnotherTestMessage { // Comment for xtm diff --git a/desc/protoprint/testfiles/desc_test1-trailing-on-next-line.proto b/desc/protoprint/testfiles/desc_test1-trailing-on-next-line.proto index 08476be2..d5f98cb6 100644 --- a/desc/protoprint/testfiles/desc_test1-trailing-on-next-line.proto +++ b/desc/protoprint/testfiles/desc_test1-trailing-on-next-line.proto @@ -144,3 +144,12 @@ extend AnotherTestMessage { // Comment for xui optional uint64 xui = 103; } + +// Comment for SomeService +service SomeService { + // Comment for SomeRPC + rpc SomeRPC ( TestMessage ) returns ( TestMessage ); + + // Comment for SomeOtherRPC + rpc SomeOtherRPC ( AnotherTestMessage ) returns ( AnotherTestMessage ); +} diff --git a/desc/sourceinfo/export_test.go b/desc/sourceinfo/export_test.go new file mode 100644 index 00000000..e15be967 --- /dev/null +++ b/desc/sourceinfo/export_test.go @@ -0,0 +1,17 @@ +package sourceinfo + +import "google.golang.org/protobuf/reflect/protoreflect" + +// exported for tests + +func CanUpgrade(d protoreflect.Descriptor) bool { + return canUpgrade(d) +} + +func UpdateDescriptor[D protoreflect.Descriptor](d D) (D, error) { + return updateDescriptor(d) +} + +func UpdateField(fld protoreflect.FieldDescriptor) (protoreflect.FieldDescriptor, error) { + return updateField(fld) +} diff --git a/desc/sourceinfo/registry.go b/desc/sourceinfo/registry.go index c450cbf6..8301c402 100644 --- a/desc/sourceinfo/registry.go +++ b/desc/sourceinfo/registry.go @@ -30,11 +30,12 @@ package sourceinfo import ( "bytes" "compress/gzip" + "errors" "fmt" - "github.com/golang/protobuf/proto" - "io/ioutil" + "io" "sync" + "google.golang.org/protobuf/proto" "google.golang.org/protobuf/reflect/protodesc" "google.golang.org/protobuf/reflect/protoreflect" "google.golang.org/protobuf/reflect/protoregistry" @@ -56,9 +57,10 @@ var ( // can include source code info in the returned descriptors. GlobalTypes TypeResolver = registry{} - mu sync.RWMutex - sourceInfoByFile = map[string]*descriptorpb.SourceCodeInfo{} - fileDescriptors = map[protoreflect.FileDescriptor]protoreflect.FileDescriptor{} + mu sync.RWMutex + sourceInfoByFile = map[string]*descriptorpb.SourceCodeInfo{} + fileDescriptors = map[protoreflect.FileDescriptor]protoreflect.FileDescriptor{} + updatedDescriptors filesWithFallback ) // Resolver can resolve file names into file descriptors and also provides methods for @@ -108,7 +110,7 @@ func RegisterEncodedSourceInfo(file string, data []byte) error { defer func() { _ = zipReader.Close() }() - unzipped, err := ioutil.ReadAll(zipReader) + unzipped, err := io.ReadAll(zipReader) if err != nil { return err } @@ -129,14 +131,25 @@ func SourceInfoForFile(file string) *descriptorpb.SourceCodeInfo { return sourceInfoByFile[file] } -func canWrap(d protoreflect.Descriptor) bool { - srcInfo := SourceInfoForFile(d.ParentFile().Path()) - return len(srcInfo.GetLocation()) > 0 +func canUpgrade(d protoreflect.Descriptor) bool { + if d == nil { + return false + } + fd := d.ParentFile() + if fd.SourceLocations().Len() > 0 { + // already has source info + return false + } + if genFile, err := protoregistry.GlobalFiles.FindFileByPath(fd.Path()); err != nil || genFile != fd { + // given descriptor is not from generated code + return false + } + return true } -func getFile(fd protoreflect.FileDescriptor) protoreflect.FileDescriptor { - if fd == nil { - return nil +func getFile(fd protoreflect.FileDescriptor) (protoreflect.FileDescriptor, error) { + if !canUpgrade(fd) { + return fd, nil } mu.RLock() @@ -144,31 +157,66 @@ func getFile(fd protoreflect.FileDescriptor) protoreflect.FileDescriptor { mu.RUnlock() if result != nil { - return result + return result, nil } mu.Lock() defer mu.Unlock() - // double-check, in case it was added to map while upgrading lock - result = fileDescriptors[fd] + result, err := getFileLocked(fd) + if err != nil { + return nil, fmt.Errorf("updating file %q: %w", fd.Path(), err) + } + return result, nil +} + +func getFileLocked(fd protoreflect.FileDescriptor) (protoreflect.FileDescriptor, error) { + result := fileDescriptors[fd] if result != nil { - return result + return result, nil } - srcInfo := sourceInfoByFile[fd.Path()] - if len(srcInfo.GetLocation()) > 0 { - result = &fileDescriptor{ - FileDescriptor: fd, - locs: &sourceLocations{ - orig: srcInfo.Location, - }, + // We have to build its dependencies, too, so that the descriptor's + // references *all* have source code info. + var deps []protoreflect.FileDescriptor + imps := fd.Imports() + for i, length := 0, imps.Len(); i < length; i++ { + origDep := imps.Get(i).FileDescriptor + updatedDep, err := getFileLocked(origDep) + if err != nil { + return nil, fmt.Errorf("updating import %q: %w", origDep.Path(), err) } - } else { - // nothing to do; don't bother wrapping - result = fd + if updatedDep != origDep && deps == nil { + // lazily init slice of deps and copy over deps before this one + deps = make([]protoreflect.FileDescriptor, i, length) + for j := 0; j < i; j++ { + deps[j] = imps.Get(i).FileDescriptor + } + } + if deps != nil { + deps = append(deps, updatedDep) + } + } + + srcInfo := sourceInfoByFile[fd.Path()] + if len(srcInfo.GetLocation()) == 0 && len(deps) == 0 { + // nothing to do; don't bother changing + return fd, nil } + + // Add source code info and rebuild. + fdProto := protodesc.ToFileDescriptorProto(fd) + fdProto.SourceCodeInfo = srcInfo + + result, err := protodesc.NewFile(fdProto, &updatedDescriptors) + if err != nil { + return nil, err + } + if err := updatedDescriptors.RegisterFile(result); err != nil { + return nil, fmt.Errorf("registering import %q: %w", result.Path(), err) + } + fileDescriptors[fd] = result - return result + return result, nil } type registry struct{} @@ -180,7 +228,7 @@ func (r registry) FindFileByPath(path string) (protoreflect.FileDescriptor, erro if err != nil { return nil, err } - return getFile(fd), nil + return getFile(fd) } func (r registry) FindDescriptorByName(name protoreflect.FullName) (protoreflect.Descriptor, error) { @@ -188,28 +236,26 @@ func (r registry) FindDescriptorByName(name protoreflect.FullName) (protoreflect if err != nil { return nil, err } - if !canWrap(d) { + if !canUpgrade(d) { return d, nil } switch d := d.(type) { case protoreflect.FileDescriptor: - return getFile(d), nil + return getFile(d) case protoreflect.MessageDescriptor: - return messageDescriptor{d}, nil - case protoreflect.ExtensionTypeDescriptor: - return extensionDescriptor{d}, nil + return updateDescriptor(d) case protoreflect.FieldDescriptor: - return fieldDescriptor{d}, nil + return updateField(d) case protoreflect.OneofDescriptor: - return oneOfDescriptor{d}, nil + return updateDescriptor(d) case protoreflect.EnumDescriptor: - return enumDescriptor{d}, nil + return updateDescriptor(d) case protoreflect.EnumValueDescriptor: - return enumValueDescriptor{d}, nil + return updateDescriptor(d) case protoreflect.ServiceDescriptor: - return serviceDescriptor{d}, nil + return updateDescriptor(d) case protoreflect.MethodDescriptor: - return methodDescriptor{d}, nil + return updateDescriptor(d) default: return nil, fmt.Errorf("unrecognized descriptor type: %T", d) } @@ -220,10 +266,11 @@ func (r registry) FindMessageByName(message protoreflect.FullName) (protoreflect if err != nil { return nil, err } - if !canWrap(mt.Descriptor()) { + msg, err := updateDescriptor(mt.Descriptor()) + if err != nil { return mt, nil } - return messageType{mt}, nil + return messageType{MessageType: mt, msgDesc: msg}, nil } func (r registry) FindMessageByURL(url string) (protoreflect.MessageType, error) { @@ -231,10 +278,11 @@ func (r registry) FindMessageByURL(url string) (protoreflect.MessageType, error) if err != nil { return nil, err } - if !canWrap(mt.Descriptor()) { + msg, err := updateDescriptor(mt.Descriptor()) + if err != nil { return mt, nil } - return messageType{mt}, nil + return messageType{MessageType: mt, msgDesc: msg}, nil } func (r registry) FindExtensionByName(field protoreflect.FullName) (protoreflect.ExtensionType, error) { @@ -242,10 +290,11 @@ func (r registry) FindExtensionByName(field protoreflect.FullName) (protoreflect if err != nil { return nil, err } - if !canWrap(xt.TypeDescriptor()) { + ext, err := updateDescriptor(xt.TypeDescriptor().Descriptor()) + if err != nil { return xt, nil } - return extensionType{xt}, nil + return extensionType{ExtensionType: xt, extDesc: ext}, nil } func (r registry) FindExtensionByNumber(message protoreflect.FullName, field protoreflect.FieldNumber) (protoreflect.ExtensionType, error) { @@ -253,17 +302,39 @@ func (r registry) FindExtensionByNumber(message protoreflect.FullName, field pro if err != nil { return nil, err } - if !canWrap(xt.TypeDescriptor()) { + ext, err := updateDescriptor(xt.TypeDescriptor().Descriptor()) + if err != nil { return xt, nil } - return extensionType{xt}, nil + return extensionType{ExtensionType: xt, extDesc: ext}, nil } func (r registry) RangeExtensionsByMessage(message protoreflect.FullName, fn func(protoreflect.ExtensionType) bool) { protoregistry.GlobalTypes.RangeExtensionsByMessage(message, func(xt protoreflect.ExtensionType) bool { - if canWrap(xt.TypeDescriptor()) { - xt = extensionType{xt} + ext, err := updateDescriptor(xt.TypeDescriptor().Descriptor()) + if err != nil { + return fn(xt) } - return fn(xt) + return fn(extensionType{ExtensionType: xt, extDesc: ext}) }) } + +type filesWithFallback struct { + protoregistry.Files +} + +func (f *filesWithFallback) FindFileByPath(path string) (protoreflect.FileDescriptor, error) { + fd, err := f.Files.FindFileByPath(path) + if errors.Is(err, protoregistry.NotFound) { + fd, err = protoregistry.GlobalFiles.FindFileByPath(path) + } + return fd, err +} + +func (f *filesWithFallback) FindDescriptorByName(name protoreflect.FullName) (protoreflect.Descriptor, error) { + fd, err := f.Files.FindDescriptorByName(name) + if errors.Is(err, protoregistry.NotFound) { + fd, err = protoregistry.GlobalFiles.FindDescriptorByName(name) + } + return fd, err +} diff --git a/desc/sourceinfo/registry_test.go b/desc/sourceinfo/registry_test.go index 5ee1a9a4..ddc85b19 100644 --- a/desc/sourceinfo/registry_test.go +++ b/desc/sourceinfo/registry_test.go @@ -5,7 +5,10 @@ import ( "testing" "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/reflect/protoregistry" + "github.com/jhump/protoreflect/desc" + "github.com/jhump/protoreflect/desc/protoparse" "github.com/jhump/protoreflect/desc/sourceinfo" _ "github.com/jhump/protoreflect/internal/testprotos" "github.com/jhump/protoreflect/internal/testutil" @@ -17,6 +20,38 @@ func TestRegistry(t *testing.T) { checkFileComments(t, fd) } +func TestCanUpgrade(t *testing.T) { + fd, err := protoregistry.GlobalFiles.FindFileByPath("desc_test1.proto") + testutil.Ok(t, err) + testutil.Require(t, sourceinfo.CanUpgrade(fd)) + + fd, err = sourceinfo.GlobalFiles.FindFileByPath("desc_test1.proto") + testutil.Ok(t, err) + testutil.Require(t, !sourceinfo.CanUpgrade(fd)) // already has source info + + p := protoparse.Parser{ + Accessor: protoparse.FileContentsFromMap(map[string]string{ + "test.proto": ` + syntax = "proto3"; + package test; + message Foo { + string name = 1; + } + `, + }), + } + fdProtos, err := p.ParseFilesButDoNotLink("test.proto") + testutil.Ok(t, err) + file, err := desc.CreateFileDescriptor(fdProtos[0]) + testutil.Ok(t, err) + testutil.Require(t, !sourceinfo.CanUpgrade(file.UnwrapFile())) // already has source info + + fdProtos[0].SourceCodeInfo = nil // strip source info and try again + file, err = desc.CreateFileDescriptor(fdProtos[0]) + testutil.Ok(t, err) + testutil.Require(t, !sourceinfo.CanUpgrade(file.UnwrapFile())) // still false; not from gen code +} + func checkFileComments(t *testing.T, fd protoreflect.FileDescriptor) { srcLocs := fd.SourceLocations() for i := 0; i < fd.Messages().Len(); i++ { diff --git a/desc/sourceinfo/update.go b/desc/sourceinfo/update.go new file mode 100644 index 00000000..53bc4572 --- /dev/null +++ b/desc/sourceinfo/update.go @@ -0,0 +1,314 @@ +package sourceinfo + +import ( + "fmt" + + "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/reflect/protoregistry" +) + +// AddSourceInfoToFile will return a new file descriptor that is a copy +// of fd except that it includes source code info. If the given file +// already contains source info, was not registered from generated code, +// or was not processed with the protoc-gen-gosrcinfo plugin, then fd +// is returned as is, unchanged. +func AddSourceInfoToFile(fd protoreflect.FileDescriptor) (protoreflect.FileDescriptor, error) { + return getFile(fd) +} + +// AddSourceInfoToMessage will return a new message descriptor that is a +// copy of md except that it includes source code info. If the file that +// contains the given message descriptor already contains source info, +// was not registered from generated code, or was not processed with the +// protoc-gen-gosrcinfo plugin, then md is returned as is, unchanged. +func AddSourceInfoToMessage(md protoreflect.MessageDescriptor) (protoreflect.MessageDescriptor, error) { + return updateDescriptor(md) +} + +// AddSourceInfoToEnum will return a new enum descriptor that is a copy +// of ed except that it includes source code info. If the file that +// contains the given enum descriptor already contains source info, was +// not registered from generated code, or was not processed with the +// protoc-gen-gosrcinfo plugin, then ed is returned as is, unchanged. +func AddSourceInfoToEnum(ed protoreflect.EnumDescriptor) (protoreflect.EnumDescriptor, error) { + return updateDescriptor(ed) +} + +// AddSourceInfoToService will return a new service descriptor that is +// a copy of sd except that it includes source code info. If the file +// that contains the given service descriptor already contains source +// info, was not registered from generated code, or was not processed +// with the protoc-gen-gosrcinfo plugin, then ed is returned as is, +// unchanged. +func AddSourceInfoToService(sd protoreflect.ServiceDescriptor) (protoreflect.ServiceDescriptor, error) { + return updateDescriptor(sd) +} + +// AddSourceInfoToExtensionType will return a new extension type that +// is a copy of xt except that its associated descriptors includes +// source code info. If the file that contains the given extension +// already contains source info, was not registered from generated +// code, or was not processed with the protoc-gen-gosrcinfo plugin, +// then xt is returned as is, unchanged. +func AddSourceInfoToExtensionType(xt protoreflect.ExtensionType) (protoreflect.ExtensionType, error) { + if genType, err := protoregistry.GlobalTypes.FindExtensionByName(xt.TypeDescriptor().FullName()); err != nil || genType != xt { + return xt, nil // not from generated code + } + ext, err := updateField(xt.TypeDescriptor().Descriptor()) + if err != nil { + return nil, err + } + return extensionType{ExtensionType: xt, extDesc: ext}, nil +} + +// AddSourceInfoToMessageType will return a new message type that +// is a copy of mt except that its associated descriptors includes +// source code info. If the file that contains the given message +// already contains source info, was not registered from generated +// code, or was not processed with the protoc-gen-gosrcinfo plugin, +// then mt is returned as is, unchanged. +func AddSourceInfoToMessageType(mt protoreflect.MessageType) (protoreflect.MessageType, error) { + if genType, err := protoregistry.GlobalTypes.FindMessageByName(mt.Descriptor().FullName()); err != nil || genType != mt { + return mt, nil // not from generated code + } + msg, err := updateDescriptor(mt.Descriptor()) + if err != nil { + return nil, err + } + return messageType{MessageType: mt, msgDesc: msg}, nil +} + +// WrapFile is present for backwards-compatibility reasons. It calls +// AddSourceInfoToFile and panics if that function returns an error. +// +// Deprecated: Use AddSourceInfoToFile directly instead. The word "wrap" is +// a misnomer since this method does not actually wrap the given value. +// Though unlikely, the operation can technically fail, so the recommended +// function allows the return of an error instead of panic'ing. +func WrapFile(fd protoreflect.FileDescriptor) protoreflect.FileDescriptor { + result, err := AddSourceInfoToFile(fd) + if err != nil { + panic(err) + } + return result +} + +// WrapMessage is present for backwards-compatibility reasons. It calls +// AddSourceInfoToMessage and panics if that function returns an error. +// +// Deprecated: Use AddSourceInfoToMessage directly instead. The word +// "wrap" is a misnomer since this method does not actually wrap the +// given value. Though unlikely, the operation can technically fail, +// so the recommended function allows the return of an error instead +// of panic'ing. +func WrapMessage(md protoreflect.MessageDescriptor) protoreflect.MessageDescriptor { + result, err := AddSourceInfoToMessage(md) + if err != nil { + panic(err) + } + return result +} + +// WrapEnum is present for backwards-compatibility reasons. It calls +// AddSourceInfoToEnum and panics if that function returns an error. +// +// Deprecated: Use AddSourceInfoToEnum directly instead. The word +// "wrap" is a misnomer since this method does not actually wrap the +// given value. Though unlikely, the operation can technically fail, +// so the recommended function allows the return of an error instead +// of panic'ing. +func WrapEnum(ed protoreflect.EnumDescriptor) protoreflect.EnumDescriptor { + result, err := AddSourceInfoToEnum(ed) + if err != nil { + panic(err) + } + return result +} + +// WrapService is present for backwards-compatibility reasons. It calls +// AddSourceInfoToService and panics if that function returns an error. +// +// Deprecated: Use AddSourceInfoToService directly instead. The word +// "wrap" is a misnomer since this method does not actually wrap the +// given value. Though unlikely, the operation can technically fail, +// so the recommended function allows the return of an error instead +// of panic'ing. +func WrapService(sd protoreflect.ServiceDescriptor) protoreflect.ServiceDescriptor { + result, err := AddSourceInfoToService(sd) + if err != nil { + panic(err) + } + return result +} + +// WrapExtensionType is present for backwards-compatibility reasons. It +// calls AddSourceInfoToExtensionType and panics if that function +// returns an error. +// +// Deprecated: Use AddSourceInfoToExtensionType directly instead. The +// word "wrap" is a misnomer since this method does not actually wrap +// the given value. Though unlikely, the operation can technically fail, +// so the recommended function allows the return of an error instead +// of panic'ing. +func WrapExtensionType(xt protoreflect.ExtensionType) protoreflect.ExtensionType { + result, err := AddSourceInfoToExtensionType(xt) + if err != nil { + panic(err) + } + return result +} + +// WrapMessageType is present for backwards-compatibility reasons. It +// calls AddSourceInfoToMessageType and panics if that function returns +// an error. +// +// Deprecated: Use AddSourceInfoToMessageType directly instead. The word +// "wrap" is a misnomer since this method does not actually wrap the +// given value. Though unlikely, the operation can technically fail, so +// the recommended function allows the return of an error instead of +// panic'ing. +func WrapMessageType(mt protoreflect.MessageType) protoreflect.MessageType { + result, err := AddSourceInfoToMessageType(mt) + if err != nil { + panic(err) + } + return result +} + +type extensionType struct { + protoreflect.ExtensionType + extDesc protoreflect.ExtensionDescriptor +} + +func (xt extensionType) TypeDescriptor() protoreflect.ExtensionTypeDescriptor { + return extensionTypeDescriptor{ExtensionDescriptor: xt.extDesc, extType: xt.ExtensionType} +} + +type extensionTypeDescriptor struct { + protoreflect.ExtensionDescriptor + extType protoreflect.ExtensionType +} + +func (xtd extensionTypeDescriptor) Type() protoreflect.ExtensionType { + return extensionType{ExtensionType: xtd.extType, extDesc: xtd.ExtensionDescriptor} +} + +func (xtd extensionTypeDescriptor) Descriptor() protoreflect.ExtensionDescriptor { + return xtd.ExtensionDescriptor +} + +type messageType struct { + protoreflect.MessageType + msgDesc protoreflect.MessageDescriptor +} + +func (mt messageType) Descriptor() protoreflect.MessageDescriptor { + return mt.msgDesc +} + +func updateField(fd protoreflect.FieldDescriptor) (protoreflect.FieldDescriptor, error) { + if xtd, ok := fd.(protoreflect.ExtensionTypeDescriptor); ok { + ext, err := updateField(xtd.Descriptor()) + if err != nil { + return nil, err + } + return extensionTypeDescriptor{ExtensionDescriptor: ext, extType: xtd.Type()}, nil + } + d, err := updateDescriptor(fd) + if err != nil { + return nil, err + } + return d.(protoreflect.FieldDescriptor), nil +} + +func updateDescriptor[D protoreflect.Descriptor](d D) (D, error) { + updatedFile, err := getFile(d.ParentFile()) + if err != nil { + var zero D + return zero, err + } + if updatedFile == d.ParentFile() { + // no change + return d, nil + } + updated := findDescriptor(updatedFile, d) + result, ok := updated.(D) + if !ok { + var zero D + return zero, fmt.Errorf("updated result is type %T which could not be converted to %T", updated, result) + } + return result, nil +} + +func findDescriptor(fd protoreflect.FileDescriptor, d protoreflect.Descriptor) protoreflect.Descriptor { + if d == nil { + return nil + } + if _, isFile := d.(protoreflect.FileDescriptor); isFile { + return fd + } + if d.Parent() == nil { + return d + } + switch d := d.(type) { + case protoreflect.MessageDescriptor: + parent := findDescriptor(fd, d.Parent()).(messageContainer) + return parent.Messages().Get(d.Index()) + case protoreflect.FieldDescriptor: + if d.IsExtension() { + parent := findDescriptor(fd, d.Parent()).(extensionContainer) + return parent.Extensions().Get(d.Index()) + } else { + parent := findDescriptor(fd, d.Parent()).(fieldContainer) + return parent.Fields().Get(d.Index()) + } + case protoreflect.OneofDescriptor: + parent := findDescriptor(fd, d.Parent()).(oneofContainer) + return parent.Oneofs().Get(d.Index()) + case protoreflect.EnumDescriptor: + parent := findDescriptor(fd, d.Parent()).(enumContainer) + return parent.Enums().Get(d.Index()) + case protoreflect.EnumValueDescriptor: + parent := findDescriptor(fd, d.Parent()).(enumValueContainer) + return parent.Values().Get(d.Index()) + case protoreflect.ServiceDescriptor: + parent := findDescriptor(fd, d.Parent()).(serviceContainer) + return parent.Services().Get(d.Index()) + case protoreflect.MethodDescriptor: + parent := findDescriptor(fd, d.Parent()).(methodContainer) + return parent.Methods().Get(d.Index()) + } + return d +} + +type messageContainer interface { + Messages() protoreflect.MessageDescriptors +} + +type extensionContainer interface { + Extensions() protoreflect.ExtensionDescriptors +} + +type fieldContainer interface { + Fields() protoreflect.FieldDescriptors +} + +type oneofContainer interface { + Oneofs() protoreflect.OneofDescriptors +} + +type enumContainer interface { + Enums() protoreflect.EnumDescriptors +} + +type enumValueContainer interface { + Values() protoreflect.EnumValueDescriptors +} + +type serviceContainer interface { + Services() protoreflect.ServiceDescriptors +} + +type methodContainer interface { + Methods() protoreflect.MethodDescriptors +} diff --git a/desc/sourceinfo/update_test.go b/desc/sourceinfo/update_test.go new file mode 100644 index 00000000..74f8f361 --- /dev/null +++ b/desc/sourceinfo/update_test.go @@ -0,0 +1,138 @@ +package sourceinfo_test + +import ( + "testing" + + "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/reflect/protoregistry" + + "github.com/jhump/protoreflect/desc/sourceinfo" + "github.com/jhump/protoreflect/internal/testprotos" + _ "github.com/jhump/protoreflect/internal/testprotos" + "github.com/jhump/protoreflect/internal/testutil" +) + +func TestUpdate(t *testing.T) { + // other descriptor types are indirectly covered by other cases in this file + t.Run("oneof", func(t *testing.T) { + d, err := protoregistry.GlobalFiles.FindDescriptorByName("testprotos.AnotherTestMessage.atmoo") + testutil.Ok(t, err) + ood, ok := d.(protoreflect.OneofDescriptor) + testutil.Require(t, ok) + + testutil.Require(t, isZeroSourceLocation(ood.ParentFile().SourceLocations().ByDescriptor(ood))) // no source location + ood, err = sourceinfo.UpdateDescriptor(ood) + testutil.Ok(t, err) + testutil.Require(t, !isZeroSourceLocation(ood.ParentFile().SourceLocations().ByDescriptor(ood))) // now there is a source location + }) + t.Run("enum value", func(t *testing.T) { + d, err := protoregistry.GlobalFiles.FindDescriptorByName("testprotos.TestMessage.VALUE1") + testutil.Ok(t, err) + evd, ok := d.(protoreflect.EnumValueDescriptor) + testutil.Require(t, ok) + + testutil.Require(t, isZeroSourceLocation(evd.ParentFile().SourceLocations().ByDescriptor(evd))) // no source location + evd, err = sourceinfo.UpdateDescriptor(evd) + testutil.Ok(t, err) + testutil.Require(t, !isZeroSourceLocation(evd.ParentFile().SourceLocations().ByDescriptor(evd))) // now there is a source location + }) + t.Run("field", func(t *testing.T) { + d, err := protoregistry.GlobalFiles.FindDescriptorByName("testprotos.TestMessage.nm") + testutil.Ok(t, err) + fld, ok := d.(protoreflect.FieldDescriptor) + testutil.Require(t, ok) + + testutil.Require(t, isZeroSourceLocation(fld.ParentFile().SourceLocations().ByDescriptor(fld))) // no source location + fld, err = sourceinfo.UpdateField(fld) + testutil.Ok(t, err) + testutil.Require(t, !isZeroSourceLocation(fld.ParentFile().SourceLocations().ByDescriptor(fld))) // now there is a source location + }) + t.Run("extension", func(t *testing.T) { + xtd := testprotos.E_Xui.TypeDescriptor() + + testutil.Require(t, isZeroSourceLocation(xtd.ParentFile().SourceLocations().ByDescriptor(xtd))) // no source location + fld, err := sourceinfo.UpdateField(xtd) + testutil.Ok(t, err) + xtd, ok := fld.(protoreflect.ExtensionTypeDescriptor) + testutil.Require(t, ok) + testutil.Require(t, !isZeroSourceLocation(xtd.ParentFile().SourceLocations().ByDescriptor(xtd))) // now there is a source location + }) + t.Run("method", func(t *testing.T) { + d, err := protoregistry.GlobalFiles.FindDescriptorByName("testprotos.SomeService.SomeRPC") + testutil.Ok(t, err) + mtd, ok := d.(protoreflect.MethodDescriptor) + testutil.Require(t, ok) + + testutil.Require(t, isZeroSourceLocation(mtd.ParentFile().SourceLocations().ByDescriptor(mtd))) // no source location + mtd, err = sourceinfo.UpdateDescriptor(mtd) + testutil.Ok(t, err) + testutil.Require(t, !isZeroSourceLocation(mtd.ParentFile().SourceLocations().ByDescriptor(mtd))) // now there is a source location + }) +} + +func TestWrapFile(t *testing.T) { + file, err := protoregistry.GlobalFiles.FindFileByPath("desc_test1.proto") + testutil.Ok(t, err) + testutil.Eq(t, 0, file.SourceLocations().Len()) + file = sourceinfo.WrapFile(file) + testutil.Neq(t, 0, file.SourceLocations().Len()) // now there are source locations +} + +func TestWrapMessage(t *testing.T) { + d, err := protoregistry.GlobalFiles.FindDescriptorByName("testprotos.TestMessage.NestedMessage") + testutil.Ok(t, err) + md, ok := d.(protoreflect.MessageDescriptor) + testutil.Require(t, ok) + testutil.Require(t, isZeroSourceLocation(md.ParentFile().SourceLocations().ByDescriptor(md))) // no source location + md = sourceinfo.WrapMessage(md) + testutil.Require(t, !isZeroSourceLocation(md.ParentFile().SourceLocations().ByDescriptor(md))) // now there is a source location +} + +func TestWrapEnum(t *testing.T) { + d, err := protoregistry.GlobalFiles.FindDescriptorByName("testprotos.TestMessage.NestedEnum") + testutil.Ok(t, err) + ed, ok := d.(protoreflect.EnumDescriptor) + testutil.Require(t, ok) + testutil.Require(t, isZeroSourceLocation(ed.ParentFile().SourceLocations().ByDescriptor(ed))) // no source location + ed = sourceinfo.WrapEnum(ed) + testutil.Require(t, !isZeroSourceLocation(ed.ParentFile().SourceLocations().ByDescriptor(ed))) // now there is a source location +} + +func TestWrapService(t *testing.T) { + d, err := protoregistry.GlobalFiles.FindDescriptorByName("testprotos.SomeService") + testutil.Ok(t, err) + sd, ok := d.(protoreflect.ServiceDescriptor) + testutil.Require(t, ok) + testutil.Require(t, isZeroSourceLocation(sd.ParentFile().SourceLocations().ByDescriptor(sd))) // no source location + sd = sourceinfo.WrapService(sd) + testutil.Require(t, !isZeroSourceLocation(sd.ParentFile().SourceLocations().ByDescriptor(sd))) // now there is a source location +} + +func TestWrapMessageType(t *testing.T) { + mt, err := protoregistry.GlobalTypes.FindMessageByName("testprotos.TestMessage.NestedMessage") + testutil.Ok(t, err) + md := mt.Descriptor() + testutil.Require(t, isZeroSourceLocation(md.ParentFile().SourceLocations().ByDescriptor(md))) // no source location + mt = sourceinfo.WrapMessageType(mt) + md = mt.Descriptor() + testutil.Require(t, !isZeroSourceLocation(md.ParentFile().SourceLocations().ByDescriptor(md))) // now there is a source location +} + +func TestWrapExtensionType(t *testing.T) { + xt, err := protoregistry.GlobalTypes.FindExtensionByName("testprotos.xtm") + testutil.Ok(t, err) + xd := xt.TypeDescriptor() + testutil.Require(t, isZeroSourceLocation(xd.ParentFile().SourceLocations().ByDescriptor(xd))) // no source location + xt = sourceinfo.WrapExtensionType(xt) + xd = xt.TypeDescriptor() + testutil.Require(t, !isZeroSourceLocation(xd.ParentFile().SourceLocations().ByDescriptor(xd))) // now there is a source location +} + +func isZeroSourceLocation(loc protoreflect.SourceLocation) bool { + return loc.Path == nil && + loc.StartLine == 0 && loc.StartColumn == 0 && + loc.EndLine == 0 && loc.EndColumn == 0 && + loc.LeadingDetachedComments == nil && + loc.LeadingComments == "" && loc.TrailingComments == "" && + loc.Next == 0 +} diff --git a/desc/sourceinfo/wrappers.go b/desc/sourceinfo/wrappers.go deleted file mode 100644 index 3106eaad..00000000 --- a/desc/sourceinfo/wrappers.go +++ /dev/null @@ -1,636 +0,0 @@ -package sourceinfo - -import ( - "fmt" - "google.golang.org/protobuf/reflect/protoreflect" -) - -// These are wrappers around the various interfaces in the -// google.golang.org/protobuf/reflect/protoreflect that all -// make sure to return a FileDescriptor that includes source -// code info. - -type fileDescriptor struct { - protoreflect.FileDescriptor - locs protoreflect.SourceLocations -} - -func (f fileDescriptor) Edition() int32 { - ed, ok := f.FileDescriptor.(interface{ Edition() int32 }) - if ok { - return ed.Edition() - } - return 0 -} - -func (f fileDescriptor) ParentFile() protoreflect.FileDescriptor { - return f -} - -func (f fileDescriptor) Parent() protoreflect.Descriptor { - return nil -} - -func (f fileDescriptor) Imports() protoreflect.FileImports { - return imports{f.FileDescriptor.Imports()} -} - -func (f fileDescriptor) Messages() protoreflect.MessageDescriptors { - return messages{f.FileDescriptor.Messages()} -} - -func (f fileDescriptor) Enums() protoreflect.EnumDescriptors { - return enums{f.FileDescriptor.Enums()} -} - -func (f fileDescriptor) Extensions() protoreflect.ExtensionDescriptors { - return extensions{f.FileDescriptor.Extensions()} -} - -func (f fileDescriptor) Services() protoreflect.ServiceDescriptors { - return services{f.FileDescriptor.Services()} -} - -func (f fileDescriptor) SourceLocations() protoreflect.SourceLocations { - return f.locs -} - -type imports struct { - protoreflect.FileImports -} - -func (im imports) Get(i int) protoreflect.FileImport { - fi := im.FileImports.Get(i) - return protoreflect.FileImport{ - FileDescriptor: getFile(fi.FileDescriptor), - IsPublic: fi.IsPublic, - IsWeak: fi.IsWeak, - } -} - -type messages struct { - protoreflect.MessageDescriptors -} - -func (m messages) Get(i int) protoreflect.MessageDescriptor { - return messageDescriptor{m.MessageDescriptors.Get(i)} -} - -func (m messages) ByName(n protoreflect.Name) protoreflect.MessageDescriptor { - return messageDescriptor{m.MessageDescriptors.ByName(n)} -} - -type enums struct { - protoreflect.EnumDescriptors -} - -func (e enums) Get(i int) protoreflect.EnumDescriptor { - return enumDescriptor{e.EnumDescriptors.Get(i)} -} - -func (e enums) ByName(n protoreflect.Name) protoreflect.EnumDescriptor { - return enumDescriptor{e.EnumDescriptors.ByName(n)} -} - -type extensions struct { - protoreflect.ExtensionDescriptors -} - -func (e extensions) Get(i int) protoreflect.ExtensionDescriptor { - d := e.ExtensionDescriptors.Get(i) - if ed, ok := d.(protoreflect.ExtensionTypeDescriptor); ok { - return extensionDescriptor{ed} - } - return fieldDescriptor{d} -} - -func (e extensions) ByName(n protoreflect.Name) protoreflect.ExtensionDescriptor { - d := e.ExtensionDescriptors.ByName(n) - if ed, ok := d.(protoreflect.ExtensionTypeDescriptor); ok { - return extensionDescriptor{ed} - } - return fieldDescriptor{d} -} - -type services struct { - protoreflect.ServiceDescriptors -} - -func (s services) Get(i int) protoreflect.ServiceDescriptor { - return serviceDescriptor{s.ServiceDescriptors.Get(i)} -} - -func (s services) ByName(n protoreflect.Name) protoreflect.ServiceDescriptor { - return serviceDescriptor{s.ServiceDescriptors.ByName(n)} -} - -type messageDescriptor struct { - protoreflect.MessageDescriptor -} - -func (m messageDescriptor) ParentFile() protoreflect.FileDescriptor { - return getFile(m.MessageDescriptor.ParentFile()) -} - -func (m messageDescriptor) Parent() protoreflect.Descriptor { - d := m.MessageDescriptor.Parent() - switch d := d.(type) { - case protoreflect.MessageDescriptor: - return messageDescriptor{d} - case protoreflect.FileDescriptor: - return getFile(d) - case nil: - return nil - default: - panic(fmt.Sprintf("unexpected descriptor type %T", d)) - } -} - -func (m messageDescriptor) Fields() protoreflect.FieldDescriptors { - return fields{m.MessageDescriptor.Fields()} -} - -func (m messageDescriptor) Oneofs() protoreflect.OneofDescriptors { - return oneOfs{m.MessageDescriptor.Oneofs()} -} - -func (m messageDescriptor) Enums() protoreflect.EnumDescriptors { - return enums{m.MessageDescriptor.Enums()} -} - -func (m messageDescriptor) Messages() protoreflect.MessageDescriptors { - return messages{m.MessageDescriptor.Messages()} -} - -func (m messageDescriptor) Extensions() protoreflect.ExtensionDescriptors { - return extensions{m.MessageDescriptor.Extensions()} -} - -type fields struct { - protoreflect.FieldDescriptors -} - -func (f fields) Get(i int) protoreflect.FieldDescriptor { - return fieldDescriptor{f.FieldDescriptors.Get(i)} -} - -func (f fields) ByName(n protoreflect.Name) protoreflect.FieldDescriptor { - return fieldDescriptor{f.FieldDescriptors.ByName(n)} -} - -func (f fields) ByJSONName(n string) protoreflect.FieldDescriptor { - return fieldDescriptor{f.FieldDescriptors.ByJSONName(n)} -} - -func (f fields) ByTextName(n string) protoreflect.FieldDescriptor { - return fieldDescriptor{f.FieldDescriptors.ByTextName(n)} -} - -func (f fields) ByNumber(n protoreflect.FieldNumber) protoreflect.FieldDescriptor { - return fieldDescriptor{f.FieldDescriptors.ByNumber(n)} -} - -type oneOfs struct { - protoreflect.OneofDescriptors -} - -func (o oneOfs) Get(i int) protoreflect.OneofDescriptor { - return oneOfDescriptor{o.OneofDescriptors.Get(i)} -} - -func (o oneOfs) ByName(n protoreflect.Name) protoreflect.OneofDescriptor { - return oneOfDescriptor{o.OneofDescriptors.ByName(n)} -} - -type fieldDescriptor struct { - protoreflect.FieldDescriptor -} - -func (f fieldDescriptor) ParentFile() protoreflect.FileDescriptor { - return getFile(f.FieldDescriptor.ParentFile()) -} - -func (f fieldDescriptor) Parent() protoreflect.Descriptor { - d := f.FieldDescriptor.Parent() - switch d := d.(type) { - case protoreflect.MessageDescriptor: - return messageDescriptor{d} - case protoreflect.FileDescriptor: - return getFile(d) - case nil: - return nil - default: - panic(fmt.Sprintf("unexpected descriptor type %T", d)) - } -} - -func (f fieldDescriptor) MapKey() protoreflect.FieldDescriptor { - fd := f.FieldDescriptor.MapKey() - if fd == nil { - return nil - } - return fieldDescriptor{fd} -} - -func (f fieldDescriptor) MapValue() protoreflect.FieldDescriptor { - fd := f.FieldDescriptor.MapValue() - if fd == nil { - return nil - } - return fieldDescriptor{fd} -} - -func (f fieldDescriptor) DefaultEnumValue() protoreflect.EnumValueDescriptor { - ed := f.FieldDescriptor.DefaultEnumValue() - if ed == nil { - return nil - } - return enumValueDescriptor{ed} -} - -func (f fieldDescriptor) ContainingOneof() protoreflect.OneofDescriptor { - od := f.FieldDescriptor.ContainingOneof() - if od == nil { - return nil - } - return oneOfDescriptor{od} -} - -func (f fieldDescriptor) ContainingMessage() protoreflect.MessageDescriptor { - return messageDescriptor{f.FieldDescriptor.ContainingMessage()} -} - -func (f fieldDescriptor) Enum() protoreflect.EnumDescriptor { - ed := f.FieldDescriptor.Enum() - if ed == nil { - return nil - } - return enumDescriptor{ed} -} - -func (f fieldDescriptor) Message() protoreflect.MessageDescriptor { - md := f.FieldDescriptor.Message() - if md == nil { - return nil - } - return messageDescriptor{md} -} - -type oneOfDescriptor struct { - protoreflect.OneofDescriptor -} - -func (o oneOfDescriptor) ParentFile() protoreflect.FileDescriptor { - return getFile(o.OneofDescriptor.ParentFile()) -} - -func (o oneOfDescriptor) Parent() protoreflect.Descriptor { - d := o.OneofDescriptor.Parent() - switch d := d.(type) { - case protoreflect.MessageDescriptor: - return messageDescriptor{d} - case nil: - return nil - default: - panic(fmt.Sprintf("unexpected descriptor type %T", d)) - } -} - -func (o oneOfDescriptor) Fields() protoreflect.FieldDescriptors { - return fields{o.OneofDescriptor.Fields()} -} - -type enumDescriptor struct { - protoreflect.EnumDescriptor -} - -func (e enumDescriptor) ParentFile() protoreflect.FileDescriptor { - return getFile(e.EnumDescriptor.ParentFile()) -} - -func (e enumDescriptor) Parent() protoreflect.Descriptor { - d := e.EnumDescriptor.Parent() - switch d := d.(type) { - case protoreflect.MessageDescriptor: - return messageDescriptor{d} - case protoreflect.FileDescriptor: - return getFile(d) - case nil: - return nil - default: - panic(fmt.Sprintf("unexpected descriptor type %T", d)) - } -} - -func (e enumDescriptor) Values() protoreflect.EnumValueDescriptors { - return enumValues{e.EnumDescriptor.Values()} -} - -type enumValues struct { - protoreflect.EnumValueDescriptors -} - -func (e enumValues) Get(i int) protoreflect.EnumValueDescriptor { - return enumValueDescriptor{e.EnumValueDescriptors.Get(i)} -} - -func (e enumValues) ByName(n protoreflect.Name) protoreflect.EnumValueDescriptor { - return enumValueDescriptor{e.EnumValueDescriptors.ByName(n)} -} - -func (e enumValues) ByNumber(n protoreflect.EnumNumber) protoreflect.EnumValueDescriptor { - return enumValueDescriptor{e.EnumValueDescriptors.ByNumber(n)} -} - -type enumValueDescriptor struct { - protoreflect.EnumValueDescriptor -} - -func (e enumValueDescriptor) ParentFile() protoreflect.FileDescriptor { - return getFile(e.EnumValueDescriptor.ParentFile()) -} - -func (e enumValueDescriptor) Parent() protoreflect.Descriptor { - d := e.EnumValueDescriptor.Parent() - switch d := d.(type) { - case protoreflect.EnumDescriptor: - return enumDescriptor{d} - case nil: - return nil - default: - panic(fmt.Sprintf("unexpected descriptor type %T", d)) - } -} - -type extensionDescriptor struct { - protoreflect.ExtensionTypeDescriptor -} - -func (e extensionDescriptor) ParentFile() protoreflect.FileDescriptor { - return getFile(e.ExtensionTypeDescriptor.ParentFile()) -} - -func (e extensionDescriptor) Parent() protoreflect.Descriptor { - d := e.ExtensionTypeDescriptor.Parent() - switch d := d.(type) { - case protoreflect.MessageDescriptor: - return messageDescriptor{d} - case protoreflect.FileDescriptor: - return getFile(d) - case nil: - return nil - default: - panic(fmt.Sprintf("unexpected descriptor type %T", d)) - } -} - -func (e extensionDescriptor) MapKey() protoreflect.FieldDescriptor { - fd := e.ExtensionTypeDescriptor.MapKey() - if fd == nil { - return nil - } - return fieldDescriptor{fd} -} - -func (e extensionDescriptor) MapValue() protoreflect.FieldDescriptor { - fd := e.ExtensionTypeDescriptor.MapValue() - if fd == nil { - return nil - } - return fieldDescriptor{fd} -} - -func (e extensionDescriptor) DefaultEnumValue() protoreflect.EnumValueDescriptor { - ed := e.ExtensionTypeDescriptor.DefaultEnumValue() - if ed == nil { - return nil - } - return enumValueDescriptor{ed} -} - -func (e extensionDescriptor) ContainingOneof() protoreflect.OneofDescriptor { - od := e.ExtensionTypeDescriptor.ContainingOneof() - if od == nil { - return nil - } - return oneOfDescriptor{od} -} - -func (e extensionDescriptor) ContainingMessage() protoreflect.MessageDescriptor { - return messageDescriptor{e.ExtensionTypeDescriptor.ContainingMessage()} -} - -func (e extensionDescriptor) Enum() protoreflect.EnumDescriptor { - ed := e.ExtensionTypeDescriptor.Enum() - if ed == nil { - return nil - } - return enumDescriptor{ed} -} - -func (e extensionDescriptor) Message() protoreflect.MessageDescriptor { - md := e.ExtensionTypeDescriptor.Message() - if md == nil { - return nil - } - return messageDescriptor{md} -} - -func (e extensionDescriptor) Descriptor() protoreflect.ExtensionDescriptor { - return e -} - -var _ protoreflect.ExtensionTypeDescriptor = extensionDescriptor{} - -type serviceDescriptor struct { - protoreflect.ServiceDescriptor -} - -func (s serviceDescriptor) ParentFile() protoreflect.FileDescriptor { - return getFile(s.ServiceDescriptor.ParentFile()) -} - -func (s serviceDescriptor) Parent() protoreflect.Descriptor { - d := s.ServiceDescriptor.Parent() - switch d := d.(type) { - case protoreflect.FileDescriptor: - return getFile(d) - case nil: - return nil - default: - panic(fmt.Sprintf("unexpected descriptor type %T", d)) - } -} - -func (s serviceDescriptor) Methods() protoreflect.MethodDescriptors { - return methods{s.ServiceDescriptor.Methods()} -} - -type methods struct { - protoreflect.MethodDescriptors -} - -func (m methods) Get(i int) protoreflect.MethodDescriptor { - return methodDescriptor{m.MethodDescriptors.Get(i)} -} - -func (m methods) ByName(n protoreflect.Name) protoreflect.MethodDescriptor { - return methodDescriptor{m.MethodDescriptors.ByName(n)} -} - -type methodDescriptor struct { - protoreflect.MethodDescriptor -} - -func (m methodDescriptor) ParentFile() protoreflect.FileDescriptor { - return getFile(m.MethodDescriptor.ParentFile()) -} - -func (m methodDescriptor) Parent() protoreflect.Descriptor { - d := m.MethodDescriptor.Parent() - switch d := d.(type) { - case protoreflect.ServiceDescriptor: - return serviceDescriptor{d} - case nil: - return nil - default: - panic(fmt.Sprintf("unexpected descriptor type %T", d)) - } -} - -func (m methodDescriptor) Input() protoreflect.MessageDescriptor { - return messageDescriptor{m.MethodDescriptor.Input()} -} - -func (m methodDescriptor) Output() protoreflect.MessageDescriptor { - return messageDescriptor{m.MethodDescriptor.Output()} -} - -type extensionType struct { - protoreflect.ExtensionType -} - -func (e extensionType) TypeDescriptor() protoreflect.ExtensionTypeDescriptor { - return extensionDescriptor{e.ExtensionType.TypeDescriptor()} -} - -type messageType struct { - protoreflect.MessageType -} - -func (m messageType) Descriptor() protoreflect.MessageDescriptor { - return messageDescriptor{m.MessageType.Descriptor()} -} - -// WrapFile wraps the given file descriptor so that it will include source -// code info that was registered with this package if the given file was -// processed with protoc-gen-gosrcinfo. Returns fd without wrapping if fd -// already contains source code info. -func WrapFile(fd protoreflect.FileDescriptor) protoreflect.FileDescriptor { - if wrapper, ok := fd.(fileDescriptor); ok { - // already wrapped - return wrapper - } - if fd.SourceLocations().Len() > 0 { - // no need to wrap since it includes source info already - return fd - } - return getFile(fd) -} - -// WrapMessage wraps the given message descriptor so that it will include source -// code info that was registered with this package if the file it is defined in -// was processed with protoc-gen-gosrcinfo. Returns md without wrapping if md's -// parent file already contains source code info. -func WrapMessage(md protoreflect.MessageDescriptor) protoreflect.MessageDescriptor { - if wrapper, ok := md.(messageDescriptor); ok { - // already wrapped - return wrapper - } - if md.ParentFile().SourceLocations().Len() > 0 { - // no need to wrap since it includes source info already - return md - } - if !canWrap(md) { - return md - } - return messageDescriptor{md} -} - -// WrapEnum wraps the given enum descriptor so that it will include source -// code info that was registered with this package if the file it is defined in -// was processed with protoc-gen-gosrcinfo. Returns ed without wrapping if ed's -// parent file already contains source code info. -func WrapEnum(ed protoreflect.EnumDescriptor) protoreflect.EnumDescriptor { - if wrapper, ok := ed.(enumDescriptor); ok { - // already wrapped - return wrapper - } - if ed.ParentFile().SourceLocations().Len() > 0 { - // no need to wrap since it includes source info already - return ed - } - if !canWrap(ed) { - return ed - } - return enumDescriptor{ed} -} - -// WrapService wraps the given service descriptor so that it will include source -// code info that was registered with this package if the file it is defined in -// was processed with protoc-gen-gosrcinfo. Returns sd without wrapping if sd's -// parent file already contains source code info. -func WrapService(sd protoreflect.ServiceDescriptor) protoreflect.ServiceDescriptor { - if wrapper, ok := sd.(serviceDescriptor); ok { - // already wrapped - return wrapper - } - if sd.ParentFile().SourceLocations().Len() > 0 { - // no need to wrap since it includes source info already - return sd - } - if !canWrap(sd) { - return sd - } - return serviceDescriptor{sd} -} - -// WrapExtensionType wraps the given extension type so that its associated -// descriptor will include source code info that was registered with this package -// if the file it is defined in was processed with protoc-gen-gosrcinfo. Returns -// xt without wrapping if the parent file of xt's descriptor already contains -// source code info. -func WrapExtensionType(xt protoreflect.ExtensionType) protoreflect.ExtensionType { - if wrapper, ok := xt.(extensionType); ok { - // already wrapped - return wrapper - } - if xt.TypeDescriptor().ParentFile().SourceLocations().Len() > 0 { - // no need to wrap since it includes source info already - return xt - } - if !canWrap(xt.TypeDescriptor()) { - return xt - } - return extensionType{xt} -} - -// WrapMessageType wraps the given message type so that its associated -// descriptor will include source code info that was registered with this package -// if the file it is defined in was processed with protoc-gen-gosrcinfo. Returns -// mt without wrapping if the parent file of mt's descriptor already contains -// source code info. -func WrapMessageType(mt protoreflect.MessageType) protoreflect.MessageType { - if wrapper, ok := mt.(messageType); ok { - // already wrapped - return wrapper - } - if mt.Descriptor().ParentFile().SourceLocations().Len() > 0 { - // no need to wrap since it includes source info already - return mt - } - if !canWrap(mt.Descriptor()) { - return mt - } - return messageType{mt} -} diff --git a/internal/testprotos/desc_test1.pb.go b/internal/testprotos/desc_test1.pb.go index bfb2a959..a73c8805 100644 --- a/internal/testprotos/desc_test1.pb.go +++ b/internal/testprotos/desc_test1.pb.go @@ -889,24 +889,33 @@ var file_desc_test1_proto_rawDesc = []byte{ 0x6f, 0x6f, 0x72, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x64, 0x6f, 0x6f, 0x72, 0x73, 0x1a, 0x0d, 0x0a, 0x0b, 0x57, 0x69, 0x74, 0x68, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2a, 0x05, 0x08, 0x64, 0x10, 0xc9, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x61, 0x74, 0x6d, 0x6f, 0x6f, - 0x3a, 0x49, 0x0a, 0x03, 0x78, 0x74, 0x6d, 0x12, 0x1e, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x41, 0x6e, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x54, 0x65, 0x73, 0x74, - 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, - 0x74, 0x65, 0x73, 0x74, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x4d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x03, 0x78, 0x74, 0x6d, 0x3a, 0x2e, 0x0a, 0x02, 0x78, - 0x73, 0x12, 0x1e, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x41, - 0x6e, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x54, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x18, 0x65, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x78, 0x73, 0x3a, 0x2e, 0x0a, 0x02, 0x78, - 0x69, 0x12, 0x1e, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x41, - 0x6e, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x54, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x18, 0x66, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x78, 0x69, 0x3a, 0x30, 0x0a, 0x03, 0x78, - 0x75, 0x69, 0x12, 0x1e, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, - 0x41, 0x6e, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x54, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x18, 0x67, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x78, 0x75, 0x69, 0x42, 0x33, 0x5a, - 0x31, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6a, 0x68, 0x75, 0x6d, - 0x70, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x72, 0x65, 0x66, 0x6c, 0x65, 0x63, 0x74, 0x2f, 0x69, - 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x73, + 0x32, 0x9a, 0x01, 0x0a, 0x0b, 0x53, 0x6f, 0x6d, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x12, 0x3b, 0x0a, 0x07, 0x53, 0x6f, 0x6d, 0x65, 0x52, 0x50, 0x43, 0x12, 0x17, 0x2e, 0x74, 0x65, + 0x73, 0x74, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x1a, 0x17, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x4e, 0x0a, + 0x0c, 0x53, 0x6f, 0x6d, 0x65, 0x4f, 0x74, 0x68, 0x65, 0x72, 0x52, 0x50, 0x43, 0x12, 0x1e, 0x2e, + 0x74, 0x65, 0x73, 0x74, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x41, 0x6e, 0x6f, 0x74, 0x68, + 0x65, 0x72, 0x54, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x1e, 0x2e, + 0x74, 0x65, 0x73, 0x74, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x41, 0x6e, 0x6f, 0x74, 0x68, + 0x65, 0x72, 0x54, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x3a, 0x49, 0x0a, + 0x03, 0x78, 0x74, 0x6d, 0x12, 0x1e, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x41, 0x6e, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x54, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x74, 0x65, 0x73, + 0x74, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x52, 0x03, 0x78, 0x74, 0x6d, 0x3a, 0x2e, 0x0a, 0x02, 0x78, 0x73, 0x12, 0x1e, + 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x41, 0x6e, 0x6f, 0x74, + 0x68, 0x65, 0x72, 0x54, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x65, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x78, 0x73, 0x3a, 0x2e, 0x0a, 0x02, 0x78, 0x69, 0x12, 0x1e, + 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x41, 0x6e, 0x6f, 0x74, + 0x68, 0x65, 0x72, 0x54, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x66, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x78, 0x69, 0x3a, 0x30, 0x0a, 0x03, 0x78, 0x75, 0x69, 0x12, + 0x1e, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x41, 0x6e, 0x6f, + 0x74, 0x68, 0x65, 0x72, 0x54, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, + 0x67, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x78, 0x75, 0x69, 0x42, 0x33, 0x5a, 0x31, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6a, 0x68, 0x75, 0x6d, 0x70, 0x2f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x72, 0x65, 0x66, 0x6c, 0x65, 0x63, 0x74, 0x2f, 0x69, 0x6e, 0x74, 0x65, + 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, } var ( @@ -964,8 +973,12 @@ var file_desc_test1_proto_depIdxs = []int32{ 3, // 22: testprotos.xui:extendee -> testprotos.AnotherTestMessage 3, // 23: testprotos.TestMessage.NestedMessage.AnotherNestedMessage.flags:extendee -> testprotos.AnotherTestMessage 2, // 24: testprotos.xtm:type_name -> testprotos.TestMessage - 25, // [25:25] is the sub-list for method output_type - 25, // [25:25] is the sub-list for method input_type + 2, // 25: testprotos.SomeService.SomeRPC:input_type -> testprotos.TestMessage + 3, // 26: testprotos.SomeService.SomeOtherRPC:input_type -> testprotos.AnotherTestMessage + 2, // 27: testprotos.SomeService.SomeRPC:output_type -> testprotos.TestMessage + 3, // 28: testprotos.SomeService.SomeOtherRPC:output_type -> testprotos.AnotherTestMessage + 27, // [27:29] is the sub-list for method output_type + 25, // [25:27] is the sub-list for method input_type 24, // [24:25] is the sub-list for extension type_name 19, // [19:24] is the sub-list for extension extendee 0, // [0:19] is the sub-list for field type_name @@ -1076,7 +1089,7 @@ func file_desc_test1_proto_init() { NumEnums: 2, NumMessages: 11, NumExtensions: 5, - NumServices: 0, + NumServices: 1, }, GoTypes: file_desc_test1_proto_goTypes, DependencyIndexes: file_desc_test1_proto_depIdxs, diff --git a/internal/testprotos/desc_test1.pb.srcinfo.go b/internal/testprotos/desc_test1.pb.srcinfo.go index 95dabf87..44d0d1e1 100644 --- a/internal/testprotos/desc_test1.pb.srcinfo.go +++ b/internal/testprotos/desc_test1.pb.srcinfo.go @@ -7,112 +7,119 @@ import "github.com/jhump/protoreflect/desc/sourceinfo" func init() { srcInfo := []byte{ - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x94, 0x57, 0x7f, 0x53, 0xdb, 0x48, - 0x12, 0xd5, 0xa8, 0x25, 0x79, 0x68, 0xc2, 0x22, 0x37, 0x2c, 0xd8, 0x32, 0x06, 0x19, 0x63, 0xfc, - 0x23, 0x01, 0xd6, 0x06, 0x4c, 0x80, 0xb0, 0x01, 0x76, 0x93, 0xe2, 0x52, 0x1c, 0x97, 0xa2, 0x38, - 0x8e, 0xad, 0xad, 0x54, 0x0e, 0x36, 0xca, 0x86, 0x02, 0xdb, 0x09, 0x36, 0x5b, 0xd9, 0xfb, 0xf4, - 0x57, 0x2d, 0x69, 0x6c, 0x8d, 0xca, 0xa9, 0xad, 0xfd, 0x6f, 0x5e, 0xbb, 0xe7, 0xbd, 0x9e, 0xee, - 0x9e, 0x1e, 0x19, 0x1d, 0xb2, 0x0c, 0xe3, 0x0f, 0x81, 0x12, 0xc5, 0x13, 0x02, 0xc3, 0x20, 0x5e, - 0x49, 0x02, 0xd3, 0x38, 0xc1, 0x09, 0x34, 0xe5, 0x64, 0xb4, 0x94, 0x28, 0x4c, 0x02, 0xcb, 0x98, - 0xc1, 0x0a, 0x9a, 0x96, 0x41, 0x56, 0xc6, 0xf8, 0x49, 0x78, 0x79, 0xff, 0xa7, 0x5e, 0xa7, 0x13, - 0x74, 0x07, 0xfe, 0xc7, 0xde, 0x83, 0x7f, 0x11, 0xf4, 0x07, 0xff, 0x0c, 0xfa, 0xfd, 0xeb, 0xdf, - 0x03, 0x44, 0x44, 0xb0, 0x0c, 0x41, 0x90, 0x91, 0x33, 0x58,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, 0x7e, 0xaf, 0x10, 0x43, 0x38, + 0xbc, 0xb9, 0x53, 0x08, 0x10, 0x0e, 0x3b, 0x1f, 0x64, 0x39, 0xe0, 0x65, 0x08, 0x47, 0xa2, 0x96, + 0xd8, 0xb1, 0xad, 0xab, 0x0f, 0xaf, 0xdf, 0xdd, 0xf8, 0x77, 0x6f, 0xeb, 0x8a, 0x9e, 0x8a, 0x72, + 0x24, 0x5c, 0x85, 0x68, 0x56, 0xae, 0xac, 0x10, 0x20, 0x1c, 0x55, 0xaa, 0x11, 0xa1, 0x89, 0x70, + 0x2c, 0xaa, 0xdf, 0x22, 0x6c, 0x28, 0x42, 0x6a, 0x67, 0xc7, 0x22, 0xab, 0x10, 0x43, 0x38, 0x76, + 0x17, 0x14, 0x02, 0x84, 0xe3, 0xa5, 0x4a, 0x44, 0x08, 0x08, 0x27, 0xdf, 0x26, 0x5c, 0x53, 0x84, + 0x54, 0x84, 0x93, 0x3e, 0x21, 0x15, 0xe1, 0xa4, 0x4f, 0x48, 0x45, 0x38, 0xe9, 0x13, 0x72, 0x84, + 0x53, 0xb1, 0xf9, 0x2d, 0xc2, 0x75, 0x45, 0x48, 0x17, 0xc4, 0xa9, 0x58, 0x52, 0x88, 0x21, 0x9c, + 0x56, 0x1a, 0x0a, 0x01, 0xc2, 0xe9, 0x46, 0x53, 0x8e, 0x05, 0x84, 0x16, 0xf2, 0x33, 0xf1, 0xeb, + 0x48, 0xf4, 0x1b, 0xf5, 0xfd, 0xb3, 0x7e, 0x25, 0x2c, 0x0b, 0xe1, 0x2c, 0x3d, 0xad, 0x10, 0x43, + 0x38, 0x9b, 0xf1, 0x14, 0x02, 0x84, 0xb3, 0xd2, 0x42, 0x18, 0x16, 0xf0, 0x90, 0xc5, 0x9d, 0xd1, + 0xe2, 0x3a, 0xeb, 0xbc, 0xb9, 0x3d, 0x39, 0xeb, 0xdc, 0xdd, 0x45, 0x61, 0x01, 0xd7, 0x29, 0xec, + 0x10, 0x2d, 0x48, 0x9b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2, 0x55, 0x1c, 0xb9, 0xee, 0xff, 0xb1, 0xfd, 0x4c, + 0x39, 0x8f, 0x51, 0x52, 0xc9, 0xbe, 0x8e, 0x65, 0x14, 0x32, 0x11, 0xbe, 0x66, 0x1f, 0x29, 0x04, + 0x08, 0x5f, 0x9b, 0x87, 0xff, 0x0b, 0x00, 0x00, 0xff, 0xff, 0x7c, 0x50, 0x74, 0xec, 0x78, 0x11, + 0x00, 0x00, } if err := sourceinfo.RegisterEncodedSourceInfo("desc_test1.proto", srcInfo); err != nil { panic(err) diff --git a/internal/testprotos/desc_test1.proto b/internal/testprotos/desc_test1.proto index 6b7d56b5..190179ab 100644 --- a/internal/testprotos/desc_test1.proto +++ b/internal/testprotos/desc_test1.proto @@ -117,3 +117,11 @@ extend AnotherTestMessage { // Comment for xui optional uint64 xui = 103; } + +// Comment for SomeService +service SomeService { + // Comment for SomeRPC + rpc SomeRPC(TestMessage) returns (TestMessage); + // Comment for SomeOtherRPC + rpc SomeOtherRPC(AnotherTestMessage) returns (AnotherTestMessage); +} \ No newline at end of file diff --git a/internal/testprotos/desc_test1.protoset b/internal/testprotos/desc_test1.protoset index 9ba433742a9584ac9a70a73015e09cefff9b5244..85de94358af557f72c2c2f4d1632344ce353ade9 100644 GIT binary patch delta 328 zcmaE3a@U-h>z4UO<_#P&Mza{XxP$X^Q-f2B$}*Evg{-;QLENAKXQ9atIV2dRK%|h6 z9~Tcu*uNwrwFo39H+dqf9Fr87;r^=1LA>E+sA&HU=gJA?9ih zb16{_JwQiraq)1mg46(YRPzYKcuYW^h&+tP4CIAsnR2OvjRUHz{>Frv>!ry?<_#R112}~lIhQDMu?ev-FqCc1;hHM|0IswND*ylh