From bc07a2a22b80c825fa879f5225de23af2bf61bcf Mon Sep 17 00:00:00 2001 From: Marko Ristin Date: Sun, 7 Jul 2024 12:53:10 +0200 Subject: [PATCH] Check explicitly for invalid model types We explicitly check during the JSON de-serialization that model types correspond to the expected model types. We need to be particularly careful with concrete classes without descendants with a mandatory ``modelType``, as they do not necessarily require a model type for de-serialization, but the specs mandate it for reasons of backward compatibility. The code corresponds to [aas-core-codegen cd92d208], and the test data corresponds to [aas-core3.0-testgen 9e523511c]. This is related to the issue #32, which discovered the problematic in the first place. [aas-core-codegen cd92d208]: https://github.com/aas-core-works/aas-core-codegen/commit/cd92d208 [aas-core3.0-testgen 9e523511c]: https://github.com/aas-core-works/aas-core3.0-testgen/commit/9e523511c --- aas_core3/jsonization.py | 145 ++++++++++++++++-- .../invalidModelType.json | 32 ++++ .../invalidModelType.json.exception | 1 + .../invalidModelType.json | 12 ++ .../invalidModelType.json.exception | 1 + .../BasicEventElement/invalidModelType.json | 25 +++ .../invalidModelType.json.exception | 1 + .../Blob/invalidModelType.json | 15 ++ .../Blob/invalidModelType.json.exception | 1 + .../Capability/invalidModelType.json | 14 ++ .../invalidModelType.json.exception | 1 + .../ConceptDescription/invalidModelType.json | 8 + .../invalidModelType.json.exception | 1 + .../invalidModelType.json | 30 ++++ .../invalidModelType.json.exception | 1 + .../Entity/invalidModelType.json | 15 ++ .../Entity/invalidModelType.json.exception | 1 + .../File/invalidModelType.json | 15 ++ .../File/invalidModelType.json.exception | 1 + .../invalidModelType.json | 14 ++ .../invalidModelType.json.exception | 1 + .../Operation/invalidModelType.json | 14 ++ .../Operation/invalidModelType.json.exception | 1 + .../Property/invalidModelType.json | 15 ++ .../Property/invalidModelType.json.exception | 1 + .../Range/invalidModelType.json | 15 ++ .../Range/invalidModelType.json.exception | 1 + .../ReferenceElement/invalidModelType.json | 14 ++ .../invalidModelType.json.exception | 1 + .../RelationshipElement/invalidModelType.json | 32 ++++ .../invalidModelType.json.exception | 1 + .../Submodel/invalidModelType.json | 8 + .../Submodel/invalidModelType.json.exception | 1 + .../invalidModelType.json | 14 ++ .../invalidModelType.json.exception | 1 + .../SubmodelElementList/invalidModelType.json | 15 ++ .../invalidModelType.json.exception | 1 + 37 files changed, 453 insertions(+), 17 deletions(-) create mode 100644 test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/AnnotatedRelationshipElement/invalidModelType.json create mode 100644 test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/AnnotatedRelationshipElement/invalidModelType.json.exception create mode 100644 test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/AssetAdministrationShell/invalidModelType.json create mode 100644 test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/AssetAdministrationShell/invalidModelType.json.exception create mode 100644 test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/BasicEventElement/invalidModelType.json create mode 100644 test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/BasicEventElement/invalidModelType.json.exception create mode 100644 test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/Blob/invalidModelType.json create mode 100644 test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/Blob/invalidModelType.json.exception create mode 100644 test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/Capability/invalidModelType.json create mode 100644 test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/Capability/invalidModelType.json.exception create mode 100644 test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/ConceptDescription/invalidModelType.json create mode 100644 test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/ConceptDescription/invalidModelType.json.exception create mode 100644 test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/DataSpecificationIec61360/invalidModelType.json create mode 100644 test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/DataSpecificationIec61360/invalidModelType.json.exception create mode 100644 test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/Entity/invalidModelType.json create mode 100644 test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/Entity/invalidModelType.json.exception create mode 100644 test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/File/invalidModelType.json create mode 100644 test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/File/invalidModelType.json.exception create mode 100644 test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/MultiLanguageProperty/invalidModelType.json create mode 100644 test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/MultiLanguageProperty/invalidModelType.json.exception create mode 100644 test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/Operation/invalidModelType.json create mode 100644 test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/Operation/invalidModelType.json.exception create mode 100644 test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/Property/invalidModelType.json create mode 100644 test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/Property/invalidModelType.json.exception create mode 100644 test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/Range/invalidModelType.json create mode 100644 test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/Range/invalidModelType.json.exception create mode 100644 test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/ReferenceElement/invalidModelType.json create mode 100644 test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/ReferenceElement/invalidModelType.json.exception create mode 100644 test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/RelationshipElement/invalidModelType.json create mode 100644 test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/RelationshipElement/invalidModelType.json.exception create mode 100644 test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/Submodel/invalidModelType.json create mode 100644 test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/Submodel/invalidModelType.json.exception create mode 100644 test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/SubmodelElementCollection/invalidModelType.json create mode 100644 test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/SubmodelElementCollection/invalidModelType.json.exception create mode 100644 test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/SubmodelElementList/invalidModelType.json create mode 100644 test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/SubmodelElementList/invalidModelType.json.exception diff --git a/aas_core3/jsonization.py b/aas_core3/jsonization.py index ba948f4b..b1eef198 100644 --- a/aas_core3/jsonization.py +++ b/aas_core3/jsonization.py @@ -1114,11 +1114,18 @@ def asset_administration_shell_from_jsonable( setter = _SetterForAssetAdministrationShell() - if "modelType" not in jsonable: + model_type = jsonable.get("modelType", None) + if model_type is None: raise DeserializationException( "Expected the property modelType, but found none" ) + if model_type != "AssetAdministrationShell": + raise DeserializationException( + f"Invalid modelType, expected 'AssetAdministrationShell', " + f"but got: {model_type!r}" + ) + for key, jsonable_value in jsonable.items(): setter_method = _SETTER_MAP_FOR_ASSET_ADMINISTRATION_SHELL.get(key) if setter_method is None: @@ -1714,11 +1721,17 @@ def submodel_from_jsonable(jsonable: Jsonable) -> aas_types.Submodel: setter = _SetterForSubmodel() - if "modelType" not in jsonable: + model_type = jsonable.get("modelType", None) + if model_type is None: raise DeserializationException( "Expected the property modelType, but found none" ) + if model_type != "Submodel": + raise DeserializationException( + f"Invalid modelType, expected 'Submodel', " f"but got: {model_type!r}" + ) + for key, jsonable_value in jsonable.items(): setter_method = _SETTER_MAP_FOR_SUBMODEL.get(key) if setter_method is None: @@ -2374,11 +2387,18 @@ def submodel_element_list_from_jsonable( setter = _SetterForSubmodelElementList() - if "modelType" not in jsonable: + model_type = jsonable.get("modelType", None) + if model_type is None: raise DeserializationException( "Expected the property modelType, but found none" ) + if model_type != "SubmodelElementList": + raise DeserializationException( + f"Invalid modelType, expected 'SubmodelElementList', " + f"but got: {model_type!r}" + ) + for key, jsonable_value in jsonable.items(): setter_method = _SETTER_MAP_FOR_SUBMODEL_ELEMENT_LIST.get(key) if setter_method is None: @@ -2646,11 +2666,18 @@ def submodel_element_collection_from_jsonable( setter = _SetterForSubmodelElementCollection() - if "modelType" not in jsonable: + model_type = jsonable.get("modelType", None) + if model_type is None: raise DeserializationException( "Expected the property modelType, but found none" ) + if model_type != "SubmodelElementCollection": + raise DeserializationException( + f"Invalid modelType, expected 'SubmodelElementCollection', " + f"but got: {model_type!r}" + ) + for key, jsonable_value in jsonable.items(): setter_method = _SETTER_MAP_FOR_SUBMODEL_ELEMENT_COLLECTION.get(key) if setter_method is None: @@ -2941,11 +2968,17 @@ def property_from_jsonable(jsonable: Jsonable) -> aas_types.Property: setter = _SetterForProperty() - if "modelType" not in jsonable: + model_type = jsonable.get("modelType", None) + if model_type is None: raise DeserializationException( "Expected the property modelType, but found none" ) + if model_type != "Property": + raise DeserializationException( + f"Invalid modelType, expected 'Property', " f"but got: {model_type!r}" + ) + for key, jsonable_value in jsonable.items(): setter_method = _SETTER_MAP_FOR_PROPERTY.get(key) if setter_method is None: @@ -3218,11 +3251,18 @@ def multi_language_property_from_jsonable( setter = _SetterForMultiLanguageProperty() - if "modelType" not in jsonable: + model_type = jsonable.get("modelType", None) + if model_type is None: raise DeserializationException( "Expected the property modelType, but found none" ) + if model_type != "MultiLanguageProperty": + raise DeserializationException( + f"Invalid modelType, expected 'MultiLanguageProperty', " + f"but got: {model_type!r}" + ) + for key, jsonable_value in jsonable.items(): setter_method = _SETTER_MAP_FOR_MULTI_LANGUAGE_PROPERTY.get(key) if setter_method is None: @@ -3482,11 +3522,17 @@ def range_from_jsonable(jsonable: Jsonable) -> aas_types.Range: setter = _SetterForRange() - if "modelType" not in jsonable: + model_type = jsonable.get("modelType", None) + if model_type is None: raise DeserializationException( "Expected the property modelType, but found none" ) + if model_type != "Range": + raise DeserializationException( + f"Invalid modelType, expected 'Range', " f"but got: {model_type!r}" + ) + for key, jsonable_value in jsonable.items(): setter_method = _SETTER_MAP_FOR_RANGE.get(key) if setter_method is None: @@ -3732,11 +3778,18 @@ def reference_element_from_jsonable(jsonable: Jsonable) -> aas_types.ReferenceEl setter = _SetterForReferenceElement() - if "modelType" not in jsonable: + model_type = jsonable.get("modelType", None) + if model_type is None: raise DeserializationException( "Expected the property modelType, but found none" ) + if model_type != "ReferenceElement": + raise DeserializationException( + f"Invalid modelType, expected 'ReferenceElement', " + f"but got: {model_type!r}" + ) + for key, jsonable_value in jsonable.items(): setter_method = _SETTER_MAP_FOR_REFERENCE_ELEMENT.get(key) if setter_method is None: @@ -3986,11 +4039,17 @@ def blob_from_jsonable(jsonable: Jsonable) -> aas_types.Blob: setter = _SetterForBlob() - if "modelType" not in jsonable: + model_type = jsonable.get("modelType", None) + if model_type is None: raise DeserializationException( "Expected the property modelType, but found none" ) + if model_type != "Blob": + raise DeserializationException( + f"Invalid modelType, expected 'Blob', " f"but got: {model_type!r}" + ) + for key, jsonable_value in jsonable.items(): setter_method = _SETTER_MAP_FOR_BLOB.get(key) if setter_method is None: @@ -4244,11 +4303,17 @@ def file_from_jsonable(jsonable: Jsonable) -> aas_types.File: setter = _SetterForFile() - if "modelType" not in jsonable: + model_type = jsonable.get("modelType", None) + if model_type is None: raise DeserializationException( "Expected the property modelType, but found none" ) + if model_type != "File": + raise DeserializationException( + f"Invalid modelType, expected 'File', " f"but got: {model_type!r}" + ) + for key, jsonable_value in jsonable.items(): setter_method = _SETTER_MAP_FOR_FILE.get(key) if setter_method is None: @@ -4529,11 +4594,18 @@ def annotated_relationship_element_from_jsonable( setter = _SetterForAnnotatedRelationshipElement() - if "modelType" not in jsonable: + model_type = jsonable.get("modelType", None) + if model_type is None: raise DeserializationException( "Expected the property modelType, but found none" ) + if model_type != "AnnotatedRelationshipElement": + raise DeserializationException( + f"Invalid modelType, expected 'AnnotatedRelationshipElement', " + f"but got: {model_type!r}" + ) + for key, jsonable_value in jsonable.items(): setter_method = _SETTER_MAP_FOR_ANNOTATED_RELATIONSHIP_ELEMENT.get(key) if setter_method is None: @@ -4841,11 +4913,17 @@ def entity_from_jsonable(jsonable: Jsonable) -> aas_types.Entity: setter = _SetterForEntity() - if "modelType" not in jsonable: + model_type = jsonable.get("modelType", None) + if model_type is None: raise DeserializationException( "Expected the property modelType, but found none" ) + if model_type != "Entity": + raise DeserializationException( + f"Invalid modelType, expected 'Entity', " f"but got: {model_type!r}" + ) + for key, jsonable_value in jsonable.items(): setter_method = _SETTER_MAP_FOR_ENTITY.get(key) if setter_method is None: @@ -5386,11 +5464,18 @@ def basic_event_element_from_jsonable( setter = _SetterForBasicEventElement() - if "modelType" not in jsonable: + model_type = jsonable.get("modelType", None) + if model_type is None: raise DeserializationException( "Expected the property modelType, but found none" ) + if model_type != "BasicEventElement": + raise DeserializationException( + f"Invalid modelType, expected 'BasicEventElement', " + f"but got: {model_type!r}" + ) + for key, jsonable_value in jsonable.items(): setter_method = _SETTER_MAP_FOR_BASIC_EVENT_ELEMENT.get(key) if setter_method is None: @@ -5713,11 +5798,17 @@ def operation_from_jsonable(jsonable: Jsonable) -> aas_types.Operation: setter = _SetterForOperation() - if "modelType" not in jsonable: + model_type = jsonable.get("modelType", None) + if model_type is None: raise DeserializationException( "Expected the property modelType, but found none" ) + if model_type != "Operation": + raise DeserializationException( + f"Invalid modelType, expected 'Operation', " f"but got: {model_type!r}" + ) + for key, jsonable_value in jsonable.items(): setter_method = _SETTER_MAP_FOR_OPERATION.get(key) if setter_method is None: @@ -6002,11 +6093,17 @@ def capability_from_jsonable(jsonable: Jsonable) -> aas_types.Capability: setter = _SetterForCapability() - if "modelType" not in jsonable: + model_type = jsonable.get("modelType", None) + if model_type is None: raise DeserializationException( "Expected the property modelType, but found none" ) + if model_type != "Capability": + raise DeserializationException( + f"Invalid modelType, expected 'Capability', " f"but got: {model_type!r}" + ) + for key, jsonable_value in jsonable.items(): setter_method = _SETTER_MAP_FOR_CAPABILITY.get(key) if setter_method is None: @@ -6223,11 +6320,18 @@ def concept_description_from_jsonable( setter = _SetterForConceptDescription() - if "modelType" not in jsonable: + model_type = jsonable.get("modelType", None) + if model_type is None: raise DeserializationException( "Expected the property modelType, but found none" ) + if model_type != "ConceptDescription": + raise DeserializationException( + f"Invalid modelType, expected 'ConceptDescription', " + f"but got: {model_type!r}" + ) + for key, jsonable_value in jsonable.items(): setter_method = _SETTER_MAP_FOR_CONCEPT_DESCRIPTION.get(key) if setter_method is None: @@ -7495,11 +7599,18 @@ def data_specification_iec_61360_from_jsonable( setter = _SetterForDataSpecificationIEC61360() - if "modelType" not in jsonable: + model_type = jsonable.get("modelType", None) + if model_type is None: raise DeserializationException( "Expected the property modelType, but found none" ) + if model_type != "DataSpecificationIec61360": + raise DeserializationException( + f"Invalid modelType, expected 'DataSpecificationIec61360', " + f"but got: {model_type!r}" + ) + for key, jsonable_value in jsonable.items(): setter_method = _SETTER_MAP_FOR_DATA_SPECIFICATION_IEC_61360.get(key) if setter_method is None: diff --git a/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/AnnotatedRelationshipElement/invalidModelType.json b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/AnnotatedRelationshipElement/invalidModelType.json new file mode 100644 index 00000000..da8ca7d2 --- /dev/null +++ b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/AnnotatedRelationshipElement/invalidModelType.json @@ -0,0 +1,32 @@ +{ + "submodels": [ + { + "id": "something_48c66017", + "modelType": "Submodel", + "submodelElements": [ + { + "first": { + "keys": [ + { + "type": "GlobalReference", + "value": "urn:another-company01:f390f801" + } + ], + "type": "ExternalReference" + }, + "idShort": "something3fdd3eb4", + "modelType": "aCompletelyInvalidModelType", + "second": { + "keys": [ + { + "type": "GlobalReference", + "value": "urn:an-example05:b7bf2725" + } + ], + "type": "ExternalReference" + } + } + ] + } + ] +} \ No newline at end of file diff --git a/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/AnnotatedRelationshipElement/invalidModelType.json.exception b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/AnnotatedRelationshipElement/invalidModelType.json.exception new file mode 100644 index 00000000..5813404d --- /dev/null +++ b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/AnnotatedRelationshipElement/invalidModelType.json.exception @@ -0,0 +1 @@ +submodels[0].submodelElements[0]: Unexpected model type for SubmodelElement: aCompletelyInvalidModelType \ No newline at end of file diff --git a/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/AssetAdministrationShell/invalidModelType.json b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/AssetAdministrationShell/invalidModelType.json new file mode 100644 index 00000000..58db7718 --- /dev/null +++ b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/AssetAdministrationShell/invalidModelType.json @@ -0,0 +1,12 @@ +{ + "assetAdministrationShells": [ + { + "assetInformation": { + "assetKind": "NotApplicable", + "globalAssetId": "something_eea66fa1" + }, + "id": "something_142922d6", + "modelType": "aCompletelyInvalidModelType" + } + ] +} \ No newline at end of file diff --git a/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/AssetAdministrationShell/invalidModelType.json.exception b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/AssetAdministrationShell/invalidModelType.json.exception new file mode 100644 index 00000000..cdf69c90 --- /dev/null +++ b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/AssetAdministrationShell/invalidModelType.json.exception @@ -0,0 +1 @@ +assetAdministrationShells[0]: Invalid modelType, expected 'AssetAdministrationShell', but got: 'aCompletelyInvalidModelType' \ No newline at end of file diff --git a/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/BasicEventElement/invalidModelType.json b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/BasicEventElement/invalidModelType.json new file mode 100644 index 00000000..8e466891 --- /dev/null +++ b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/BasicEventElement/invalidModelType.json @@ -0,0 +1,25 @@ +{ + "submodels": [ + { + "id": "something_48c66017", + "modelType": "Submodel", + "submodelElements": [ + { + "direction": "output", + "idShort": "something3fdd3eb4", + "modelType": "aCompletelyInvalidModelType", + "observed": { + "keys": [ + { + "type": "Submodel", + "value": "urn:another-example11:3679ef43" + } + ], + "type": "ModelReference" + }, + "state": "off" + } + ] + } + ] +} \ No newline at end of file diff --git a/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/BasicEventElement/invalidModelType.json.exception b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/BasicEventElement/invalidModelType.json.exception new file mode 100644 index 00000000..5813404d --- /dev/null +++ b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/BasicEventElement/invalidModelType.json.exception @@ -0,0 +1 @@ +submodels[0].submodelElements[0]: Unexpected model type for SubmodelElement: aCompletelyInvalidModelType \ No newline at end of file diff --git a/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/Blob/invalidModelType.json b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/Blob/invalidModelType.json new file mode 100644 index 00000000..b6b1c34c --- /dev/null +++ b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/Blob/invalidModelType.json @@ -0,0 +1,15 @@ +{ + "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", + "modelType": "aCompletelyInvalidModelType" + } + ] + } + ] +} \ No newline at end of file diff --git a/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/Blob/invalidModelType.json.exception b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/Blob/invalidModelType.json.exception new file mode 100644 index 00000000..5813404d --- /dev/null +++ b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/Blob/invalidModelType.json.exception @@ -0,0 +1 @@ +submodels[0].submodelElements[0]: Unexpected model type for SubmodelElement: aCompletelyInvalidModelType \ No newline at end of file diff --git a/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/Capability/invalidModelType.json b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/Capability/invalidModelType.json new file mode 100644 index 00000000..ea9d5664 --- /dev/null +++ b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/Capability/invalidModelType.json @@ -0,0 +1,14 @@ +{ + "submodels": [ + { + "id": "something_48c66017", + "modelType": "Submodel", + "submodelElements": [ + { + "idShort": "something3fdd3eb4", + "modelType": "aCompletelyInvalidModelType" + } + ] + } + ] +} \ No newline at end of file diff --git a/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/Capability/invalidModelType.json.exception b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/Capability/invalidModelType.json.exception new file mode 100644 index 00000000..5813404d --- /dev/null +++ b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/Capability/invalidModelType.json.exception @@ -0,0 +1 @@ +submodels[0].submodelElements[0]: Unexpected model type for SubmodelElement: aCompletelyInvalidModelType \ No newline at end of file diff --git a/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/ConceptDescription/invalidModelType.json b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/ConceptDescription/invalidModelType.json new file mode 100644 index 00000000..1a182f8a --- /dev/null +++ b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/ConceptDescription/invalidModelType.json @@ -0,0 +1,8 @@ +{ + "conceptDescriptions": [ + { + "id": "something_8ccad77f", + "modelType": "aCompletelyInvalidModelType" + } + ] +} \ No newline at end of file diff --git a/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/ConceptDescription/invalidModelType.json.exception b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/ConceptDescription/invalidModelType.json.exception new file mode 100644 index 00000000..bd41cd36 --- /dev/null +++ b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/ConceptDescription/invalidModelType.json.exception @@ -0,0 +1 @@ +conceptDescriptions[0]: Invalid modelType, expected 'ConceptDescription', but got: 'aCompletelyInvalidModelType' \ No newline at end of file diff --git a/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/DataSpecificationIec61360/invalidModelType.json b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/DataSpecificationIec61360/invalidModelType.json new file mode 100644 index 00000000..5261cd94 --- /dev/null +++ b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/DataSpecificationIec61360/invalidModelType.json @@ -0,0 +1,30 @@ +{ + "assetAdministrationShells": [ + { + "assetInformation": { + "assetKind": "NotApplicable", + "globalAssetId": "something_eea66fa1" + }, + "embeddedDataSpecifications": [ + { + "dataSpecificationContent": { + "modelType": "aCompletelyInvalidModelType", + "preferredName": [ + { + "language": "i-enochian", + "text": "something_84b0b440" + }, + { + "language": "en-GB", + "text": "Something random in English 5b15c20d" + } + ], + "value": "something_13759f45" + } + } + ], + "id": "something_142922d6", + "modelType": "AssetAdministrationShell" + } + ] +} \ No newline at end of file diff --git a/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/DataSpecificationIec61360/invalidModelType.json.exception b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/DataSpecificationIec61360/invalidModelType.json.exception new file mode 100644 index 00000000..b66bf13c --- /dev/null +++ b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/DataSpecificationIec61360/invalidModelType.json.exception @@ -0,0 +1 @@ +assetAdministrationShells[0].embeddedDataSpecifications[0].dataSpecificationContent: Unexpected model type for DataSpecificationContent: aCompletelyInvalidModelType \ No newline at end of file diff --git a/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/Entity/invalidModelType.json b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/Entity/invalidModelType.json new file mode 100644 index 00000000..fbb91894 --- /dev/null +++ b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/Entity/invalidModelType.json @@ -0,0 +1,15 @@ +{ + "submodels": [ + { + "id": "something_48c66017", + "modelType": "Submodel", + "submodelElements": [ + { + "entityType": "CoManagedEntity", + "idShort": "something3fdd3eb4", + "modelType": "aCompletelyInvalidModelType" + } + ] + } + ] +} \ No newline at end of file diff --git a/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/Entity/invalidModelType.json.exception b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/Entity/invalidModelType.json.exception new file mode 100644 index 00000000..5813404d --- /dev/null +++ b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/Entity/invalidModelType.json.exception @@ -0,0 +1 @@ +submodels[0].submodelElements[0]: Unexpected model type for SubmodelElement: aCompletelyInvalidModelType \ No newline at end of file diff --git a/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/File/invalidModelType.json b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/File/invalidModelType.json new file mode 100644 index 00000000..b6b1c34c --- /dev/null +++ b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/File/invalidModelType.json @@ -0,0 +1,15 @@ +{ + "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", + "modelType": "aCompletelyInvalidModelType" + } + ] + } + ] +} \ No newline at end of file diff --git a/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/File/invalidModelType.json.exception b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/File/invalidModelType.json.exception new file mode 100644 index 00000000..5813404d --- /dev/null +++ b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/File/invalidModelType.json.exception @@ -0,0 +1 @@ +submodels[0].submodelElements[0]: Unexpected model type for SubmodelElement: aCompletelyInvalidModelType \ No newline at end of file diff --git a/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/MultiLanguageProperty/invalidModelType.json b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/MultiLanguageProperty/invalidModelType.json new file mode 100644 index 00000000..ea9d5664 --- /dev/null +++ b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/MultiLanguageProperty/invalidModelType.json @@ -0,0 +1,14 @@ +{ + "submodels": [ + { + "id": "something_48c66017", + "modelType": "Submodel", + "submodelElements": [ + { + "idShort": "something3fdd3eb4", + "modelType": "aCompletelyInvalidModelType" + } + ] + } + ] +} \ No newline at end of file diff --git a/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/MultiLanguageProperty/invalidModelType.json.exception b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/MultiLanguageProperty/invalidModelType.json.exception new file mode 100644 index 00000000..5813404d --- /dev/null +++ b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/MultiLanguageProperty/invalidModelType.json.exception @@ -0,0 +1 @@ +submodels[0].submodelElements[0]: Unexpected model type for SubmodelElement: aCompletelyInvalidModelType \ No newline at end of file diff --git a/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/Operation/invalidModelType.json b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/Operation/invalidModelType.json new file mode 100644 index 00000000..ea9d5664 --- /dev/null +++ b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/Operation/invalidModelType.json @@ -0,0 +1,14 @@ +{ + "submodels": [ + { + "id": "something_48c66017", + "modelType": "Submodel", + "submodelElements": [ + { + "idShort": "something3fdd3eb4", + "modelType": "aCompletelyInvalidModelType" + } + ] + } + ] +} \ No newline at end of file diff --git a/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/Operation/invalidModelType.json.exception b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/Operation/invalidModelType.json.exception new file mode 100644 index 00000000..5813404d --- /dev/null +++ b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/Operation/invalidModelType.json.exception @@ -0,0 +1 @@ +submodels[0].submodelElements[0]: Unexpected model type for SubmodelElement: aCompletelyInvalidModelType \ No newline at end of file diff --git a/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/Property/invalidModelType.json b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/Property/invalidModelType.json new file mode 100644 index 00000000..b9a308a1 --- /dev/null +++ b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/Property/invalidModelType.json @@ -0,0 +1,15 @@ +{ + "submodels": [ + { + "id": "something_48c66017", + "modelType": "Submodel", + "submodelElements": [ + { + "idShort": "something3fdd3eb4", + "modelType": "aCompletelyInvalidModelType", + "valueType": "xs:decimal" + } + ] + } + ] +} \ No newline at end of file diff --git a/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/Property/invalidModelType.json.exception b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/Property/invalidModelType.json.exception new file mode 100644 index 00000000..5813404d --- /dev/null +++ b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/Property/invalidModelType.json.exception @@ -0,0 +1 @@ +submodels[0].submodelElements[0]: Unexpected model type for SubmodelElement: aCompletelyInvalidModelType \ No newline at end of file diff --git a/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/Range/invalidModelType.json b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/Range/invalidModelType.json new file mode 100644 index 00000000..b9a308a1 --- /dev/null +++ b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/Range/invalidModelType.json @@ -0,0 +1,15 @@ +{ + "submodels": [ + { + "id": "something_48c66017", + "modelType": "Submodel", + "submodelElements": [ + { + "idShort": "something3fdd3eb4", + "modelType": "aCompletelyInvalidModelType", + "valueType": "xs:decimal" + } + ] + } + ] +} \ No newline at end of file diff --git a/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/Range/invalidModelType.json.exception b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/Range/invalidModelType.json.exception new file mode 100644 index 00000000..5813404d --- /dev/null +++ b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/Range/invalidModelType.json.exception @@ -0,0 +1 @@ +submodels[0].submodelElements[0]: Unexpected model type for SubmodelElement: aCompletelyInvalidModelType \ No newline at end of file diff --git a/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/ReferenceElement/invalidModelType.json b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/ReferenceElement/invalidModelType.json new file mode 100644 index 00000000..ea9d5664 --- /dev/null +++ b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/ReferenceElement/invalidModelType.json @@ -0,0 +1,14 @@ +{ + "submodels": [ + { + "id": "something_48c66017", + "modelType": "Submodel", + "submodelElements": [ + { + "idShort": "something3fdd3eb4", + "modelType": "aCompletelyInvalidModelType" + } + ] + } + ] +} \ No newline at end of file diff --git a/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/ReferenceElement/invalidModelType.json.exception b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/ReferenceElement/invalidModelType.json.exception new file mode 100644 index 00000000..5813404d --- /dev/null +++ b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/ReferenceElement/invalidModelType.json.exception @@ -0,0 +1 @@ +submodels[0].submodelElements[0]: Unexpected model type for SubmodelElement: aCompletelyInvalidModelType \ No newline at end of file diff --git a/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/RelationshipElement/invalidModelType.json b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/RelationshipElement/invalidModelType.json new file mode 100644 index 00000000..da8ca7d2 --- /dev/null +++ b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/RelationshipElement/invalidModelType.json @@ -0,0 +1,32 @@ +{ + "submodels": [ + { + "id": "something_48c66017", + "modelType": "Submodel", + "submodelElements": [ + { + "first": { + "keys": [ + { + "type": "GlobalReference", + "value": "urn:another-company01:f390f801" + } + ], + "type": "ExternalReference" + }, + "idShort": "something3fdd3eb4", + "modelType": "aCompletelyInvalidModelType", + "second": { + "keys": [ + { + "type": "GlobalReference", + "value": "urn:an-example05:b7bf2725" + } + ], + "type": "ExternalReference" + } + } + ] + } + ] +} \ No newline at end of file diff --git a/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/RelationshipElement/invalidModelType.json.exception b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/RelationshipElement/invalidModelType.json.exception new file mode 100644 index 00000000..5813404d --- /dev/null +++ b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/RelationshipElement/invalidModelType.json.exception @@ -0,0 +1 @@ +submodels[0].submodelElements[0]: Unexpected model type for SubmodelElement: aCompletelyInvalidModelType \ No newline at end of file diff --git a/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/Submodel/invalidModelType.json b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/Submodel/invalidModelType.json new file mode 100644 index 00000000..f9e80030 --- /dev/null +++ b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/Submodel/invalidModelType.json @@ -0,0 +1,8 @@ +{ + "submodels": [ + { + "id": "something_48c66017", + "modelType": "aCompletelyInvalidModelType" + } + ] +} \ No newline at end of file diff --git a/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/Submodel/invalidModelType.json.exception b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/Submodel/invalidModelType.json.exception new file mode 100644 index 00000000..df05e454 --- /dev/null +++ b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/Submodel/invalidModelType.json.exception @@ -0,0 +1 @@ +submodels[0]: Invalid modelType, expected 'Submodel', but got: 'aCompletelyInvalidModelType' \ No newline at end of file diff --git a/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/SubmodelElementCollection/invalidModelType.json b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/SubmodelElementCollection/invalidModelType.json new file mode 100644 index 00000000..ea9d5664 --- /dev/null +++ b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/SubmodelElementCollection/invalidModelType.json @@ -0,0 +1,14 @@ +{ + "submodels": [ + { + "id": "something_48c66017", + "modelType": "Submodel", + "submodelElements": [ + { + "idShort": "something3fdd3eb4", + "modelType": "aCompletelyInvalidModelType" + } + ] + } + ] +} \ No newline at end of file diff --git a/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/SubmodelElementCollection/invalidModelType.json.exception b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/SubmodelElementCollection/invalidModelType.json.exception new file mode 100644 index 00000000..5813404d --- /dev/null +++ b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/SubmodelElementCollection/invalidModelType.json.exception @@ -0,0 +1 @@ +submodels[0].submodelElements[0]: Unexpected model type for SubmodelElement: aCompletelyInvalidModelType \ No newline at end of file diff --git a/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/SubmodelElementList/invalidModelType.json b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/SubmodelElementList/invalidModelType.json new file mode 100644 index 00000000..52a708c9 --- /dev/null +++ b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/SubmodelElementList/invalidModelType.json @@ -0,0 +1,15 @@ +{ + "submodels": [ + { + "id": "something_48c66017", + "modelType": "Submodel", + "submodelElements": [ + { + "idShort": "something3fdd3eb4", + "modelType": "aCompletelyInvalidModelType", + "typeValueListElement": "Entity" + } + ] + } + ] +} \ No newline at end of file diff --git a/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/SubmodelElementList/invalidModelType.json.exception b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/SubmodelElementList/invalidModelType.json.exception new file mode 100644 index 00000000..5813404d --- /dev/null +++ b/test_data/Json/ContainedInEnvironment/Unexpected/Unserializable/InvalidModelType/SubmodelElementList/invalidModelType.json.exception @@ -0,0 +1 @@ +submodels[0].submodelElements[0]: Unexpected model type for SubmodelElement: aCompletelyInvalidModelType \ No newline at end of file