Skip to content

XML deserialization: DataSpecificationIEC61360.value silently dropped when value_format is absent #501

@zrgt

Description

@zrgt

Summary

Severity: High
File: sdk/basyx/aas/adapter/xml/xml_deserialization.py:1156-1158

Description

value and value_format are independent optional fields in AAS v3.0.1, but the XML deserializer treats them as coupled: value is only set when value_format is also present.

value = _get_text_or_none(element.find(NS_AAS + "value"))
if value is not None and value_format is not None:   # BUG: should be independent
    ds_iec.value = value

An element with value but no value_format has its value silently dropped during XML deserialization. The JSON deserialization at json_deserialization.py:512-513 correctly sets them independently.

Fix

Split into two independent conditions:

if value is not None:
    ds_iec.value = value
if value_format is not None:
    ds_iec.value_format = value_format

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingsdkSomething to do with the `sdk` package

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions