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

The first enum value needs to be 0 in protobuf, but this does some trouble in a dropdown component of Primeng.

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



Solution 1:[1]

According to the documentation, Protobuf is not allowed to set the first enum value to other value except 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.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 ramsay