python-betterproto
python-betterproto copied to clipboard
Loosing repeated sub elements from list when only attribute is set to 0
We have noticed that we are loosing part of a protobuf when the only attribute of an element is set to 0.
Tested: on the last 2.0.0b4
Example:
Protobuf
message Element {
uint64 id = 1;
}
message ParentElement {
string name = 1;
repeated Element elems = 2
}
Python code:
from the.package import ParentElement, Element
el = ParentElement(name="test", elems=[Element(id=0), Element(id=42)])
bytes_el = bytes(el)
ParentElement().parse(bytes_el)
>>> ParentElement(name="test", elems=[Element(id=42])
# Element(id=0) is gone
Is this an expected behaviour?