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] Add sample client calls with dummy value to generated client file. #3131

Closed
daneshk opened this issue Jul 18, 2022 · 0 comments · Fixed by ballerina-platform/module-ballerina-grpc#952
Assignees
Labels
module/grpc Team/PCM Protocol connector packages related issues Type/Task

Comments

@daneshk
Copy link
Member

daneshk commented Jul 18, 2022

Description:
Currently, when we are generating the code for below proto definition in client mode, the generated client looks like the below,

  • helloworld.proto
 syntax = "proto3";

 package helloworld;

 service Greeter {
   rpc sayHello(HelloRequest) returns (HelloReply);
 }

 message HelloRequest {
   string name = 1;
 }

 message HelloReply {
   string message = 1;
 }
  • Generated greeter_client.bal
GreeterClient ep = check new ("http://localhost:9090");

public function main() {
}

The proposed generated client code is add sample call with dummy data like the below,

import ballerina/io;
GreeterClient ep = check new ("http://localhost:9090");

public function main() returns error? {

    // Sample call to the Greeter/sayHello function.
    HelloRequest helloRequest = {name: "Sam"};
    HelloReply helloReply = check ep->sayHello(helloRequest);
    io:println(helloReply);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module/grpc Team/PCM Protocol connector packages related issues Type/Task
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants