salesforce / grpc-java-contrib

Useful extensions for the grpc-java library
BSD 3-Clause "New" or "Revised" License
220 stars 34 forks source link

ProtoTypeMap - Outer class incorrect if protobuf name is not lower underscore #163

Closed pelidan closed 3 years ago

pelidan commented 3 years ago

Hi,

the ProtoTypeMap mapping is incorrect when the protobuf file is named in a different convention.

how to reporoduce:

OuterClass.proto

syntax = "proto3";

package pkg;

message InnerClass {
    optional int32 value = 1;
}

ProtoTypeMapTest:

@Test
public void nestedTypeCamelCase() {
    assertProtoTypeMapping(".pkg.InnerClass", pkg.OuterClass.InnerClass.class);
}

[ERROR] ProtoTypeMapTest.nestedTypeCamelCase:68->assertProtoTypeMapping:112 expected:<"pkg.Outer[C]lass.InnerClass"> but was:<"pkg.Outer[c]lass.InnerClass">

cause: ProtoTypeMap:124 - this produces a different outer class name than the code that generates the Java classes

pelidan commented 3 years ago

The only solution that comes to my mind right now is checking whether it is a lower underscore format and skipping the conversion if not. A better one can exist though.

pelidan commented 3 years ago

created PR: https://github.com/salesforce/grpc-java-contrib/pull/165

rmichela commented 3 years ago

Good catch. 👀

pelidan commented 3 years ago

thanks, it's the root cause why we can't upgrade to Vert.x 4 (vertx-grpc), it took a while to find 😄

rmichela commented 3 years ago

Fixed in 1.2.0