Browse Source

Inline service name into the generated path (#633)

Motivation:

We gave users the option to customise how the path for the RPC was
formatted. The protocol allows this but discourages it.

Modifications:

- Inline the service name into the generated code
- Remove GRPCServiceClient and just use GRPCClient
- Update generated code

Result:

- Users are now discouraged in the strongest possible way to not use
  custom paths.
- Generated code is simpler.
George Barnett 6 years ago
parent
commit
26858379cd

+ 5 - 6
Sources/Examples/Echo/Model/echo.grpc.swift

@@ -35,9 +35,8 @@ public protocol Echo_EchoService {
   func update(callOptions: CallOptions?, handler: @escaping (Echo_EchoResponse) -> Void) -> BidirectionalStreamingCall<Echo_EchoRequest, Echo_EchoResponse>
 }
 
-public final class Echo_EchoServiceClient: GRPCServiceClient, Echo_EchoService {
+public final class Echo_EchoServiceClient: GRPCClient, Echo_EchoService {
   public let connection: ClientConnection
-  public var serviceName: String { return "echo.Echo" }
   public var defaultCallOptions: CallOptions
 
   /// Creates a client for the echo.Echo service.
@@ -57,7 +56,7 @@ public final class Echo_EchoServiceClient: GRPCServiceClient, Echo_EchoService {
   ///   - callOptions: Call options; `self.defaultCallOptions` is used if `nil`.
   /// - Returns: A `UnaryCall` with futures for the metadata, status and response.
   public func get(_ request: Echo_EchoRequest, callOptions: CallOptions? = nil) -> UnaryCall<Echo_EchoRequest, Echo_EchoResponse> {
-    return self.makeUnaryCall(path: self.path(forMethod: "Get"),
+    return self.makeUnaryCall(path: "/echo.Echo/Get",
                               request: request,
                               callOptions: callOptions ?? self.defaultCallOptions)
   }
@@ -70,7 +69,7 @@ public final class Echo_EchoServiceClient: GRPCServiceClient, Echo_EchoService {
   ///   - handler: A closure called when each response is received from the server.
   /// - Returns: A `ServerStreamingCall` with futures for the metadata and status.
   public func expand(_ request: Echo_EchoRequest, callOptions: CallOptions? = nil, handler: @escaping (Echo_EchoResponse) -> Void) -> ServerStreamingCall<Echo_EchoRequest, Echo_EchoResponse> {
-    return self.makeServerStreamingCall(path: self.path(forMethod: "Expand"),
+    return self.makeServerStreamingCall(path: "/echo.Echo/Expand",
                                         request: request,
                                         callOptions: callOptions ?? self.defaultCallOptions,
                                         handler: handler)
@@ -85,7 +84,7 @@ public final class Echo_EchoServiceClient: GRPCServiceClient, Echo_EchoService {
   ///   - callOptions: Call options; `self.defaultCallOptions` is used if `nil`.
   /// - Returns: A `ClientStreamingCall` with futures for the metadata, status and response.
   public func collect(callOptions: CallOptions? = nil) -> ClientStreamingCall<Echo_EchoRequest, Echo_EchoResponse> {
-    return self.makeClientStreamingCall(path: self.path(forMethod: "Collect"),
+    return self.makeClientStreamingCall(path: "/echo.Echo/Collect",
                                         callOptions: callOptions ?? self.defaultCallOptions)
   }
 
@@ -99,7 +98,7 @@ public final class Echo_EchoServiceClient: GRPCServiceClient, Echo_EchoService {
   ///   - handler: A closure called when each response is received from the server.
   /// - Returns: A `ClientStreamingCall` with futures for the metadata and status.
   public func update(callOptions: CallOptions? = nil, handler: @escaping (Echo_EchoResponse) -> Void) -> BidirectionalStreamingCall<Echo_EchoRequest, Echo_EchoResponse> {
-    return self.makeBidirectionalStreamingCall(path: self.path(forMethod: "Update"),
+    return self.makeBidirectionalStreamingCall(path: "/echo.Echo/Update",
                                                callOptions: callOptions ?? self.defaultCallOptions,
                                                handler: handler)
   }

+ 1 - 1
Sources/Examples/Echo/Model/echo.pb.swift

@@ -3,7 +3,7 @@
 // Generated by the Swift generator plugin for the protocol buffer compiler.
 // Source: echo.proto
 //
-// For information on using the generated types, please see the documenation:
+// For information on using the generated types, please see the documentation:
 //   https://github.com/apple/swift-protobuf/
 
 // Copyright (c) 2015, Google Inc.

+ 2 - 3
Sources/Examples/HelloWorld/Model/helloworld.grpc.swift

@@ -32,9 +32,8 @@ public protocol Helloworld_GreeterService {
   func sayHello(_ request: Helloworld_HelloRequest, callOptions: CallOptions?) -> UnaryCall<Helloworld_HelloRequest, Helloworld_HelloReply>
 }
 
-public final class Helloworld_GreeterServiceClient: GRPCServiceClient, Helloworld_GreeterService {
+public final class Helloworld_GreeterServiceClient: GRPCClient, Helloworld_GreeterService {
   public let connection: ClientConnection
-  public var serviceName: String { return "helloworld.Greeter" }
   public var defaultCallOptions: CallOptions
 
   /// Creates a client for the helloworld.Greeter service.
@@ -54,7 +53,7 @@ public final class Helloworld_GreeterServiceClient: GRPCServiceClient, Helloworl
   ///   - callOptions: Call options; `self.defaultCallOptions` is used if `nil`.
   /// - Returns: A `UnaryCall` with futures for the metadata, status and response.
   public func sayHello(_ request: Helloworld_HelloRequest, callOptions: CallOptions? = nil) -> UnaryCall<Helloworld_HelloRequest, Helloworld_HelloReply> {
-    return self.makeUnaryCall(path: self.path(forMethod: "SayHello"),
+    return self.makeUnaryCall(path: "/helloworld.Greeter/SayHello",
                               request: request,
                               callOptions: callOptions ?? self.defaultCallOptions)
   }

+ 1 - 1
Sources/Examples/HelloWorld/Model/helloworld.pb.swift

@@ -3,7 +3,7 @@
 // Generated by the Swift generator plugin for the protocol buffer compiler.
 // Source: helloworld.proto
 //
-// For information on using the generated types, please see the documenation:
+// For information on using the generated types, please see the documentation:
 //   https://github.com/apple/swift-protobuf/
 
 // Copyright 2015 gRPC authors.

+ 5 - 6
Sources/Examples/RouteGuide/Model/route_guide.grpc.swift

@@ -35,9 +35,8 @@ public protocol Routeguide_RouteGuideService {
   func routeChat(callOptions: CallOptions?, handler: @escaping (Routeguide_RouteNote) -> Void) -> BidirectionalStreamingCall<Routeguide_RouteNote, Routeguide_RouteNote>
 }
 
-public final class Routeguide_RouteGuideServiceClient: GRPCServiceClient, Routeguide_RouteGuideService {
+public final class Routeguide_RouteGuideServiceClient: GRPCClient, Routeguide_RouteGuideService {
   public let connection: ClientConnection
-  public var serviceName: String { return "routeguide.RouteGuide" }
   public var defaultCallOptions: CallOptions
 
   /// Creates a client for the routeguide.RouteGuide service.
@@ -57,7 +56,7 @@ public final class Routeguide_RouteGuideServiceClient: GRPCServiceClient, Routeg
   ///   - callOptions: Call options; `self.defaultCallOptions` is used if `nil`.
   /// - Returns: A `UnaryCall` with futures for the metadata, status and response.
   public func getFeature(_ request: Routeguide_Point, callOptions: CallOptions? = nil) -> UnaryCall<Routeguide_Point, Routeguide_Feature> {
-    return self.makeUnaryCall(path: self.path(forMethod: "GetFeature"),
+    return self.makeUnaryCall(path: "/routeguide.RouteGuide/GetFeature",
                               request: request,
                               callOptions: callOptions ?? self.defaultCallOptions)
   }
@@ -70,7 +69,7 @@ public final class Routeguide_RouteGuideServiceClient: GRPCServiceClient, Routeg
   ///   - handler: A closure called when each response is received from the server.
   /// - Returns: A `ServerStreamingCall` with futures for the metadata and status.
   public func listFeatures(_ request: Routeguide_Rectangle, callOptions: CallOptions? = nil, handler: @escaping (Routeguide_Feature) -> Void) -> ServerStreamingCall<Routeguide_Rectangle, Routeguide_Feature> {
-    return self.makeServerStreamingCall(path: self.path(forMethod: "ListFeatures"),
+    return self.makeServerStreamingCall(path: "/routeguide.RouteGuide/ListFeatures",
                                         request: request,
                                         callOptions: callOptions ?? self.defaultCallOptions,
                                         handler: handler)
@@ -85,7 +84,7 @@ public final class Routeguide_RouteGuideServiceClient: GRPCServiceClient, Routeg
   ///   - callOptions: Call options; `self.defaultCallOptions` is used if `nil`.
   /// - Returns: A `ClientStreamingCall` with futures for the metadata, status and response.
   public func recordRoute(callOptions: CallOptions? = nil) -> ClientStreamingCall<Routeguide_Point, Routeguide_RouteSummary> {
-    return self.makeClientStreamingCall(path: self.path(forMethod: "RecordRoute"),
+    return self.makeClientStreamingCall(path: "/routeguide.RouteGuide/RecordRoute",
                                         callOptions: callOptions ?? self.defaultCallOptions)
   }
 
@@ -99,7 +98,7 @@ public final class Routeguide_RouteGuideServiceClient: GRPCServiceClient, Routeg
   ///   - handler: A closure called when each response is received from the server.
   /// - Returns: A `ClientStreamingCall` with futures for the metadata and status.
   public func routeChat(callOptions: CallOptions? = nil, handler: @escaping (Routeguide_RouteNote) -> Void) -> BidirectionalStreamingCall<Routeguide_RouteNote, Routeguide_RouteNote> {
-    return self.makeBidirectionalStreamingCall(path: self.path(forMethod: "RouteChat"),
+    return self.makeBidirectionalStreamingCall(path: "/routeguide.RouteGuide/RouteChat",
                                                callOptions: callOptions ?? self.defaultCallOptions,
                                                handler: handler)
   }

+ 1 - 1
Sources/Examples/RouteGuide/Model/route_guide.pb.swift

@@ -3,7 +3,7 @@
 // Generated by the Swift generator plugin for the protocol buffer compiler.
 // Source: route_guide.proto
 //
-// For information on using the generated types, please see the documenation:
+// For information on using the generated types, please see the documentation:
 //   https://github.com/apple/swift-protobuf/
 
 // Copyright 2015 gRPC authors.

+ 0 - 21
Sources/GRPC/GRPCClient.swift

@@ -85,27 +85,6 @@ extension GRPCClient {
   }
 }
 
-/// A GRPC client for a named service.
-public protocol GRPCServiceClient: GRPCClient {
-  /// Name of the service this client is for (e.g. "echo.Echo").
-  var serviceName: String { get }
-
-  /// Creates a path for a given method on this service.
-  ///
-  /// This defaults to "/Service-Name/Method-Name" but may be overriden if consumers
-  /// require a different path format.
-  ///
-  /// - Parameter method: name of method to return a path for.
-  /// - Returns: path for the given method used in gRPC request headers.
-  func path(forMethod method: String) -> String
-}
-
-extension GRPCServiceClient {
-  public func path(forMethod method: String) -> String {
-    return "/\(self.serviceName)/\(method)"
-  }
-}
-
 /// A client which has no generated stubs and may be used to create gRPC calls manually.
 /// See `GRPCClient` for details.
 public final class AnyServiceClient: GRPCClient {

+ 1 - 1
Sources/GRPCInteroperabilityTestModels/Generated/empty.pb.swift

@@ -3,7 +3,7 @@
 // Generated by the Swift generator plugin for the protocol buffer compiler.
 // Source: src/proto/grpc/testing/empty.proto
 //
-// For information on using the generated types, please see the documenation:
+// For information on using the generated types, please see the documentation:
 //   https://github.com/apple/swift-protobuf/
 
 // Copyright 2015 gRPC authors.

+ 1 - 1
Sources/GRPCInteroperabilityTestModels/Generated/messages.pb.swift

@@ -3,7 +3,7 @@
 // Generated by the Swift generator plugin for the protocol buffer compiler.
 // Source: src/proto/grpc/testing/messages.proto
 //
-// For information on using the generated types, please see the documenation:
+// For information on using the generated types, please see the documentation:
 //   https://github.com/apple/swift-protobuf/
 
 // Copyright 2015-2016 gRPC authors.

+ 14 - 17
Sources/GRPCInteroperabilityTestModels/Generated/test.grpc.swift

@@ -39,9 +39,8 @@ public protocol Grpc_Testing_TestServiceService {
   func unimplementedCall(_ request: Grpc_Testing_Empty, callOptions: CallOptions?) -> UnaryCall<Grpc_Testing_Empty, Grpc_Testing_Empty>
 }
 
-public final class Grpc_Testing_TestServiceServiceClient: GRPCServiceClient, Grpc_Testing_TestServiceService {
+public final class Grpc_Testing_TestServiceServiceClient: GRPCClient, Grpc_Testing_TestServiceService {
   public let connection: ClientConnection
-  public var serviceName: String { return "grpc.testing.TestService" }
   public var defaultCallOptions: CallOptions
 
   /// Creates a client for the grpc.testing.TestService service.
@@ -61,7 +60,7 @@ public final class Grpc_Testing_TestServiceServiceClient: GRPCServiceClient, Grp
   ///   - callOptions: Call options; `self.defaultCallOptions` is used if `nil`.
   /// - Returns: A `UnaryCall` with futures for the metadata, status and response.
   public func emptyCall(_ request: Grpc_Testing_Empty, callOptions: CallOptions? = nil) -> UnaryCall<Grpc_Testing_Empty, Grpc_Testing_Empty> {
-    return self.makeUnaryCall(path: self.path(forMethod: "EmptyCall"),
+    return self.makeUnaryCall(path: "/grpc.testing.TestService/EmptyCall",
                               request: request,
                               callOptions: callOptions ?? self.defaultCallOptions)
   }
@@ -73,7 +72,7 @@ public final class Grpc_Testing_TestServiceServiceClient: GRPCServiceClient, Grp
   ///   - callOptions: Call options; `self.defaultCallOptions` is used if `nil`.
   /// - Returns: A `UnaryCall` with futures for the metadata, status and response.
   public func unaryCall(_ request: Grpc_Testing_SimpleRequest, callOptions: CallOptions? = nil) -> UnaryCall<Grpc_Testing_SimpleRequest, Grpc_Testing_SimpleResponse> {
-    return self.makeUnaryCall(path: self.path(forMethod: "UnaryCall"),
+    return self.makeUnaryCall(path: "/grpc.testing.TestService/UnaryCall",
                               request: request,
                               callOptions: callOptions ?? self.defaultCallOptions)
   }
@@ -85,7 +84,7 @@ public final class Grpc_Testing_TestServiceServiceClient: GRPCServiceClient, Grp
   ///   - callOptions: Call options; `self.defaultCallOptions` is used if `nil`.
   /// - Returns: A `UnaryCall` with futures for the metadata, status and response.
   public func cacheableUnaryCall(_ request: Grpc_Testing_SimpleRequest, callOptions: CallOptions? = nil) -> UnaryCall<Grpc_Testing_SimpleRequest, Grpc_Testing_SimpleResponse> {
-    return self.makeUnaryCall(path: self.path(forMethod: "CacheableUnaryCall"),
+    return self.makeUnaryCall(path: "/grpc.testing.TestService/CacheableUnaryCall",
                               request: request,
                               callOptions: callOptions ?? self.defaultCallOptions)
   }
@@ -98,7 +97,7 @@ public final class Grpc_Testing_TestServiceServiceClient: GRPCServiceClient, Grp
   ///   - handler: A closure called when each response is received from the server.
   /// - Returns: A `ServerStreamingCall` with futures for the metadata and status.
   public func streamingOutputCall(_ request: Grpc_Testing_StreamingOutputCallRequest, callOptions: CallOptions? = nil, handler: @escaping (Grpc_Testing_StreamingOutputCallResponse) -> Void) -> ServerStreamingCall<Grpc_Testing_StreamingOutputCallRequest, Grpc_Testing_StreamingOutputCallResponse> {
-    return self.makeServerStreamingCall(path: self.path(forMethod: "StreamingOutputCall"),
+    return self.makeServerStreamingCall(path: "/grpc.testing.TestService/StreamingOutputCall",
                                         request: request,
                                         callOptions: callOptions ?? self.defaultCallOptions,
                                         handler: handler)
@@ -113,7 +112,7 @@ public final class Grpc_Testing_TestServiceServiceClient: GRPCServiceClient, Grp
   ///   - callOptions: Call options; `self.defaultCallOptions` is used if `nil`.
   /// - Returns: A `ClientStreamingCall` with futures for the metadata, status and response.
   public func streamingInputCall(callOptions: CallOptions? = nil) -> ClientStreamingCall<Grpc_Testing_StreamingInputCallRequest, Grpc_Testing_StreamingInputCallResponse> {
-    return self.makeClientStreamingCall(path: self.path(forMethod: "StreamingInputCall"),
+    return self.makeClientStreamingCall(path: "/grpc.testing.TestService/StreamingInputCall",
                                         callOptions: callOptions ?? self.defaultCallOptions)
   }
 
@@ -127,7 +126,7 @@ public final class Grpc_Testing_TestServiceServiceClient: GRPCServiceClient, Grp
   ///   - handler: A closure called when each response is received from the server.
   /// - Returns: A `ClientStreamingCall` with futures for the metadata and status.
   public func fullDuplexCall(callOptions: CallOptions? = nil, handler: @escaping (Grpc_Testing_StreamingOutputCallResponse) -> Void) -> BidirectionalStreamingCall<Grpc_Testing_StreamingOutputCallRequest, Grpc_Testing_StreamingOutputCallResponse> {
-    return self.makeBidirectionalStreamingCall(path: self.path(forMethod: "FullDuplexCall"),
+    return self.makeBidirectionalStreamingCall(path: "/grpc.testing.TestService/FullDuplexCall",
                                                callOptions: callOptions ?? self.defaultCallOptions,
                                                handler: handler)
   }
@@ -142,7 +141,7 @@ public final class Grpc_Testing_TestServiceServiceClient: GRPCServiceClient, Grp
   ///   - handler: A closure called when each response is received from the server.
   /// - Returns: A `ClientStreamingCall` with futures for the metadata and status.
   public func halfDuplexCall(callOptions: CallOptions? = nil, handler: @escaping (Grpc_Testing_StreamingOutputCallResponse) -> Void) -> BidirectionalStreamingCall<Grpc_Testing_StreamingOutputCallRequest, Grpc_Testing_StreamingOutputCallResponse> {
-    return self.makeBidirectionalStreamingCall(path: self.path(forMethod: "HalfDuplexCall"),
+    return self.makeBidirectionalStreamingCall(path: "/grpc.testing.TestService/HalfDuplexCall",
                                                callOptions: callOptions ?? self.defaultCallOptions,
                                                handler: handler)
   }
@@ -154,7 +153,7 @@ public final class Grpc_Testing_TestServiceServiceClient: GRPCServiceClient, Grp
   ///   - callOptions: Call options; `self.defaultCallOptions` is used if `nil`.
   /// - Returns: A `UnaryCall` with futures for the metadata, status and response.
   public func unimplementedCall(_ request: Grpc_Testing_Empty, callOptions: CallOptions? = nil) -> UnaryCall<Grpc_Testing_Empty, Grpc_Testing_Empty> {
-    return self.makeUnaryCall(path: self.path(forMethod: "UnimplementedCall"),
+    return self.makeUnaryCall(path: "/grpc.testing.TestService/UnimplementedCall",
                               request: request,
                               callOptions: callOptions ?? self.defaultCallOptions)
   }
@@ -166,9 +165,8 @@ public protocol Grpc_Testing_UnimplementedServiceService {
   func unimplementedCall(_ request: Grpc_Testing_Empty, callOptions: CallOptions?) -> UnaryCall<Grpc_Testing_Empty, Grpc_Testing_Empty>
 }
 
-public final class Grpc_Testing_UnimplementedServiceServiceClient: GRPCServiceClient, Grpc_Testing_UnimplementedServiceService {
+public final class Grpc_Testing_UnimplementedServiceServiceClient: GRPCClient, Grpc_Testing_UnimplementedServiceService {
   public let connection: ClientConnection
-  public var serviceName: String { return "grpc.testing.UnimplementedService" }
   public var defaultCallOptions: CallOptions
 
   /// Creates a client for the grpc.testing.UnimplementedService service.
@@ -188,7 +186,7 @@ public final class Grpc_Testing_UnimplementedServiceServiceClient: GRPCServiceCl
   ///   - callOptions: Call options; `self.defaultCallOptions` is used if `nil`.
   /// - Returns: A `UnaryCall` with futures for the metadata, status and response.
   public func unimplementedCall(_ request: Grpc_Testing_Empty, callOptions: CallOptions? = nil) -> UnaryCall<Grpc_Testing_Empty, Grpc_Testing_Empty> {
-    return self.makeUnaryCall(path: self.path(forMethod: "UnimplementedCall"),
+    return self.makeUnaryCall(path: "/grpc.testing.UnimplementedService/UnimplementedCall",
                               request: request,
                               callOptions: callOptions ?? self.defaultCallOptions)
   }
@@ -201,9 +199,8 @@ public protocol Grpc_Testing_ReconnectServiceService {
   func stop(_ request: Grpc_Testing_Empty, callOptions: CallOptions?) -> UnaryCall<Grpc_Testing_Empty, Grpc_Testing_ReconnectInfo>
 }
 
-public final class Grpc_Testing_ReconnectServiceServiceClient: GRPCServiceClient, Grpc_Testing_ReconnectServiceService {
+public final class Grpc_Testing_ReconnectServiceServiceClient: GRPCClient, Grpc_Testing_ReconnectServiceService {
   public let connection: ClientConnection
-  public var serviceName: String { return "grpc.testing.ReconnectService" }
   public var defaultCallOptions: CallOptions
 
   /// Creates a client for the grpc.testing.ReconnectService service.
@@ -223,7 +220,7 @@ public final class Grpc_Testing_ReconnectServiceServiceClient: GRPCServiceClient
   ///   - callOptions: Call options; `self.defaultCallOptions` is used if `nil`.
   /// - Returns: A `UnaryCall` with futures for the metadata, status and response.
   public func start(_ request: Grpc_Testing_ReconnectParams, callOptions: CallOptions? = nil) -> UnaryCall<Grpc_Testing_ReconnectParams, Grpc_Testing_Empty> {
-    return self.makeUnaryCall(path: self.path(forMethod: "Start"),
+    return self.makeUnaryCall(path: "/grpc.testing.ReconnectService/Start",
                               request: request,
                               callOptions: callOptions ?? self.defaultCallOptions)
   }
@@ -235,7 +232,7 @@ public final class Grpc_Testing_ReconnectServiceServiceClient: GRPCServiceClient
   ///   - callOptions: Call options; `self.defaultCallOptions` is used if `nil`.
   /// - Returns: A `UnaryCall` with futures for the metadata, status and response.
   public func stop(_ request: Grpc_Testing_Empty, callOptions: CallOptions? = nil) -> UnaryCall<Grpc_Testing_Empty, Grpc_Testing_ReconnectInfo> {
-    return self.makeUnaryCall(path: self.path(forMethod: "Stop"),
+    return self.makeUnaryCall(path: "/grpc.testing.ReconnectService/Stop",
                               request: request,
                               callOptions: callOptions ?? self.defaultCallOptions)
   }

+ 1 - 1
Sources/GRPCInteroperabilityTestModels/Generated/test.pb.swift

@@ -3,7 +3,7 @@
 // Generated by the Swift generator plugin for the protocol buffer compiler.
 // Source: src/proto/grpc/testing/test.proto
 //
-// For information on using the generated types, please see the documenation:
+// For information on using the generated types, please see the documentation:
 //   https://github.com/apple/swift-protobuf/
 
 // Copyright 2015-2016 gRPC authors.

+ 5 - 6
Sources/protoc-gen-grpc-swift/Generator-Client.swift

@@ -50,10 +50,9 @@ extension Generator {
   }
 
   private func printServiceClientImplementation() {
-    println("\(access) final class \(serviceClassName)Client: GRPCServiceClient, \(serviceClassName) {")
+    println("\(access) final class \(serviceClassName)Client: GRPCClient, \(serviceClassName) {")
     indent()
     println("\(access) let connection: ClientConnection")
-    println("\(access) var serviceName: String { return \"\(servicePath)\" }")
     println("\(access) var defaultCallOptions: CallOptions")
     println()
     println("/// Creates a client for the \(servicePath) service.")
@@ -81,7 +80,7 @@ extension Generator {
         println("/// - Returns: A `UnaryCall` with futures for the metadata, status and response.")
         println("\(access) func \(methodFunctionName)(_ request: \(methodInputName), callOptions: CallOptions? = nil) -> UnaryCall<\(methodInputName), \(methodOutputName)> {")
         indent()
-        println("return self.makeUnaryCall(path: self.path(forMethod: \"\(method.name)\"),")
+        println("return self.makeUnaryCall(path: \"/\(servicePath)/\(method.name)\",")
         println("                          request: request,")
         println("                          callOptions: callOptions ?? self.defaultCallOptions)")
         outdent()
@@ -97,7 +96,7 @@ extension Generator {
         println("/// - Returns: A `ServerStreamingCall` with futures for the metadata and status.")
         println("\(access) func \(methodFunctionName)(_ request: \(methodInputName), callOptions: CallOptions? = nil, handler: @escaping (\(methodOutputName)) -> Void) -> ServerStreamingCall<\(methodInputName), \(methodOutputName)> {")
         indent()
-        println("return self.makeServerStreamingCall(path: self.path(forMethod: \"\(method.name)\"),")
+        println("return self.makeServerStreamingCall(path: \"/\(servicePath)/\(method.name)\",")
         println("                                    request: request,")
         println("                                    callOptions: callOptions ?? self.defaultCallOptions,")
         println("                                    handler: handler)")
@@ -114,7 +113,7 @@ extension Generator {
         println("/// - Returns: A `ClientStreamingCall` with futures for the metadata, status and response.")
         println("\(access) func \(methodFunctionName)(callOptions: CallOptions? = nil) -> ClientStreamingCall<\(methodInputName), \(methodOutputName)> {")
         indent()
-        println("return self.makeClientStreamingCall(path: self.path(forMethod: \"\(method.name)\"),")
+        println("return self.makeClientStreamingCall(path: \"/\(servicePath)/\(method.name)\",")
         println("                                    callOptions: callOptions ?? self.defaultCallOptions)")
         outdent()
         println("}")
@@ -130,7 +129,7 @@ extension Generator {
         println("/// - Returns: A `ClientStreamingCall` with futures for the metadata and status.")
         println("\(access) func \(methodFunctionName)(callOptions: CallOptions? = nil, handler: @escaping (\(methodOutputName)) -> Void) -> BidirectionalStreamingCall<\(methodInputName), \(methodOutputName)> {")
         indent()
-        println("return self.makeBidirectionalStreamingCall(path: self.path(forMethod: \"\(method.name)\"),")
+        println("return self.makeBidirectionalStreamingCall(path: \"/\(servicePath)/\(method.name)\",")
         println("                                           callOptions: callOptions ?? self.defaultCallOptions,")
         println("                                           handler: handler)")
         outdent()