You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When encoding messages which only contain optional properties with default values or null values, the protobuf.js library strips the message from the wire and thus the generated output is different.
The binary output of the library is "" (empty buffer).
Expected binary output is "0001 0010 0000 0000" (0x1200)
Another way to duplicate the behaviour is to decode the 0x1200 message with the library and the provided proto and then encoding it again, the output differs from the input. How can we configure the library to generate the expected output (0x1200)
Code extract:
var testBuffer = Buffer.from('1200', 'hex');
var protoMsg = root.lookup('Message');
var message = protoMsg.decode(testBuffer); // Message contains subnodes MessageA and MessageB
var buffer = protoMsg.encode(message).finish(); // Buffer is empty after encoding
The text was updated successfully, but these errors were encountered:
Using protobuf.js version: 6.2.1 (latest)
When encoding messages which only contain optional properties with default values or null values, the protobuf.js library strips the message from the wire and thus the generated output is different.
Proto definition:
Buffer message:
The binary output of the library is "" (empty buffer).
Expected binary output is "0001 0010 0000 0000" (0x1200)
Another way to duplicate the behaviour is to decode the 0x1200 message with the library and the provided proto and then encoding it again, the output differs from the input. How can we configure the library to generate the expected output (0x1200)
Code extract:
The text was updated successfully, but these errors were encountered: