Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check explicitly for missing model type #35

Merged
merged 1 commit into from
Jul 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 85 additions & 0 deletions aas_core3/jsonization.py
Original file line number Diff line number Diff line change
Expand Up @@ -1114,6 +1114,11 @@ def asset_administration_shell_from_jsonable(

setter = _SetterForAssetAdministrationShell()

if "modelType" not in jsonable:
raise DeserializationException(
"Expected the property modelType, but found none"
)

for key, jsonable_value in jsonable.items():
setter_method = _SETTER_MAP_FOR_ASSET_ADMINISTRATION_SHELL.get(key)
if setter_method is None:
Expand Down Expand Up @@ -1709,6 +1714,11 @@ def submodel_from_jsonable(jsonable: Jsonable) -> aas_types.Submodel:

setter = _SetterForSubmodel()

if "modelType" not in jsonable:
raise DeserializationException(
"Expected the property modelType, but found none"
)

for key, jsonable_value in jsonable.items():
setter_method = _SETTER_MAP_FOR_SUBMODEL.get(key)
if setter_method is None:
Expand Down Expand Up @@ -2364,6 +2374,11 @@ def submodel_element_list_from_jsonable(

setter = _SetterForSubmodelElementList()

if "modelType" not in jsonable:
raise DeserializationException(
"Expected the property modelType, but found none"
)

for key, jsonable_value in jsonable.items():
setter_method = _SETTER_MAP_FOR_SUBMODEL_ELEMENT_LIST.get(key)
if setter_method is None:
Expand Down Expand Up @@ -2631,6 +2646,11 @@ def submodel_element_collection_from_jsonable(

setter = _SetterForSubmodelElementCollection()

if "modelType" not in jsonable:
raise DeserializationException(
"Expected the property modelType, but found none"
)

for key, jsonable_value in jsonable.items():
setter_method = _SETTER_MAP_FOR_SUBMODEL_ELEMENT_COLLECTION.get(key)
if setter_method is None:
Expand Down Expand Up @@ -2921,6 +2941,11 @@ def property_from_jsonable(jsonable: Jsonable) -> aas_types.Property:

setter = _SetterForProperty()

if "modelType" not in jsonable:
raise DeserializationException(
"Expected the property modelType, but found none"
)

for key, jsonable_value in jsonable.items():
setter_method = _SETTER_MAP_FOR_PROPERTY.get(key)
if setter_method is None:
Expand Down Expand Up @@ -3193,6 +3218,11 @@ def multi_language_property_from_jsonable(

setter = _SetterForMultiLanguageProperty()

if "modelType" not in jsonable:
raise DeserializationException(
"Expected the property modelType, but found none"
)

for key, jsonable_value in jsonable.items():
setter_method = _SETTER_MAP_FOR_MULTI_LANGUAGE_PROPERTY.get(key)
if setter_method is None:
Expand Down Expand Up @@ -3452,6 +3482,11 @@ def range_from_jsonable(jsonable: Jsonable) -> aas_types.Range:

setter = _SetterForRange()

if "modelType" not in jsonable:
raise DeserializationException(
"Expected the property modelType, but found none"
)

for key, jsonable_value in jsonable.items():
setter_method = _SETTER_MAP_FOR_RANGE.get(key)
if setter_method is None:
Expand Down Expand Up @@ -3697,6 +3732,11 @@ def reference_element_from_jsonable(jsonable: Jsonable) -> aas_types.ReferenceEl

setter = _SetterForReferenceElement()

if "modelType" not in jsonable:
raise DeserializationException(
"Expected the property modelType, but found none"
)

for key, jsonable_value in jsonable.items():
setter_method = _SETTER_MAP_FOR_REFERENCE_ELEMENT.get(key)
if setter_method is None:
Expand Down Expand Up @@ -3946,6 +3986,11 @@ def blob_from_jsonable(jsonable: Jsonable) -> aas_types.Blob:

setter = _SetterForBlob()

if "modelType" not in jsonable:
raise DeserializationException(
"Expected the property modelType, but found none"
)

for key, jsonable_value in jsonable.items():
setter_method = _SETTER_MAP_FOR_BLOB.get(key)
if setter_method is None:
Expand Down Expand Up @@ -4199,6 +4244,11 @@ def file_from_jsonable(jsonable: Jsonable) -> aas_types.File:

setter = _SetterForFile()

if "modelType" not in jsonable:
raise DeserializationException(
"Expected the property modelType, but found none"
)

for key, jsonable_value in jsonable.items():
setter_method = _SETTER_MAP_FOR_FILE.get(key)
if setter_method is None:
Expand Down Expand Up @@ -4479,6 +4529,11 @@ def annotated_relationship_element_from_jsonable(

setter = _SetterForAnnotatedRelationshipElement()

if "modelType" not in jsonable:
raise DeserializationException(
"Expected the property modelType, but found none"
)

for key, jsonable_value in jsonable.items():
setter_method = _SETTER_MAP_FOR_ANNOTATED_RELATIONSHIP_ELEMENT.get(key)
if setter_method is None:
Expand Down Expand Up @@ -4786,6 +4841,11 @@ def entity_from_jsonable(jsonable: Jsonable) -> aas_types.Entity:

setter = _SetterForEntity()

if "modelType" not in jsonable:
raise DeserializationException(
"Expected the property modelType, but found none"
)

for key, jsonable_value in jsonable.items():
setter_method = _SETTER_MAP_FOR_ENTITY.get(key)
if setter_method is None:
Expand Down Expand Up @@ -5326,6 +5386,11 @@ def basic_event_element_from_jsonable(

setter = _SetterForBasicEventElement()

if "modelType" not in jsonable:
raise DeserializationException(
"Expected the property modelType, but found none"
)

for key, jsonable_value in jsonable.items():
setter_method = _SETTER_MAP_FOR_BASIC_EVENT_ELEMENT.get(key)
if setter_method is None:
Expand Down Expand Up @@ -5648,6 +5713,11 @@ def operation_from_jsonable(jsonable: Jsonable) -> aas_types.Operation:

setter = _SetterForOperation()

if "modelType" not in jsonable:
raise DeserializationException(
"Expected the property modelType, but found none"
)

for key, jsonable_value in jsonable.items():
setter_method = _SETTER_MAP_FOR_OPERATION.get(key)
if setter_method is None:
Expand Down Expand Up @@ -5932,6 +6002,11 @@ def capability_from_jsonable(jsonable: Jsonable) -> aas_types.Capability:

setter = _SetterForCapability()

if "modelType" not in jsonable:
raise DeserializationException(
"Expected the property modelType, but found none"
)

for key, jsonable_value in jsonable.items():
setter_method = _SETTER_MAP_FOR_CAPABILITY.get(key)
if setter_method is None:
Expand Down Expand Up @@ -6148,6 +6223,11 @@ def concept_description_from_jsonable(

setter = _SetterForConceptDescription()

if "modelType" not in jsonable:
raise DeserializationException(
"Expected the property modelType, but found none"
)

for key, jsonable_value in jsonable.items():
setter_method = _SETTER_MAP_FOR_CONCEPT_DESCRIPTION.get(key)
if setter_method is None:
Expand Down Expand Up @@ -7415,6 +7495,11 @@ def data_specification_iec_61360_from_jsonable(

setter = _SetterForDataSpecificationIEC61360()

if "modelType" not in jsonable:
raise DeserializationException(
"Expected the property modelType, but found none"
)

for key, jsonable_value in jsonable.items():
setter_method = _SETTER_MAP_FOR_DATA_SPECIFICATION_IEC_61360.get(key)
if setter_method is None:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"submodels": [
{
"id": "something_48c66017",
"modelType": "Submodel",
"submodelElements": [
{
"first": {
"keys": [
{
"type": "GlobalReference",
"value": "urn:another-company01:f390f801"
}
],
"type": "ExternalReference"
},
"idShort": "something3fdd3eb4",
"second": {
"keys": [
{
"type": "GlobalReference",
"value": "urn:an-example05:b7bf2725"
}
],
"type": "ExternalReference"
}
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
submodels[0].submodelElements[0]: Expected the property modelType, but found none
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"assetAdministrationShells": [
{
"assetInformation": {
"assetKind": "NotApplicable",
"globalAssetId": "something_eea66fa1"
},
"id": "something_142922d6"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
assetAdministrationShells[0]: Expected the property modelType, but found none
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"submodels": [
{
"id": "something_48c66017",
"modelType": "Submodel",
"submodelElements": [
{
"direction": "output",
"idShort": "something3fdd3eb4",
"observed": {
"keys": [
{
"type": "Submodel",
"value": "urn:another-example11:3679ef43"
}
],
"type": "ModelReference"
},
"state": "off"
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
submodels[0].submodelElements[0]: Expected the property modelType, but found none
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"submodels": [
{
"id": "something_48c66017",
"modelType": "Submodel",
"submodelElements": [
{
"contentType": "'VbrwFrYTU/fO7NnLxq \t; \tMX.`10dB732`X5yRy=I56Ov9Us\t ;\t\t pRb~~hdw_C%2Zf=\"\"\t\t\t \t\t\t \t \t\t \t ; h=1t",
"idShort": "something3fdd3eb4"
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
submodels[0].submodelElements[0]: Expected the property modelType, but found none
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"submodels": [
{
"id": "something_48c66017",
"modelType": "Submodel",
"submodelElements": [
{
"idShort": "something3fdd3eb4"
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
submodels[0].submodelElements[0]: Expected the property modelType, but found none
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"conceptDescriptions": [
{
"id": "something_8ccad77f"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
conceptDescriptions[0]: Expected the property modelType, but found none
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"assetAdministrationShells": [
{
"assetInformation": {
"assetKind": "NotApplicable",
"globalAssetId": "something_eea66fa1"
},
"embeddedDataSpecifications": [
{
"dataSpecificationContent": {
"preferredName": [
{
"language": "i-enochian",
"text": "something_84b0b440"
},
{
"language": "en-GB",
"text": "Something random in English 5b15c20d"
}
],
"value": "something_13759f45"
}
}
],
"id": "something_142922d6",
"modelType": "AssetAdministrationShell"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
assetAdministrationShells[0].embeddedDataSpecifications[0].dataSpecificationContent: Expected the property modelType, but found none
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"submodels": [
{
"id": "something_48c66017",
"modelType": "Submodel",
"submodelElements": [
{
"entityType": "CoManagedEntity",
"idShort": "something3fdd3eb4"
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
submodels[0].submodelElements[0]: Expected the property modelType, but found none
Loading
Loading