Skip to content

Commit

Permalink
Check explicitly for invalid model types (#35)
Browse files Browse the repository at this point in the history
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 56482d65], and the test data
corresponds to [aas-core3.0-testgen 9e523511c].

This is related to the issue [aas-core3.0-python #32], which discovered
the problematic in the first place.

[aas-core-codegen 56482d65]: aas-core-works/aas-core-codegen@56482d65
[aas-core3.0-testgen 9e523511c]: aas-core-works/aas-core3.0-testgen@9e523511c
[aas-core3.0-python #32]: aas-core-works/aas-core3.0-python#32
  • Loading branch information
mristin authored Jul 20, 2024
1 parent f2d2a90 commit 8f72a15
Show file tree
Hide file tree
Showing 73 changed files with 1,422 additions and 52 deletions.
842 changes: 790 additions & 52 deletions jsonization/jsonization.go

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
submodels[0].submodelElements[0]: Unexpected model type for ISubmodelElement: aCompletelyInvalidModelType
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
assetAdministrationShells[0].modelType: Expected the model type 'AssetAdministrationShell', but got aCompletelyInvalidModelType
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
submodels[0].submodelElements[0]: Unexpected model type for ISubmodelElement: aCompletelyInvalidModelType
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
submodels[0].submodelElements[0]: Unexpected model type for ISubmodelElement: aCompletelyInvalidModelType
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
submodels[0].submodelElements[0]: Unexpected model type for ISubmodelElement: aCompletelyInvalidModelType
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
conceptDescriptions[0].modelType: Expected the model type 'ConceptDescription', but got aCompletelyInvalidModelType
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
assetAdministrationShells[0].embeddedDataSpecifications[0].dataSpecificationContent: Unexpected model type for IDataSpecificationContent: aCompletelyInvalidModelType
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
submodels[0].submodelElements[0]: Unexpected model type for ISubmodelElement: aCompletelyInvalidModelType
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
submodels[0].submodelElements[0]: Unexpected model type for ISubmodelElement: aCompletelyInvalidModelType
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
submodels[0].submodelElements[0]: Unexpected model type for ISubmodelElement: aCompletelyInvalidModelType
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
submodels[0].submodelElements[0]: Unexpected model type for ISubmodelElement: aCompletelyInvalidModelType
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
submodels[0].submodelElements[0]: Unexpected model type for ISubmodelElement: aCompletelyInvalidModelType
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
submodels[0].submodelElements[0]: Unexpected model type for ISubmodelElement: aCompletelyInvalidModelType
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
submodels[0].submodelElements[0]: Unexpected model type for ISubmodelElement: aCompletelyInvalidModelType
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
submodels[0].submodelElements[0]: Unexpected model type for ISubmodelElement: aCompletelyInvalidModelType
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
submodels[0].modelType: Expected the model type 'Submodel', but got aCompletelyInvalidModelType
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
submodels[0].submodelElements[0]: Unexpected model type for ISubmodelElement: aCompletelyInvalidModelType
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
submodels[0].submodelElements[0]: Unexpected model type for ISubmodelElement: aCompletelyInvalidModelType
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
submodels[0].submodelElements[0]: The required property modelType is missing
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
assetAdministrationShells[0]: The required property modelType is missing
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
submodels[0].submodelElements[0]: The required property modelType is missing
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
submodels[0].submodelElements[0]: The required property modelType is missing
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
submodels[0].submodelElements[0]: The required property modelType is missing
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
conceptDescriptions[0]: The required property modelType is missing
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
assetAdministrationShells[0].embeddedDataSpecifications[0].dataSpecificationContent: The required property modelType is missing
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
submodels[0].submodelElements[0]: The required property modelType is missing
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
submodels[0].submodelElements[0]: The required property modelType is missing
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
submodels[0].submodelElements[0]: The required property modelType is missing
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
submodels[0].submodelElements[0]: The required property modelType is missing
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
submodels[0].submodelElements[0]: The required property modelType is missing
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
submodels[0].submodelElements[0]: The required property modelType is missing
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
submodels[0].submodelElements[0]: The required property modelType is missing
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
submodels[0].submodelElements[0]: The required property modelType is missing
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
submodels[0]: The required property modelType is missing
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
submodels[0].submodelElements[0]: The required property modelType is missing
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
submodels[0].submodelElements[0]: The required property modelType is missing
Original file line number Diff line number Diff line change
@@ -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"
}
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"assetAdministrationShells": [
{
"assetInformation": {
"assetKind": "NotApplicable",
"globalAssetId": "something_eea66fa1"
},
"id": "something_142922d6",
"modelType": "aCompletelyInvalidModelType"
}
]
}
Original file line number Diff line number Diff line change
@@ -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"
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -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"
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"submodels": [
{
"id": "something_48c66017",
"modelType": "Submodel",
"submodelElements": [
{
"idShort": "something3fdd3eb4",
"modelType": "aCompletelyInvalidModelType"
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"conceptDescriptions": [
{
"id": "something_8ccad77f",
"modelType": "aCompletelyInvalidModelType"
}
]
}
Original file line number Diff line number Diff line change
@@ -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"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"submodels": [
{
"id": "something_48c66017",
"modelType": "Submodel",
"submodelElements": [
{
"entityType": "CoManagedEntity",
"idShort": "something3fdd3eb4",
"modelType": "aCompletelyInvalidModelType"
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -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"
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"submodels": [
{
"id": "something_48c66017",
"modelType": "Submodel",
"submodelElements": [
{
"idShort": "something3fdd3eb4",
"modelType": "aCompletelyInvalidModelType"
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"submodels": [
{
"id": "something_48c66017",
"modelType": "Submodel",
"submodelElements": [
{
"idShort": "something3fdd3eb4",
"modelType": "aCompletelyInvalidModelType"
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"submodels": [
{
"id": "something_48c66017",
"modelType": "Submodel",
"submodelElements": [
{
"idShort": "something3fdd3eb4",
"modelType": "aCompletelyInvalidModelType",
"valueType": "xs:decimal"
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"submodels": [
{
"id": "something_48c66017",
"modelType": "Submodel",
"submodelElements": [
{
"idShort": "something3fdd3eb4",
"modelType": "aCompletelyInvalidModelType",
"valueType": "xs:decimal"
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"submodels": [
{
"id": "something_48c66017",
"modelType": "Submodel",
"submodelElements": [
{
"idShort": "something3fdd3eb4",
"modelType": "aCompletelyInvalidModelType"
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -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"
}
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"submodels": [
{
"id": "something_48c66017",
"modelType": "aCompletelyInvalidModelType"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"submodels": [
{
"id": "something_48c66017",
"modelType": "Submodel",
"submodelElements": [
{
"idShort": "something3fdd3eb4",
"modelType": "aCompletelyInvalidModelType"
}
]
}
]
}
Loading

0 comments on commit 8f72a15

Please sign in to comment.