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
- Spec —
submodel-elements.adoc: Blob.contentType and File.contentType both listed with cardinality 0..1.
- JSON schema —
aas.json: Blob and File definitions have no required array; contentType is an ordinary property.
- XML schema —
AAS.xsd: <xs:element name="contentType" minOccurs="0" maxOccurs="1"> for both elements.
- Model class —
model.Blob.__init__ and model.File.__init__ both declare content_type: Optional[ContentType] = None.
Currently, the JSON and XML deserializers raise an error when parsing a
BloborFilesubmodel element that does not include acontentTypefield, even though the AAS metamodel spec (IDTA-01001 v3.1.2) definescontentTypeas optional (cardinality0..1) for both classes.Affected locations
basyx/aas/adapter/json/json_deserialization.pyline 696 (_construct_blob):_get_ts(dct, "contentType", str)raisesKeyErrorwhen the key is absentbasyx/aas/adapter/json/json_deserialization.pyline 706 (_construct_file): same issuebasyx/aas/adapter/xml/xml_deserialization.pyline 807 (construct_blob):_child_text_mandatory(element, NS_AAS + "contentType")raises when the child element is absentbasyx/aas/adapter/xml/xml_deserialization.pyline 854 (construct_file): same issueEvidence that
contentTypeis optionalsubmodel-elements.adoc:Blob.contentTypeandFile.contentTypeboth listed with cardinality0..1.aas.json:BlobandFiledefinitions have norequiredarray;contentTypeis an ordinary property.AAS.xsd:<xs:element name="contentType" minOccurs="0" maxOccurs="1">for both elements.model.Blob.__init__andmodel.File.__init__both declarecontent_type: Optional[ContentType] = None.