dapper91 / pydantic-xml

python xml for humans
https://pydantic-xml.readthedocs.io
The Unlicense
141 stars 14 forks source link

Feature Request] Allow NamedTuple to be used with Homogeneous collections #172

Closed skewty closed 1 month ago

skewty commented 4 months ago

It would be really nice to use NamedTuple with Homogeneous collections as in

class SenderAddress(RootXmlModel[str], tag="address"):
    pass

class SenderName(RootXmlModel[str], tag="name"):
    pass

class Sender(NamedTuple):
    address: SenderAddress | None
    name: SenderName | None

class SenderData(RootXmlModel, tag="senderdata"):
    root: list[Sender]

but I get: pydantic_xml.errors.ModelError: type call is not supported.

dapper91 commented 1 month ago

Implemented in version 2.11