Skip to content
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

optionally apply default values when decoding #3

Open
acg opened this issue Nov 25, 2011 · 0 comments
Open

optionally apply default values when decoding #3

acg opened this issue Nov 25, 2011 · 0 comments

Comments

@acg
Copy link
Owner

acg commented Nov 25, 2011

The lwpb C library doesn't apply default values for optional fields when decoding. This is by design. It would require another recursive pass over all the fields in the message descriptor to see if any were omitted in the encoded message. It would also require tracking which fields have been seen and which haven't, which is a departure from the callback design of lwpb_decoder_decode, where caller is responsible for actually populating the decoded message.

Since default values are a questionable and less frequently used feature of protobuf, and since applying them imposes a penalty in decoding, this should be an optional feature of the python decoder that you must explicitly request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant