xsdata icon indicating copy to clipboard operation
xsdata copied to clipboard

Type annotations for compound fields don't address token elements

Open tefra opened this issue 2 years ago • 0 comments

The new type annotations for compound fields can generate this

@dataclass
class Node:
    class Meta:
        name = "node"

    node_or_id: List[Union["Node", str]] = field(
        default_factory=list,
        metadata={
            "type": "Elements",
            "choices": (
                {
                    "name": "node",
                    "type": Type["Node"],
                },
                {
                    "name": "id",
                    "type": List[str],
                    "default_factory": list,
                    "tokens": True,
                },
            ),
        },
    )

It should be node_or_id: List[Union["Node", List[str]]

tefra avatar Dec 26 '23 07:12 tefra