1

I have a method that I would like defined called FindAll which requires no parameters. ProtoC is complaining.

Expected type name.

This is for line:
rpc findAll () returns (BenchmarksList);

syntax = "proto3";

package helloWorldGRPC;

service HelloWorldGRPCService {
    rpc findById (BenchmarksById) returns (Benchmarks);
    rpc findAll () returns (BenchmarksList);
}

message BenchmarksById {
    string id = 1;
}

message BenchmarksList {
    repeated Benchmarks benchmarks = 1;
}

message Benchmarks {
    string trans_id = 1;
    string protocol = 2;
    string database = 3;
    string updated_at = 4;
    string created_at = 5;
    repeated Action actions = 6;
}

message Action {
    string trans_id = 1;
    int32 payload_length = 2;
    string payload = 3;
    string status = 4;
    string updated_at = 5;
    string created_at = 6;
}
Greg Finzer
  • 6,714
  • 21
  • 80
  • 125
  • 2
    Check [this](https://stackoverflow.com/questions/31768665/can-i-define-a-grpc-call-with-a-null-request-or-response) – for_stack Jun 02 '20 at 02:59

1 Answers1

0

The preferred way is to pass Empty - as tooling may recognize and optimize for that scenario. But in reality, there is nothing "special" about that type and any message - empty or otherwise - will suffice.

Marc Gravell
  • 1,026,079
  • 266
  • 2,566
  • 2,900