benhodgson / protobuf-to-dict

A small Python library for creating dicts from protocol buffers. Useful as an intermediate step before serialization (e.g. to JSON).
Other
226 stars 108 forks source link

handling empty messages #5

Open 3kwa opened 9 years ago

3kwa commented 9 years ago

A message with a required field whose type is a message of all optional fields could be {'required': {}}

dict_to_protobuf ignores the {} and removes the required field from the message which causes an error at serialization time.

The PR contains the tests and one way to fix the problem.

andrew-minted commented 9 years ago

bump

3kwa commented 9 years ago

@andrew-minted you may want to have a look at https://github.com/3kwa/protodict a friendly fork in which I merged this PR

zuiaiqun commented 8 years ago

yes, this can fix the problem