Pythonize input_type name in py_input_message (#436)

Co-authored-by: konstantin <konstantin.klein@hochfrequenz.de>
Co-authored-by: James Hilton-Balfe <gobot1234yt@gmail.com>
Fixes https://github.com/danielgtaylor/python-betterproto/issues/427
Fixes https://github.com/danielgtaylor/python-betterproto/issues/438
This commit is contained in:
Wouter Horré 2022-12-02 23:18:48 +01:00 committed by GitHub
parent bfc0fac754
commit 0adcc9020c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 1 deletions

View File

@ -750,7 +750,7 @@ class ServiceMethodCompiler(ProtoContentBase):
# comparable with method.input_type
for msg in self.request.all_messages:
if (
msg.py_name == name.replace(".", "")
msg.py_name == pythonize_class_name(name.replace(".", ""))
and msg.output_file.package == package
):
return msg

View File

@ -19,6 +19,7 @@ services = {
"googletypes_service_returns_googletype",
"example_service",
"empty_service",
"service_uppercase",
}

View File

@ -0,0 +1,16 @@
syntax = "proto3";
package service_uppercase;
message DoTHINGRequest {
string name = 1;
repeated string comments = 2;
}
message DoTHINGResponse {
repeated string names = 1;
}
service Test {
rpc DoThing (DoTHINGRequest) returns (DoTHINGResponse);
}

View File

@ -0,0 +1,8 @@
import inspect
from tests.output_betterproto.service_uppercase import TestStub
def test_parameters():
sig = inspect.signature(TestStub.do_thing)
assert len(sig.parameters) == 5, "Expected 5 parameters"