-
Notifications
You must be signed in to change notification settings - Fork 2
XML serialization uses wrong naming convention for primitive extension fields #319
Copy link
Copy link
Open
Labels
Description
model_dump_xml() detects primitive extension fields by looking for a field named
{field_name}_ext (underscore suffix). This naming convention is non-standard.
The FHIR specification uses an underscore prefix in JSON serialisation (e.g. _birthDate
holds the extension for birthDate) and a child element with the same tag in XML. The
internal Pydantic field may follow either convention depending on how the model was generated,
but the lookup in model_dump_xml() assumes the suffix pattern in all cases.
As a result, primitive extension fields are silently missed during XML serialisation, meaning
serialised XML is missing extension data that was present in the Pydantic model.
Impact
- Round-trip
JSON → model → XML → modelwill silently lose primitive extensions. - Profiles that use primitive extensions (e.g.
_status,_birthDate) will produce
non-conformant XML output.
Reactions are currently unavailable