proto3 协议缓冲区中“众所周知的类型”的可用性

2024-01-15

我看到 StringValue 是字符串消息的消息包装器,我尝试将其用于:

service SomeService {
  // health
  rpc HealthCheck(google.protobuf.Empty)
    returns (google.protobuf.Empty) {}
  // create
  rpc CreateSomething(SomeMessageType)
    returns (StringValue) {}

}

但是,我从 protoc 收到一条消息,如下所示:

somefile.proto:30:14:“StringValue”未定义。

我正在使用 proto3 语法。我缺少什么?


OK.

我需要:import "google/protobuf/wrappers.proto";

并且,使用完全合格的google.protobuf.StringValue

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

proto3 协议缓冲区中“众所周知的类型”的可用性 的相关文章

随机推荐