Skip to content

Commit 45e3aeb

Browse files
committed
Tweak gRPC support of older apis.
- Bring back the proto on MethodDescriptor. - Mark the two apis maintained for gRPC as deprecated to hopefully keep other folks from relying on them; and allow them to be removed in the future (maybe even before 2.0 is declared).
1 parent fab4191 commit 45e3aeb

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Sources/SwiftProtobufPluginLibrary/Descriptor.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ public final class DescriptorSet {
6868
///
6969
/// This is a legacy api since it requires the file to be found or it aborts.
7070
/// Mainly kept for grpc-swift compatibility.
71+
@available(*, deprecated, renamed: "fileDescriptor(named:)")
7172
public func lookupFileDescriptor(protoName name: String) -> FileDescriptor {
7273
return registry.fileDescriptor(named: name)!
7374
}
@@ -906,6 +907,12 @@ public final class MethodDescriptor {
906907
// Whether the server streams multiple responses.
907908
public let serverStreaming: Bool
908909

910+
/// The proto version of the descriptor that defines this method.
911+
@available(*, deprecated,
912+
message: "Use the properties directly or open a GitHub issue for something missing")
913+
public var proto: Google_Protobuf_MethodDescriptorProto { return _proto }
914+
private let _proto: Google_Protobuf_MethodDescriptorProto
915+
909916
fileprivate init(proto: Google_Protobuf_MethodDescriptorProto,
910917
index: Int,
911918
registry: Registry) {
@@ -916,6 +923,8 @@ public final class MethodDescriptor {
916923
// Can look these up because all the Descriptors are already registered
917924
self.inputType = registry.descriptor(named: proto.inputType)!
918925
self.outputType = registry.descriptor(named: proto.outputType)!
926+
927+
self._proto = proto
919928
}
920929

921930
fileprivate func bind(service: ServiceDescriptor, registry: Registry) {

0 commit comments

Comments
 (0)