Skip to content

Commit

Permalink
adapter: fix deserialization of Extension
Browse files Browse the repository at this point in the history
  • Loading branch information
jkhsjdhjs authored and somsonson committed Dec 9, 2024
1 parent c1aa8fc commit 4dc2245
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions basyx/aas/adapter/json/json_deserialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -543,8 +543,8 @@ def _construct_extension(cls, dct: Dict[str, object], object_class=model.Extensi
if 'value' in dct:
ret.value = model.datatypes.from_xsd(_get_ts(dct, 'value', str), ret.value_type)
if 'refersTo' in dct:
ret.refers_to = [cls._construct_model_reference(refers_to, model.Referable) # type: ignore
for refers_to in _get_ts(dct, 'refersTo', list)]
ret.refers_to = {cls._construct_model_reference(refers_to, model.Referable) # type: ignore
for refers_to in _get_ts(dct, 'refersTo', list)}
return ret

@classmethod
Expand Down
5 changes: 3 additions & 2 deletions basyx/aas/adapter/xml/xml_deserialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,9 +479,10 @@ def _amend_abstract_attributes(cls, obj: object, element: etree.Element) -> None
cls.construct_embedded_data_specification, cls.failsafe):
obj.embedded_data_specifications.append(eds)
if isinstance(obj, model.HasExtension) and not cls.stripped:
extension_elem = element.find(NS_AAS + "extension")
extension_elem = element.find(NS_AAS + "extensions")
if extension_elem is not None:
for extension in _failsafe_construct_multiple(extension_elem, cls.construct_extension, cls.failsafe):
for extension in _child_construct_multiple(extension_elem, NS_AAS + "extension",
cls.construct_extension, cls.failsafe):
obj.extension.add(extension)

@classmethod
Expand Down

0 comments on commit 4dc2245

Please sign in to comment.