根据以下页面,我应该能够发送 json 有效负载:https ://developers.google.com/protocol-buffers/docs/proto3 在“JSON 映射”下。
我想将 json 有效负载作为消息的一部分发送,并且我有以下 .proto 文件:
message EventsRequest{
message RequestElement {
struct payload = 1;
}
string customerId = 1;
repeated RequestElement jsonPayload = 2;
}
message EventsResponse {
int32 status = 1;
string rawResponseData = 2;
struct responseData = 3;
}
但是编译它会给我以下错误:
[INFO] Compiling 1 proto file(s) to C:\workspace\...\target\generated-sources\protobuf\java
[ERROR] PROTOC FAILED: msg_service.proto:21:9: "struct" is not defined.
msg_service.proto:34:5: "struct" is not defined.
[ERROR] C:\workspace\...\src\main\proto\msg_service.proto [0:0]: msg_service.proto:21:9: "struct" is not defined.
msg_service.proto:34:5: "struct" is not defined.
我也尝试过'Struct',但我得到了同样的错误。
我误解了用法吗?如果我必须发送 json 有效负载,我是否作为字符串传入?
谢谢