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

问题描述 投票:0回答:1

根据文档

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

使用示例:

message Foo {
 string old_field = 1 [deprecated=true];
}
  • 我们如何弃用整个消息?
serialization protocol-buffers deprecated grpc deprecation-warning
1个回答
55
投票

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

message Foo {
   option deprecated = true;
   string old_field = 1;
}
© www.soinside.com 2019 - 2024. All rights reserved.