Grpc.Tools generating camelCase classes
Hello, I am integrating a Java gRPC service in my .NET application but gRPC.Tools generates camelCase classes
I boiled down the proto file to minumum for the example
after building, the exampleRequest class is generated as it was written in the .proto file, and since the file was generated by a java server, its camelCase instead of PascalCase
my .csproj file:
Is there any way to force PascalCase names in the generated classes?
4 Replies
not directly a solution, but you might want to know that you're violating the protobuf style guidelines by using
camelCase
for message namesStyle Guide
Provides direction for how best to structure your proto definitions.
Thank you, I was not aware of that naming convention.
Since I was given the file by another department I will bring it up to them
I think that probably is the solution: I suspect there's no code to do case transformation for C#, because the casing of messages should already be PascalCase
Yeah, I don't see anything in the source to change the case of message names: https://github.com/protocolbuffers/protobuf/blob/fb78c09e1671eed5321bc41816e4656bf966cfa3/src/google/protobuf/compiler/csharp/names.cc#L73
(whereas there is conversion logic for fields: https://github.com/protocolbuffers/protobuf/blob/fb78c09e1671eed5321bc41816e4656bf966cfa3/src/google/protobuf/compiler/csharp/csharp_helpers.cc#L230)
Types in Java should also be in PascalCase though, no?