-
Notifications
You must be signed in to change notification settings - Fork 232
Open
Labels
bug?Bug or feature?Bug or feature?
Description
when i use to_dict
or to_pydict
function to serialize message, False
and 0
values are not work for boolean and integer fields.
here is the sample code:
from dataclasses import dataclass
import betterproto
@dataclass
class Greeting(betterproto.Message):
"""Greeting represents a message you can tell a user."""
int_field: int = betterproto.int32_field(1)
bool_field: bool = betterproto.bool_field(2)
if __name__ == "__main__":
greeting = Greeting(
int_field=0,
bool_field=False
)
print(greeting.to_pytdict())
greeting.int_field = 1
greeting.bool_field = True
print(greeting.to_pydict())
and output is:
{}
{'intField': 1, 'boolField': True}
python version: 3.8
betterproto version: 2.0.0b5
Metadata
Metadata
Assignees
Labels
bug?Bug or feature?Bug or feature?