I am using the below message in my proto file as an example,
message Report {
string name = 1;
string desc = 2;
google.protobuf.Struct criteria = 3;
}
and generated the go client, server code. When passing the json below
{
"name": "My Report",
"desc": "My first report",
"criteria": {"fields": {"sum": "100"}}
}
as post request body to an endpoint and unmarshalling using
import "github.com/golang/protobuf/jsonpb"
var u api.Report
if err := jsonpb.Unmarshal(r.Body, &u); err != nil {...
I keep getting this error:
level=info msg="panic: reflect.Set: value of type map[string]*structpb.Value is not assignable to type map[string]*structpb.Value"
I have also tried using gogo/protobuf/jsonpb but no success there too, although I am still importing in my proto file.
import "google/protobuf/struct.proto";
Not sure what am I missing here.