danielgtaylor / danielgtaylor/python-betterproto

Mixed case request results in missing request parameters in generated code

Open
#271 1 comment 0 reactions 0 assignees View on GitHub
compiler-bug
Dominant language
Python
Stars
1.8k
Forks
234
PR merge metrics
No merged PRs in 30d

Description

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:
```
rpc TestCAPITALS(TestCAPITALSRequest) returns (TestCAPITALSResponse){}

message TestCAPITALSRequest{
string name = 1;
}

message TestCAPITALSResponse{}
```

generated class:
```
async def test_capitals(self) -> "TestCapitalsResponse":

request = TestCapitalsRequest()

return await self._unary_unary(
"/tumelo.transparency.v1.InstrumentPortfolioTransparency/TestCAPITALS",
request,
TestCapitalsResponse,
)
```
we would expect a `name` field in the request but it is not there

Contributor guide

Open the contributing guide

Research direction

Start with the mixed-case RPC and request definitions shown in the issue, then compare them with the generated async method and request construction. Trace the code-generation path that turns the RPC and message names into the method, and confirm that the generated request preserves the name field. Done means the example method includes the request parameter while retaining the RPC path and response type.

Written by the indexing model from the issue text.

Assessment

Tech stack
grpc, python
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.