-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add additional parameters to to_json()
and to_dict()
methods
#384
Conversation
- These parameters are just passthroughs to [`MessageToJson`][1] and [`MessageToDict`][2] [1]: https://googleapis.dev/python/protobuf/latest/google/protobuf/json_format.html#google.protobuf.json_format.MessageToJson [2]: https://googleapis.dev/python/protobuf/latest/google/protobuf/json_format.html#google.protobuf.json_format.MessageToDict
I think Owlbot has to be force run by adding the tag. I don't have permission to do that. |
Is this good for review? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Co-authored-by: Anthonios Partheniou <[email protected]>
s = Squid(mass_kg=3.14159265) | ||
|
||
s_dict = Squid.to_dict(s, float_precision=3) | ||
assert s_dict["mass_kg"] == 3.14 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would have expected this to be 3.141
or 3.142
since float_precision=3
. If you agree, can you file a bug and add a comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I filed #390
Should it block this PR?
MessageToJson
andMessageToDict