This is my proto file:
import "google/protobuf/struct.proto";
service Renderer {
rpc Render(Request) returns (Response) {}
}
message Request {
string template = 1;
string locale = 2;
google.protobuf.Struct variables = 3;
}
In the following function:
func (s *Server) Render(
ctx context.Context,
message *Request,
) (*Response, error) {
fmt.Println(message.Variables.AsMap()) // is always empty
return &Response{}, nil
}
the variables field is always empty even when I send this to the server:
{
"template": "template_name",
"locale": "pt",
"variables": {
"foo": "bar"
}
}
I'm expecting variables
to contain foo
as a key and bar
as the value. What I'm doing wrong? What can I do to achieve this in case I'm doing it wrong?