Skip to content

Commit

Permalink
Merge pull request #9 from armanbilge/fix/method-name
Browse files Browse the repository at this point in the history
Use correct `methodName` in generated code
  • Loading branch information
ChristopherDavenport committed Mar 10, 2023
2 parents 3f0250e + b30fcc5 commit 235e6ff
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class Http4sGrpcServicePrinter(service: ServiceDescriptor, di: DescriptorImplici
val encode = s"$Codec.codecForGenerated(_root_.${method.inputType.scalaType})"
val decode = s"$Codec.codecForGenerated(_root_.${method.outputType.scalaType})"
val serviceName = method.getService.getFullName
val methodName = method.name
val methodName = method.getName
s"""$ClientGrpc.${handleMethod(method)}($encode, $decode, "$serviceName", "$methodName")(client, baseUri)(request, ctx)"""
}

Expand All @@ -78,9 +78,9 @@ class Http4sGrpcServicePrinter(service: ServiceDescriptor, di: DescriptorImplici
val decode = s"$Codec.codecForGenerated(${method.inputType.scalaType})"
val encode = s"$Codec.codecForGenerated(${method.outputType.scalaType})"
val serviceName = method.getService.getFullName
val methodName = method.name
val methodName = method.getName

p.add(s""".combineK($ServerGrpc.${handleMethod(method)}($decode, $encode, "$serviceName", "$methodName")(serviceImpl.$methodName(_, _)))""")
p.add(s""".combineK($ServerGrpc.${handleMethod(method)}($decode, $encode, "$serviceName", "$methodName")(serviceImpl.${method.name}(_, _)))""")
}

private[this] def serviceMethods: PrinterEndo = _.seq(service.methods.map(serviceMethodSignature))
Expand Down
1 change: 1 addition & 0 deletions codegen/testing/src/main/protobuf/test_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ service TestService {
rpc clientStreaming (stream TestMessage) returns (TestMessage);
rpc serverStreaming (TestMessage) returns (stream TestMessage);
rpc bothStreaming (stream TestMessage) returns (stream TestMessage);
rpc Export (TestMessage) returns (TestMessage);
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ class TestServiceSuite extends CatsEffectSuite with ScalaCheckEffectSuite {

def bothStreaming(request: Stream[IO, TestMessage], ctx: Headers): Stream[IO, TestMessage] =
request

def `export`(request: TestMessage, ctx: Headers): IO[TestMessage] = IO(request)
}

implicit val arbitraryTestMessage: Arbitrary[TestMessage] = Arbitrary(
Expand Down

0 comments on commit 235e6ff

Please sign in to comment.