You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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";
packageecho;
messageECHoRequest {
stringvalue=1;
// Number of extra times to echouint32extra_times=2;
}
messageEchoResponse {
repeatedstringvalues=1;
}
messageEchoStreamResponse {
stringvalue=1;
}
serviceEcho {
rpcEcho(ECHoRequest) returns (EchoResponse);
rpcEchoStream(ECHoRequest) returns (streamEchoStreamResponse);
}
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:
classEchoStub(betterproto.ServiceStub):
asyncdefecho(
self,
*,
timeout: Optional[float] =None,
deadline: Optional["Deadline"] =None,
metadata: Optional["MetadataLike"] =None
) ->"EchoResponse":
returnawaitself._unary_unary(
"/echo.Echo/Echo",
ec_ho_request, # <--- Bug: ec_ho_request is not provided as an argumentEchoResponse,
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.
The text was updated successfully, but these errors were encountered:
Co-authored-by: konstantin <konstantin.klein@hochfrequenz.de>
Co-authored-by: James Hilton-Balfe <gobot1234yt@gmail.com>
Fixesdanielgtaylor#427Fixesdanielgtaylor#438
bbonenfant
pushed a commit
to pachyderm/python-betterproto
that referenced
this issue
Jan 23, 2024
Co-authored-by: konstantin <konstantin.klein@hochfrequenz.de>
Co-authored-by: James Hilton-Balfe <gobot1234yt@gmail.com>
Fixesdanielgtaylor#427Fixesdanielgtaylor#438
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.
The text was updated successfully, but these errors were encountered: