gpt4 book ai didi

schema - Protocol Buffer 架构无效。导入 "google/protobuf/any.proto"尚未加载 : GCP/Pub-Sub

转载 作者:行者123 更新时间:2023-12-05 04:47:52 26 4
gpt4 key购买 nike

我是 GCP 的新手。我正在尝试通过使用 protobuf 的模式定义来使用 Pub/Sub 服务。

架构:

syntax = "proto3";

import "google/protobuf/any.proto";

message Endorsement {
string endorserId=1;
google.protobuf.Any data = 2;
string signature=3;
bool isVerified=4;
}

message TransactionPayload {
string policyId =1;
string txnId =2;
repeated Endorsement endorsements=3;
}

此模式的验证失败并出现错误

Invalid Protocol Buffer schema. Import "google/protobuf/any.proto" hasnot been loaded.

enter image description here

我需要使用 google.protobuf.Any,还有其他方法可以使用/定义它吗?

最佳答案

目前,Pub/Sub 的架构支持不支持导入。您必须在消息类型的定义中自己定义消息类型。另请注意,当前模式支持仅允许定义单个消息顶级消息类型,因此您还必须将 Endorsement 定义嵌入到 TransactionPayload 定义中。

关于schema - Protocol Buffer 架构无效。导入 "google/protobuf/any.proto"尚未加载 : GCP/Pub-Sub,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68341977/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com