proto包含google::protobuf::Any时如何写文本格式

How to write text format when proto including google::protobuf::Any

我的原型是这样的:

message PlatformConfig {
  google.protobuf.Any source_adapter_config = 1;
};

我想设置原型:

message SessionBundleSourceAdapterConfig {
  SessionBundleConfig config = 1;
}

改成source_adapter_config,如何写protobuf的this TextFormat。

最后发现Any type需要一个type_url来指定类型,例如:

platform_configs {
    key: "tensorflow"
    value {
        source_adapter_config {
            type_url:"type.googleapis.com/tensorflow.serving.SavedModelBundleSourceAdapterConfig"
            value: "..."
        }
    }
}