Skip to content

Commit

Permalink
adapter.xml: Fix deserialization for Extension
Browse files Browse the repository at this point in the history
Currently, the XML deserialization missed the
`<aas:refersTo>` wrapper around the single references
inside `Extension.refers_to`. This commit fixes that.
  • Loading branch information
s-heppner committed Nov 15, 2023
1 parent 3d80e0c commit 6071934
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
6 changes: 4 additions & 2 deletions basyx/aas/adapter/xml/xml_deserialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -692,8 +692,10 @@ def construct_extension(cls, element: etree.Element, object_class=model.Extensio
value = _get_text_or_none(element.find(NS_AAS + "value"))
if value is not None:
extension.value = model.datatypes.from_xsd(value, extension.value_type)
extension.refers_to = _failsafe_construct_multiple(element.findall(NS_AAS + "refersTo"),
cls._construct_referable_reference, cls.failsafe)
extension.refers_to = _failsafe_construct_multiple(
element.find(NS_AAS + "refersTo").findall(NS_AAS + "reference"),
cls._construct_referable_reference, cls.failsafe
)
cls._amend_abstract_attributes(extension, element)
return extension

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -347,13 +347,15 @@
<aas:valueType>xs:string</aas:valueType>
<aas:value>ExampleExtensionValue</aas:value>
<aas:refersTo>
<aas:reference>
<aas:type>ModelReference</aas:type>
<aas:keys>
<aas:key>
<aas:type>AssetAdministrationShell</aas:type>
<aas:value>http://acplt.org/RefersTo/ExampleRefersTo</aas:value>
</aas:key>
</aas:keys>
<aas:keys>
<aas:key>
<aas:type>AssetAdministrationShell</aas:type>
<aas:value>http://acplt.org/RefersTo/ExampleRefersTo</aas:value>
</aas:key>
</aas:keys>
</aas:reference>
</aas:refersTo>
</aas:extension>
</aas:extensions>
Expand Down

0 comments on commit 6071934

Please sign in to comment.