python-betterproto icon indicating copy to clipboard operation
python-betterproto copied to clipboard

WIP: Implement full support for Google well-known types

Open ported-pw opened this issue 3 years ago • 0 comments

This is a work in progress to implement support for automatically parsing and serialising arbitrary JSON into the Google well-known types around https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct and https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#value.

Changes made to make this work:

  • Adding a special type meta field, while changing the respective type hints to something akin to JSON (which can be improved once Python has proper recursive type support)
  • Changes to optional handling to facilitate NullValue
  • "Transforms" for these special types, to automatically create and parse back the correct protobuf structures for arbitrary JSON
  • A lot of serialiser and deserialiser changes

There are still some bugs to sort out before this would be ready:

  • Empty Structs are not serialised correctly, they are 0 bytes
  • Parsing Structs is broken (see test failures)

Value and a lot of other things seems to generally work.

If someone wants to pick this up and finish it, be my guest. I am submitting this because I do not currently intent on finishing it.

ported-pw avatar Sep 29 '22 18:09 ported-pw