I'm trying to use gRPC to create a simple CRUD service, but I keep looking for messages with large overlaps.
This best describes an example:
message Todo {
string id = 1;
string content = 2;
string secret_content = 3;
}
service Todos {
rpc CreateTodo(CreateRequest) returns (CreateResponse) {}
rpc ReadTodo(ReadRequest) returns (ReadResponse) {}
}
message CreateRequest {
Todo todo
}
message CreateResponse {
Todo todo = 1;
}
message ReadRequest {
string id = 1;
}
message ReadResponse {
Todo todo = 1;
}
Is this a good approach to create a CRUD-like resource using gRPC? That is, having a single message ( Todo) representing the resource and wrapping this message in the types of responses / requests for each action.
If a Todo message has all the fields covered by all the requests / responses and does not set those that are not used by everyone?
source
share