danielgtaylor / python-betterproto

Clean, modern, Python 3.6+ code generator & library for Protobuf 3 and async gRPC
MIT License
1.45k stars 196 forks source link

AttributeError: type object 'MyType' has no attribute '_serialized_on_wire' #26

Closed jeremyjjbrown closed 4 years ago

jeremyjjbrown commented 4 years ago

Typing to dump my structure to a dict for validation and I get

AttributeError: type object 'Emi3LocationInfoType' has no attribute '_serialized_on_wire' 
.venv/lib/python3.8/site-packages/betterproto/__init__.py:732: AttributeError

Here is the generated class

@dataclass
class Emi3LocationInfoType(betterproto.Message):
    """
    Contains full location information about station: name, description, type,
    timezone, address, coordinates, owner.
    """

    # Geographical coordinate information giving the precise location.
    geo_coordinate: "Emi3GeoCoordinate" = betterproto.message_field(1)
    # Detailed address of the location.
    address: "Emi3AddressType" = betterproto.message_field(2)
    # Official name of the location.
    name: "Emi3MultilingualText" = betterproto.message_field(3)
    # Location owner name.
    property_owner: "Emi3MultilingualText" = betterproto.message_field(4)
    # Geographical coordinate for parking entrances. This field should be omitted
    # if a separately identifiable parking entrance does not exist or the
    # entrance is the same as the location of the charging station.
    parking_entrance_geo_coordinate: "Emi3GeoCoordinate" = betterproto.message_field(5)
    # Specific details about the surrounding environment (restriction).
    description: "Emi3MultilingualText" = betterproto.message_field(6)
    # The general type of the charge point location, like onstreet, underground
    # garage etc.
    location_type: "Emi3LocationInfoTypeEmi3LocationTypeEnum" = betterproto.enum_field(
        7
    )
    # The time zone of the location.
    time_zone: "Emi3TimeZone" = betterproto.message_field(8)
jeremyjjbrown commented 4 years ago

Please close. This is my error.