I'm using gRPC to communicate between services and protobuf serialization. I haven't really used RPC before, and I'm wondering what the best structure is for the proto files? At the moment, I have all the proto files in one product with the following example layout:
protos/
identity/
models/
Member.proto
MemberService.proto
vault/
models/
Authentication.proto
Session.proto
HttpHeader.proto
AuthenticationService.proto
I figure that I should separate the models from the actual service definition so I can import a single model without needing the entire service.
Then, each service has the following layout
synatx "proto3";
import "models/Session.proto"
message GetRequest {
uint64 member_id;
}
message GetResponse {
Session session;
}
rpc AuthenticationService {
get (GetRequest) returns (GetResponse);
}
Is there a more canonical way to do this? Should I include the model "message" definitions in the same file as my service? It seems weird to import "../protos-gen/AuthenticationService.grpc.h
just to use a single Authentication.proto
model.