【问题标题】:How can I deprecate whole message in Protocol Buffers?如何弃用协议缓冲区中的整个消息?
【发布时间】:2019-03-17 19:33:36
【问题描述】:

根据documentation

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

使用示例:

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

【问题讨论】:

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


    【解决方案1】:

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-09-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多