Skip to content

JSON deserialization sets DataSpecificationIEC61360.value_id but attribute is absent from model, lost on round-trip #504

@zrgt

Description

@zrgt

Summary

Severity: Medium
File: sdk/basyx/aas/adapter/json/json_deserialization.py:514-515

Description

The JSON deserializer assigns value_id on DataSpecificationIEC61360, but this attribute does not exist on the model class. Python silently accepts the dynamic assignment, but the serializer never writes it back, so valueId is lost on every round-trip.

if 'valueId' in dct:
    ret.value_id = cls._construct_reference(_get_ts(dct, 'valueId', dict))

DataSpecificationIEC61360 (defined at model/base.py:2393) has no value_id attribute. Python allows dynamic attribute assignment, so this silently adds an untyped attribute that is never written back by the JSON serializer (json_serialization.py:342-376 has no value_id output). On any round-trip, valueId from input JSON is lost.

Fix

Two options:

  • (a) Add value_id: Optional[Reference] to the DataSpecificationIEC61360 model class and serialize it.
  • (b) Remove the dead deserialization code if the AAS spec does not include this field for IEC61360 data specs.

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