-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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]: aas-core-works/aas-core-codegen@cd92d208 [aas-core3.0-testgen 9e523511c]: aas-core-works/aas-core3.0-testgen@9e523511c
- Loading branch information
Showing
37 changed files
with
453 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
...pected/Unserializable/InvalidModelType/AnnotatedRelationshipElement/invalidModelType.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
} | ||
] | ||
} | ||
] | ||
} |
1 change: 1 addition & 0 deletions
1
...erializable/InvalidModelType/AnnotatedRelationshipElement/invalidModelType.json.exception
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
submodels[0].submodelElements[0]: Unexpected model type for SubmodelElement: aCompletelyInvalidModelType |
12 changes: 12 additions & 0 deletions
12
...Unexpected/Unserializable/InvalidModelType/AssetAdministrationShell/invalidModelType.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
] | ||
} |
1 change: 1 addition & 0 deletions
1
.../Unserializable/InvalidModelType/AssetAdministrationShell/invalidModelType.json.exception
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
assetAdministrationShells[0]: Invalid modelType, expected 'AssetAdministrationShell', but got: 'aCompletelyInvalidModelType' |
Oops, something went wrong.