akka-grpc icon indicating copy to clipboard operation
akka-grpc copied to clipboard

Metadata message type in PowerAPI can cause a name collision

Open BillyAutrey opened this issue 2 years ago • 0 comments

Versions used

Akka gRPC 1.1.1, but this is also present in main and on 2.1.3/2.1.4.

Akka version: Unimportant, but 2.6.

Expected Behavior

  1. Create a proto file with Metadata as a message name.
  2. Compile an akka-grpc server in power mode (PowerApi)
  3. Everything should compile normally.

Actual Behavior

  1. Create a proto file with Metadata as a message name.
  2. When you compile akka-grpc server in power mode, an internal proto file collides: https://github.com/akka/akka-grpc/blob/main/codegen/src/main/twirl/templates/ScalaServer/PowerApiTrait.scala.txt#L19

We were able to verify that this can be fixed by foregoing the import here, and instead using the full path akka.grpc.scaladsl.Metadata on line 19. E.g.,

def @{method.nameSafe}(in: @method.parameterType, metadata: akka.grpc.scaladsl.Metadata)

BillyAutrey avatar Aug 01 '22 14:08 BillyAutrey