Closed
Description
In proto2 fields were generated as pointers, which allowed us to check if a field was specified or not. This no longer seems to be the case. For example:
proto2:
syntax = "proto2";
message Foo {
required int32 ID = 1;
optional int32 SortOrder = 2;
}
gives
type Foo struct {
ID *int32 `protobuf:"varint,1,req" json:"ID,omitempty"`
SortOrder *int32 `protobuf:"varint,2,opt" json:"SortOrder,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
proto3:
syntax = "proto3";
message Foo {
int32 ID = 1;
optional int32 SortOrder = 2;
}
gives
type Foo struct {
ID int32 `protobuf:"varint,1,opt" json:"ID,omitempty"`
SortOrder int32 `protobuf:"varint,2,opt" json:"SortOrder,omitempty"`
}
Is this the expected behavior, and if so how are we supposed to differentiate a client making a call with SortOrder = 0
vs one making a call and not specifying the SortOrder
?
Metadata
Metadata
Assignees
Labels
No labels