Skip to content

JSON deserializer treats ValueReferencePair.valueId as required #562

@s-heppner

Description

@s-heppner

Currently, _construct_value_reference_pair in basyx/aas/adapter/json/json_deserialization.py (line 429) uses the mandatory _get_ts(dct, 'valueId', dict) to read valueId. This raises a KeyError whenever a ValueReferencePair object in JSON does not include a valueId key, making it impossible to deserialize any such object.

valueId is optional (cardinality 0..1) in ValueReferencePair according to:

  • IDTA-01003-a (IEC 61360 data specification template), section "Value Reference Pair Attributes": valueId has cardinality 0..1,
    and the spec note reads "if the valueId is defined as well, then the value needs to be consistent…", explicitly framing it as optional.
  • aas.json (JSON schema): the required array for ValueReferencePair contains only "value"valueId is absent.
  • model/base.py: ValueReferencePair.__init__ declares value_id: Optional[Reference] = None.

A ValueReferencePair without valueId is therefore fully spec-conformant and must deserialize without error.

When fixing this, please also check if the XML deserializer has the same bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions