如何在协议缓冲区中弃用整个消息?

时间:2018-10-12 14:30:11

标签: serialization protocol-buffers deprecated grpc deprecation-warning

根据documentation

已弃用(字段选项):如果设置为true,则表示该字段已弃用,并且不应被新代码使用。

使用示例:

message Foo {
 string old_field = 1 [deprecated=true];
}
  • 如何弃用整个消息?

1 个答案:

答案 0 :(得分:1)

您可以将其设置为消息中的顶级选项:

message Foo {
   option deprecated = true;
   string old_field = 1;
}