0
点赞
收藏
分享

微信扫一扫

protobuf中的枚举缺省值应该为ENUN_TYPE_UNSPECIFIED

香小蕉 2023-06-15 阅读 83


protobuf中的枚举缺省值应该为ENUN_TYPE_UNSPECIFIED

(金庆的专栏 2017.11)

Googol 公布的 API Design 规范中,*.proto 中的枚举缺省值建议为 ENUN_TYPE_UNSPECIFIED。

https://mp.weixin.qq.com/s?__biz=MzA5ODg4Mzk2OQ==&mid=2247483705&idx=1&sn=cc2ffef9ac431510c1791dbe6e774b85
The first value should be named ENUM_TYPE_UNSPECIFIED as it is returned when an enum value is not explicitly specified.

enum FooBar {
  // The first value represents the default and must be == 0.
  FOO_BAR_UNSPECIFIED = 0;
  FIRST_VALUE = 1;
  SECOND_VALUE = 2;
}



参考:protobuf中的枚举缺省值应该为UNKNOWN


举报

相关推荐

0 条评论