Now modify the above example.proto and change the casing of the request message from EchoRequest to EChoRequest with an upper case ECH at all 3 occurrences. (Note that the bug is not reproducable if you only change to EChoRequest with upper case EC but lower case h.)
syntax = "proto3";
package echo;
message ECHoRequest {
string value = 1;
// Number of extra times to echo
uint32 extra_times = 2;
}
message EchoResponse {
repeated string values = 1;
}
message EchoStreamResponse {
string value = 1;
}
service Echo {
rpc Echo(ECHoRequest) returns (EchoResponse);
rpc EchoStream(ECHoRequest) returns (stream EchoStreamResponse);
}
Repeat the next steps up to the code generation (don't forget to clean up lib before re-generating).
The newly generated lib/echo/__init__.py now still contains a class EchoStub:
class EchoStub(betterproto.ServiceStub):
async def echo(
self,
*,
timeout: Optional[float] = None,
deadline: Optional["Deadline"] = None,
metadata: Optional["MetadataLike"] = None
) -> "EchoResponse":
return await self._unary_unary(
"/echo.Echo/Echo",
ec_ho_request, # <--- Bug: ec_ho_request is not provided as an argument
EchoResponse,
timeout=timeout,
deadline=deadline,
metadata=metadata,
)
...
The ec_ho_request is undefined (other than echo_request in the MWE above) ❌
This leads to the following error at runtime:
TypeError: EchoStub.echo() takes 1 positional argument but 2 were given
Expected Behaviour
The code generation shall work for different casing, too.
Steps to reproduce
Install betterproto-2.0.0b5 + tooling:
other versions:
Create an
example.proto
Create the directory
Generate Python Code:
Check that
lib/echo/__init__.py
contains a classEchoStub
with a method that hasecho_request
as a positional argument ✔Up to here, this is just the MWE from
README.md
.Change Casing of Request Message Type Name
Now modify the above
example.proto
and change the casing of the request message fromEchoRequest
toEChoRequest
with an upper caseECH
at all 3 occurrences. (Note that the bug is not reproducable if you only change toEChoRequest
with upper caseEC
but lower caseh
.)Repeat the next steps up to the code generation (don't forget to clean up lib before re-generating).
The newly generated
lib/echo/__init__.py
now still contains a classEchoStub
:The
ec_ho_request
is undefined (other thanecho_request
in the MWE above) ❌This leads to the following error at runtime:
Expected Behaviour
The code generation shall work for different casing, too.