@@ -1403,15 +1403,6 @@ def to_dict(
14031403 Dict[:class:`str`, Any]
14041404 The JSON serializable dict representation of this object.
14051405 """
1406- # Mirror of from_dict: Struct's `fields` member is transparently
1407- # dispatched through instead.
1408- if isinstance (self , Struct ):
1409- output = {** self .fields }
1410- for k in self .fields :
1411- if hasattr (self .fields [k ], "to_dict" ):
1412- output [k ] = self .fields [k ].to_dict (casing , include_default_values )
1413- return output
1414-
14151406 output : Dict [str , Any ] = {}
14161407 field_types = self ._type_hints ()
14171408 defaults = self ._betterproto .default_gen
@@ -1530,12 +1521,6 @@ def to_dict(
15301521
15311522 @classmethod
15321523 def _from_dict_init (cls , mapping : Mapping [str , Any ]) -> Mapping [str , Any ]:
1533- # Special case: google.protobuf.Struct has a single fields member but
1534- # behaves like a transparent JSON object, so it needs to first be munged
1535- # into `{fields: mapping}`.
1536- if cls == Struct :
1537- mapping = {"fields" : mapping }
1538-
15391524 init_kwargs : Dict [str , Any ] = {}
15401525 for key , value in mapping .items ():
15411526 field_name = safe_snake_case (key )
@@ -1566,7 +1551,7 @@ def _from_dict_init(cls, mapping: Mapping[str, Any]) -> Mapping[str, Any]:
15661551 if isinstance (value , list )
15671552 else sub_cls .from_dict (value )
15681553 )
1569- elif meta .map_types and meta .map_types [1 ] == TYPE_MESSAGE and cls != Struct :
1554+ elif meta .map_types and meta .map_types [1 ] == TYPE_MESSAGE :
15701555 sub_cls = cls ._betterproto .cls_by_field [f"{ field_name } .value" ]
15711556 value = {k : sub_cls .from_dict (v ) for k , v in value .items ()}
15721557 else :
@@ -1941,7 +1926,6 @@ def which_one_of(message: Message, group_name: str) -> Tuple[str, Optional[Any]]
19411926 Int32Value ,
19421927 Int64Value ,
19431928 StringValue ,
1944- Struct ,
19451929 Timestamp ,
19461930 UInt32Value ,
19471931 UInt64Value ,
0 commit comments