What is the purpose of the brackets {} after a gRPC method definition?

grpc

Solution

I'm not an expert but I will try to explain it

You can add custom options in your rpc definitions

For example if you use grpc-gateway that allows you to translate the RESTful API into gRPC

In this snippet I'm requesting the `body` field and the RESTful call will be in `/api/{client}` for example:

service Builder {
  rpc Generate(Request) returns (Response) {
    option (google.api.http) = {
      post: "/api/{Client}"
      body: "*"
    };
  }
}

You can see full reference here cloud.google.com/service-management/reference

Note: I took the reference link from the grpc-gateway repo

Problem

In gRPC you can define a method like ``` service HelloService { rpc SayHello (HelloRequest) returns (HelloResponse); } ``` or ``` service HelloService { rpc SayHello (HelloRequest) returns (HelloResponse) {} } ``` (from http://www.grpc.io/docs/guides/concepts.html#service-definition). I've looked through the docs and there doesn't seem to be anything you can put inside the brackets. So, given that I can terminate the definition with `;` what are that brackets for?

Original source

Related problems