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

moh*_*ail 4 protocol-buffers

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

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

}
Run Code Online (Sandbox Code Playgroud)

但是,我从 protoc 收到一条消息,例如:

somefile.proto:30:14: "StringValue" 未定义。

我正在使用 proto3 语法。我错过了什么?

moh*_*ail 7

好的。

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

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