You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I currently use the standard protobuf method ParseFromString quite a bit, but noticed that the generated betterproto dataclasses don't have this method, but they do have SerializeToString for compatibility.
Is there a reason ParseFromString isn't added?
I currently have a reasonable amount of repositories that use ParseFromString, which would require me to refactor quite a bit extra at once without this method.
For clarity, here's an example of what some of the code looks like right now:
fromhello_pb2importHellohello=Hello()
hello.ParseFromString(bytes(Hello)) # dummy example
but it would be nice if I could do the following with betterproto:
fromdataclassesimportdataclassimportbetterproto@dataclassclassHello(betterproto.Message):
"""Greeting represents a message you can tell a user."""message: str=betterproto.string_field(1)
hello=Hello(message='betterproto')
hello.ParseFromString(bytes(Hello)) # dummy example
The text was updated successfully, but these errors were encountered:
This is a problem I've encountered before and I believe that the compatibility with the standard protobuf implementation has merit to being supported.
I opened a PR for this.
I currently use the standard protobuf method
ParseFromString
quite a bit, but noticed that the generatedbetterproto
dataclasses don't have this method, but they do haveSerializeToString
for compatibility.Is there a reason
ParseFromString
isn't added?I currently have a reasonable amount of repositories that use
ParseFromString
, which would require me to refactor quite a bit extra at once without this method.For clarity, here's an example of what some of the code looks like right now:
but it would be nice if I could do the following with betterproto:
The text was updated successfully, but these errors were encountered: