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
root=protobuf.parse(protoString).root;varEmpty=root.lookup("Empty");varA=root.lookup("A");varB=root.lookup("B");varmsg=B.from({b: {}});console.log("msg",msg);varbuffer=B.encode(msg).finish();console.log(buffer);// Buffer is empty!, should be [18, 00]console.log(B.decode(newUint8Array(18,0)));// Should be equal to msg
protobuf.js version: 6.3.0
protobuf js isn't encoding correctly messages with nested empty messages.
protobuf used:
Snippet to reproduce:
jsfiddle link: https://jsfiddle.net/13c0re75/
Using the python binding for protobuf I got a different result.
Note: I used SetInParent - http://stackoverflow.com/questions/29643295/how-to-set-a-protobuf-field-which-is-an-empty-message-in-python
The result of the previous snippet is
I've verified the same behavior with another binding of protobuf (https://github.com/protobuf-c/protobuf-c) and got the same results.
The text was updated successfully, but these errors were encountered: