Skip to content

refers to an ungenerated message in the map #89

@so1n

Description

@so1n

Describe the bug
refers to an ungenerated message in the map

Dependencies

Input cmd:

python -m protobuf_to_pydantic --info
# OR
python -m protobuf_to_pydantic.plugin --info

Result:

# Paste the output of the command here

Protobuf File Content

Please check the Protobuf content for sensitive information

message DemoResp {
    map<int32, DemoState> demoState = 1;
    int64 pramsArea = 2;
    bool paramsSeason = 3;
}


message DemoState  {
    int64 paramsDID = 4;
}

Output content

class DemoResp(BaseModel):
    """
    The issue refers to an ungenerated message in the map
    """

    demoState: typing.Dict[int, DemoState] = Field(default_factory=dict)
    pramsArea: int = Field(default=0)
    paramsSeason: bool = Field(default=False)


class DemoState(BaseModel):
    paramsDID: int = Field(default=0)

Expected behavior
When referencing an ungenerated class, should use annotation:

class DemoResp(BaseModel):
    """
    The issue refers to an ungenerated message in the map
    """

    demoState: "typing.Dict[int, DemoState]" = Field(default_factory=dict)
    pramsArea: int = Field(default=0)
    paramsSeason: bool = Field(default=False)


class DemoState(BaseModel):
    paramsDID: int = Field(default=0)

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions