Skip to content
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

gRPC CLI unable to generate all the necessary messages #2766

Closed
BuddhiWathsala opened this issue Mar 8, 2022 · 4 comments · Fixed by ballerina-platform/module-ballerina-grpc#904
Assignees
Labels
module/grpc Reason/Complex Issue occurred due to complex scenario. Team/PCM Protocol connector packages related issues Type/Bug

Comments

@BuddhiWathsala
Copy link
Contributor

Description:
When we develop gRPC applications with google.protobuf.Any type, we have to generate records for all the messages in a specified proto directory (i.e, --proto-path or a director as an --input).

Here is an example,
proto.zip

When I generate the relevant stubs for the above proto directory as below, it won't generate the Message2 definition, which I need to pass as a google.protobuf.Any type.

$ bal grpc --input=proto/foo/bar/service.proto --output=ballerina --mode service --proto-path=proto

In addition, neither the protoc command did not generate it. The protoc command even didn't generate the Message1.

$ protoc --go_out=go --go-grpc_out=go proto/foo/bar/service.proto --proto_path=proto

AFAIU, we can generate them separately and include them in a project. But in Ballerina, we cannot do that since we only have one descriptor for a given service. And that service definition cannot include descriptors other than the ones we generated. As they have mentioned here, the protoc compiler won't handle such cases. Only the gen tools do that.

However, when I use Java io.grpc:protoc-gen-grpc-java generation tool, it generates all the necessary messages, including Message1 and Message2. That is the behaviour we should implement in Ballerina CLI.

Sample Java code

Affected Versions:

  • Ballerina 2201.0.1

OS, DB, other environment details and versions:

  • macOS
@BuddhiWathsala BuddhiWathsala added Type/Bug module/grpc Team/PCM Protocol connector packages related issues labels Mar 8, 2022
@BuddhiWathsala
Copy link
Contributor Author

@shafreenAnfar @daneshk @MadhukaHarith92 @dilanSachi any input for this issue.

@BuddhiWathsala BuddhiWathsala self-assigned this Mar 9, 2022
@dilanSachi dilanSachi self-assigned this Jul 5, 2022
@dilanSachi
Copy link
Contributor

Currently, When we give a directory path instead of a proto file path to the input path, it generates the stub files for all the proto files. But it does not check inside the nested directories.

@daneshk
Copy link
Member

daneshk commented Jul 5, 2022

Shall we use solution 02 in the proposal to support nested directories, in [1]

Solution 02
Allow users to use wild cards as Go did.
bal grpc –input proto/**.proto –output ballerina-out
  1. Proposal: gRPC CLI Improvements #2794 (comment)

@github-actions
Copy link

github-actions bot commented Jul 8, 2022

This issue is NOT closed with a proper Reason/ label. Make sure to add proper reason label before closing. Please add or leave a comment with the proper reason label now.

      - Reason/EngineeringMistake - The issue occurred due to a mistake made in the past.
      - Reason/Regression - The issue has introduced a regression.
      - Reason/MultipleComponentInteraction - Issue occured due to interactions in multiple components.
      - Reason/Complex - Issue occurred due to complex scenario.
      - Reason/Invalid - Issue is invalid.
      - Reason/Other - None of the above cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module/grpc Reason/Complex Issue occurred due to complex scenario. Team/PCM Protocol connector packages related issues Type/Bug
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants