fix: add UNSPECIFIED = 0 to enums without a zero value#38
fix: add UNSPECIFIED = 0 to enums without a zero value#38VolatilCapital wants to merge 1 commit into
Conversation
Modern protobuf code generators treat the first enum value as the default and skip serialization when a field matches it. This causes silent data loss for enums like ProtoOATradeSide (BUY=1) or ProtoOATrendbarPeriod (M1=1) where the first value is a valid choice. Adding UNSPECIFIED = 0 ensures all real values are always serialized. This is fully backward-compatible: existing numeric values are unchanged. Fixes spotware#37
|
you only consider your use case PS |
|
Thanks for your feedback. To clarify: these changes in the .proto files will not affect the server, in the sense that they do not change the server’s processing. Their sole purpose is to force the sending of default values, whereas according to the standard protocol specification, these values would normally not need to be sent. In other words, these changes go against the protocol’s specification, but they are only meant to ensure that the server receives all the values it expects. For my use case, I have already applied a local fix by making these modifications. That’s why modifying the .proto files is necessary in this specific case, but it wouldn’t be necessary if the server strictly adhered to the protocol. |
Summary
UNSPECIFIED = 0entry to 18 enums that lack a zero valueFixes #37
Affected enums
ProtoPayloadType,ProtoErrorCode,ProtoOAPayloadType,ProtoOACommissionType,ProtoOASymbolDistanceType,ProtoOAMinCommissionType,ProtoOAPositionStatus,ProtoOATradeSide,ProtoOAOrderType,ProtoOATimeInForce,ProtoOAOrderStatus,ProtoOAOrderTriggerMethod,ProtoOAExecutionType,ProtoOADealStatus,ProtoOATrendbarPeriod,ProtoOAQuoteType,ProtoOANotificationType,ProtoOAErrorCode