Closed foarsitter closed 1 year ago
Thanks for providing this extension, it makes working with xml fun again.
The from_* methods are typed against BaseXmlModel which results in an mypy error.
from_*
BaseXmlModel
message: Message | None = Message.from_xml(xml)
error: Incompatible types in assignment (expression has type "BaseXmlModel | None", variable has type "Message | None")
Pydantic itself uses a TypeVar bound to BaseModel so children are accepted as return type.
TypeVar
BaseModel
Is this something you want to support? If so, I can submit a PR.
@foarsitter Hi. Fixed it in version 0.7.0.
Great work @dapper91, thanks!
Thanks for providing this extension, it makes working with xml fun again.
The
from_*
methods are typed againstBaseXmlModel
which results in an mypy error.Pydantic itself uses a
TypeVar
bound toBaseModel
so children are accepted as return type.Is this something you want to support? If so, I can submit a PR.