Consider the following snippet:
from google.protobuf import any_pb2
import proto
class Container(proto.Message):
contents = proto.Field(any_pb2.Any, number=1)
class Thing(proto.Message):
name = proto.Field(proto.STRING, number=1)
thing = Thing(name="Thing 1")
c = Container()
a = any_pb2.Any()
a.Pack(Thing.pb(thing))
c.contents = a
c_dict = Container.to_dict(c)
c_new = Container(mapping=c_dict) # Raises an exception
This fails because the dict representation for any_pb2.Any contains metadata that proto.Message.__init__ and proto.Message.__setattr__ do not know how to handle/ignore properly.
This blocks the use of the REST transport for any API method with a request that contains an any_pb2.Any fields due to transcoding logic.
Consider the following snippet:
This fails because the dict representation for
any_pb2.Anycontains metadata thatproto.Message.__init__andproto.Message.__setattr__do not know how to handle/ignore properly.This blocks the use of the REST transport for any API method with a request that contains an
any_pb2.Anyfields due to transcoding logic.