python-betterproto
python-betterproto copied to clipboard
WIP: Implement full support for Google well-known types
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
specialtype 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
optionalhandling to facilitateNullValue - "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.