Open simonjpartridge opened 3 years ago
Hi!
I experienced the same thing with snake_case
message names and lower-case message as well.
syntax = "proto3";
message test_req {
string name = 1;
}
message test_resp {}
service example {
rpc test(test_req) returns (test_resp);
}
Results in
class ExampleStub(betterproto.ServiceStub):
async def test(self) -> "TestResp":
request = TestReq()
return await self._unary_unary("/example/test", request, TestResp)
It fails identically with
message testreq
message Test_req
message Test_Req
message testReq
When using message Testreq
it behaves as expected:
class ExampleStub(betterproto.ServiceStub):
async def test(self, *, name: str = "") -> "TestResp":
request = Testreq()
request.name = name
return await self._unary_unary("/example/test", request, TestResp)
Protocol Buffers Version 3 Language Specification allows such identifiers in messageName and they are found in the wild.
Versions:
pip install --pre betterproto[compiler]
pip install git+https://github.com/danielgtaylor/python-betterproto.git#egg="betterproto[compiler]"
)
Version: betterproto==2.0.0b3
Requests with capital letters in the name seem to cause an issue with constructing methods. The request parameters are not added to the method. e.g
proto file:
generated class:
we would expect a
name
field in the request but it is not there