Skip to content

adapter: allow optional valueId in ValueReferencePair for JSON and XML#579

Open
paul-gerber-svg wants to merge 5 commits into
eclipse-basyx:developfrom
rwth-iat:fix-optional-value-id
Open

adapter: allow optional valueId in ValueReferencePair for JSON and XML#579
paul-gerber-svg wants to merge 5 commits into
eclipse-basyx:developfrom
rwth-iat:fix-optional-value-id

Conversation

@paul-gerber-svg

Copy link
Copy Markdown

Previously, the JSON and XML deserializers raised a KeyError if a ValueReferencePair did not contain a valueId.

However, according to the IDTA specification, valueId is explicitly optional (cardinality 0..1).

Following changes were added:

  • JSON: Uses .get('valueId') to handle missing keys without crashing.
  • XML: Uses .find() to check if the element exists before parsing it.

Currently, the JSON and XMOL deserializiers raise an error when parsing Blob or File submodels that do not include a contentType

The contentType attribute has a cardinality of 0..1 for both classes and should therefore be optional.
The implementation now aligns with this specification and defaults to None if the field is absent in the data.
@s-heppner

Copy link
Copy Markdown
Member

I think this depends on #572.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants