有没有办法在 protobuf 中将第一个枚举值设置为 1?

Is there a way to set the first enum value to 1 in protobuf?

protobuf 中的第一个枚举值需要0,但这在 Primeng 的下拉组件中会造成一些麻烦。

有没有办法将第一个枚举值设置为 1

根据documentation,Protobuf 不允许将第一个枚举值设置为除 0 以外的其他值:

As you can see, the Corpus enum's first constant maps to zero: every enum definition must contain a constant that maps to zero as its first element. This is because:

  • There must be a zero value, so that we can use 0 as a numeric default value.
  • The zero value needs to be the first element, for compatibility with the proto2 semantics where the first enum value is always the default.