Hi, I am new in using Protobuf for golang.
https://github.com/golang/protobuf
Using golang Protobuf, within package foo, I created message TaskJobEntity which is a combination of other messages:
message TaskJobEntity {
JobEntity job = 1;
TaskEntity task = 2;
map<int64, JobEntity> dependent_jobs = 3;
}
Which is used within package foo response as part a map:
message ListTaskJobsResponse {
map<string, TaskJobEntity> task_jobs = 1;
ServiceStatus status = 2;
}
Now within another Protobuf package bar, I would like to define response that includes message TaskJobEntity defined in package foo, however, as far as I can determine, a proto3 package cannot reference another proto3 package (is this determination correct?).
My goal is to add map<string, foo.TaskJobEntity> task_jobs to package bar defined response.
Here is how I approaching to get to this goal. I have found that map of interface{} is not supported in Protobuf. So, is using google.protobuf.Any the next best solution?
message ImportStatsResponse {
string task_id = 1;
// map<string, mvregistrypb.TaskJobEntity> task_jobs = 2;
// map<string, interface{}> task_jobs = 2;
map<string, google.protobuf.Any> task_jobs = 2;
ServiceStatus status = 3;
}Recommendations?
Hi, I am new in using Protobuf for golang.
https://github.com/golang/protobuf
Using golang Protobuf, within package foo, I created message TaskJobEntity which is a combination of other messages:
message TaskJobEntity {
JobEntity job = 1;
TaskEntity task = 2;
map<int64, JobEntity> dependent_jobs = 3;
}
Which is used within package foo response as part a map:
message ListTaskJobsResponse {
map<string, TaskJobEntity> task_jobs = 1;
ServiceStatus status = 2;
}
Now within another Protobuf package bar, I would like to define response that includes message TaskJobEntity defined in package foo, however, as far as I can determine, a proto3 package cannot reference another proto3 package (is this determination correct?).
My goal is to add map<string, foo.TaskJobEntity> task_jobs to package bar defined response.
Here is how I approaching to get to this goal. I have found that map of interface{} is not supported in Protobuf. So, is using google.protobuf.Any the next best solution?
message ImportStatsResponse {
string task_id = 1;
// map<string, mvregistrypb.TaskJobEntity> task_jobs = 2;
// map<string, interface{}> task_jobs = 2;
map<string, google.protobuf.Any> task_jobs = 2;
ServiceStatus status = 3;
}
Recommendations?
--
You received this message because you are subscribed to the Google Groups "Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+unsubscribe@googlegroups.com.
To post to this group, send email to prot...@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.
protobuf
├── foo
│ ├── task_jobs.pb.go
│ ├── task_jobs.proto
│ ├──service.pb.go
│ └──service.proto
└── bar
├── service.pb.go
└── service.proto
services
├── foo
│ └──microservice Go code
└── bar