Skip to content

Blob and File deserializers treat contentType as mandatory despite spec cardinality 0..1 #561

@s-heppner

Description

@s-heppner

Currently, the JSON and XML deserializers raise an error when parsing a Blob or File submodel element that does not include a contentType field, even though the AAS metamodel spec (IDTA-01001 v3.1.2) defines contentType as optional (cardinality 0..1) for both classes.

Affected locations

  • basyx/aas/adapter/json/json_deserialization.py line 696 (_construct_blob): _get_ts(dct, "contentType", str) raises KeyError when the key is absent
  • basyx/aas/adapter/json/json_deserialization.py line 706 (_construct_file): same issue
  • basyx/aas/adapter/xml/xml_deserialization.py line 807 (construct_blob): _child_text_mandatory(element, NS_AAS + "contentType") raises when the child element is absent
  • basyx/aas/adapter/xml/xml_deserialization.py line 854 (construct_file): same issue

Evidence that contentType is optional

  • Specsubmodel-elements.adoc: Blob.contentType and File.contentType both listed with cardinality 0..1.
  • JSON schemaaas.json: Blob and File definitions have no required array; contentType is an ordinary property.
  • XML schemaAAS.xsd: <xs:element name="contentType" minOccurs="0" maxOccurs="1"> for both elements.
  • Model classmodel.Blob.__init__ and model.File.__init__ both declare content_type: Optional[ContentType] = None.

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