fix: map field edge-case
This change ensures a parent is a nested type when checking if a field is a map.
This commit is contained in:
@@ -339,6 +339,9 @@ def is_map(
|
||||
) -> bool:
|
||||
"""True if proto_field_obj is a map, otherwise False."""
|
||||
if proto_field_obj.type == FieldDescriptorProtoType.TYPE_MESSAGE:
|
||||
if not hasattr(parent_message, "nested_type"):
|
||||
return False
|
||||
|
||||
# This might be a map...
|
||||
message_type = proto_field_obj.type_name.split(".").pop().lower()
|
||||
map_entry = f"{proto_field_obj.name.replace('_', '').lower()}entry"
|
||||
|
||||
Reference in New Issue
Block a user