Skip to content

Service stub method generates without rpc parameter sometimes. #427

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
adriangaro opened this issue Sep 27, 2022 · 6 comments · Fixed by #436
Closed

Service stub method generates without rpc parameter sometimes. #427

adriangaro opened this issue Sep 27, 2022 · 6 comments · Fixed by #436

Comments

@adriangaro
Copy link

adriangaro commented Sep 27, 2022

As the title says, got the following code generated, generate_geo_condition_sql_request missing from the method signature. From a quick look in code seems that sometimes the message does not exist in ServiceMethodCompiler.request.all_messages, py_input_message returning none and thus the jinja template not writing it.

class SqlStub(betterproto.ServiceStub):
    async def geo_conditions(
        self,
        *,
        timeout: Optional[float] = None,
        deadline: Optional["Deadline"] = None,
        metadata: Optional["MetadataLike"] = None
    ) -> "GenerateSqlResponse":
        return await self._unary_unary(
            "/csm.shaihulud.sql.SQL/geo_conditions",
            generate_geo_condition_sql_request,
            GenerateSqlResponse,
            timeout=timeout,
            deadline=deadline,
            metadata=metadata,
        )

Proto:

message GenerateGeoConditionSQLRequest {
  csm.common.RequestHeader header = 1;
  GenerateGeoConditionSQL payload = 2;
}
...
  
service SQL {
  rpc geo_conditions(GenerateGeoConditionSQLRequest) returns (GenerateSQLResponse);
  ...
}

Other grpc services work fine so am not sure what is causing in this case. Betterproto version 2.0.0beta5

@AlexanderZender
Copy link

Can subscribe to this, usually the first method in the stub is missing something

@paul-HDD
Copy link

paul-HDD commented Oct 9, 2022

Same here !

@AlexanderZender
Copy link

I found the issue or solution(?). @paul-HDD @adriangaro
When entering message class names or services and using capital letters 2 or 3 in a row this happens
change
GenerateGeoConditionSQLRequest -> GenerateGeoConditionSqlRequest
GenerateSQLResponse -> GenerateSqlResponse

this should fix the missing parameters, never more than 1 capital letter in a row is my personal rule now

@paul-HDD
Copy link

Thanks @AlexanderZender ! Confirmed this work locally for me.
Sounds like an issue to me as I cannot change the proto file 😓

wouterh added a commit to wouterh/python-betterproto that referenced this issue Oct 24, 2022
wouterh added a commit to wouterh/python-betterproto that referenced this issue Oct 24, 2022
wouterh added a commit to wouterh/python-betterproto that referenced this issue Oct 24, 2022
@hf-kklein
Copy link
Contributor

When entering message class names or services and using capital letters 2 or 3 in a row this happens
change

Can confirm. The problem is the casing. For a MWE see #438

@wpdonders
Copy link

Will be fixed by #436

Gobot1234 pushed a commit that referenced this issue Dec 2, 2022
Co-authored-by: konstantin <[email protected]>
Co-authored-by: James Hilton-Balfe <[email protected]>
Fixes #427
Fixes #438
bbonenfant pushed a commit to pachyderm/python-betterproto that referenced this issue Jan 23, 2024
bbonenfant pushed a commit to pachyderm/python-betterproto that referenced this issue Jan 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants