fullstorydev / grpcurl

Like cURL, but for gRPC: Command-line tool for interacting with gRPC servers
MIT License
10.75k stars 502 forks source link

Using grpCurl with repeated enum struct in a request #254

Closed Mayuresh-Gharat closed 3 years ago

Mayuresh-Gharat commented 3 years ago

I have a service like this :

service MyAclService {
  rpc CreateAcl(CreateAclRequest) returns (CreateAclResponse) {}
}

enum Operation {
  read = 0;
  write = 1;
}

enum Permission {
  allow = 0;
  deny = 1;
}

message OperationAndPermission {
  Operation operation = 1;
  Permission permission = 2;
}

message CreateAclRequest {
  string resourceName = 1;
  string principalName = 2;
  repeated OperationAndPermission operationsAndPermission = 3;
}

How can I use grpcurl to send CreateAclRequest to my service?

jhump commented 3 years ago

Are you asking what the JSON format would look like for a request?

Here's an example:

{
  "resourceName": "foo",
  "principalName": "bar",
  "operationsAndPermission": [
    {"operation": "read", "permission": "allow"},
    {"operation": "write", "permission": "deny"}
  ]
}
Mayuresh-Gharat commented 3 years ago

Hi, @jhump Thanks a lot. Yes, I was asking about the JSON format. This worked :)