-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
Given a message with an optional int
syntax = "proto3";
message Takeout {
// nil (unspecified), 0 (no cutlery), 1 (1 set of cutlery), etc.
optional uint32 cutlery_needed = 1;
// Other fields...
}
The official Google proto library encodes these values as such:
Takeout.new(cutlery_needed:0).to_proto
# => "\b\x00"
Takeout.new(cutlery_needed:nil).to_proto
# => ""
When protoboeuf encodes this message, then it should match the output above:
Takeout.new(cutlery_needed:0).to_proto
=> ""
Takeout.new(cutlery_needed:nil).to_proto
=> ""
Notice how the 0 (zero) value is considered being unset and isn't transmitted "\b\x00"
.
This currentl breaks cross-language compatibility between these two libs and therefore also backwards compat with proto2.
Not sure how much it's going to cost, but we need to check the @_bitmask
instead of val != 0
in these cases for whether something is set or not.
Metadata
Metadata
Assignees
Labels
No labels