protobuf_to_pydantic
protobuf_to_pydantic copied to clipboard
Document how to convert objects between proto and pydantic and reverse
Is your feature request related to a problem? Please describe.
I tried to find if there is an easy way to convert objects form one format into another. The easiest I found is using dicts as a intermediate format.
Describe the solution you'd like
- Something documented in the readme showcasing the conversion in both directions
- Maybe: a nice
<PydanticType>.from_proto(msg: <ProtoType>) -> <PydanticType>class method and<PydanticType>.to_proto() -> <ProtoType>method.
Describe alternatives you've considered
The dict method: convert proto/pydantic to dict, use that dict with two stars as input.
@jankatins Are you talking about something similar to this Issue? #11