-
Notifications
You must be signed in to change notification settings - Fork 25
Open
Labels
questionFurther information is requestedFurther information is requested
Description
When serializing to xml, computed elements are dropped to the back of the element instead of where they are defined. Is there are workaround to that?
import pydantic_xml
class Base(pydantic_xml.BaseXmlModel, tag="Base"):
@pydantic_xml.computed_element(tag="a")
def a(self) -> str:
return "asd"
b: str = pydantic_xml.element(tag="b")
data = Base(b="fgh")
print(data.to_xml(encoding="UTF-8", exclude_none=True).decode())
results in
<Base><b>fgh</b><a>asd</a></Base>
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested