Skip to content

Commit

Permalink
Explicitly check for null in JSON de-serialization (#43)
Browse files Browse the repository at this point in the history
We explicitly check that both optional and required properties can not
be set to ``null``. The optional properties should be explicitly absent
from the object by specification, and thus ``null`` is not an acceptable
value for optional properties.

Fixes #41.

Generated with [aas-core-codegen 0ec5c403].

[aas-core-codegen 0ec5c403]: aas-core-works/aas-core-codegen@0ec5c403
  • Loading branch information
mristin authored Sep 4, 2024
1 parent 6e224b9 commit 6080bc6
Show file tree
Hide file tree
Showing 55 changed files with 1,948 additions and 344 deletions.
2,184 changes: 1,894 additions & 290 deletions src/AasCore.Aas3_0/jsonization.cs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1 +1 @@
Required property "first" is missing at: submodels[0].submodelElements[0]
Unexpected null for a required property at: submodels[0].submodelElements[0].first
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Required property "second" is missing at: submodels[0].submodelElements[0]
Unexpected null for a required property at: submodels[0].submodelElements[0].second
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Required property "assetInformation" is missing at: assetAdministrationShells[0]
Unexpected null for a required property at: assetAdministrationShells[0].assetInformation
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Required property "id" is missing at: assetAdministrationShells[0]
Unexpected null for a required property at: assetAdministrationShells[0].id
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Required property "assetKind" is missing at: assetAdministrationShells[0].assetInformation
Unexpected null for a required property at: assetAdministrationShells[0].assetInformation.assetKind
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Required property "direction" is missing at: submodels[0].submodelElements[0]
Unexpected null for a required property at: submodels[0].submodelElements[0].direction
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Required property "observed" is missing at: submodels[0].submodelElements[0]
Unexpected null for a required property at: submodels[0].submodelElements[0].observed
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Required property "state" is missing at: submodels[0].submodelElements[0]
Unexpected null for a required property at: submodels[0].submodelElements[0].state
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Required property "contentType" is missing at: submodels[0].submodelElements[0]
Unexpected null for a required property at: submodels[0].submodelElements[0].contentType
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Required property "id" is missing at: conceptDescriptions[0]
Unexpected null for a required property at: conceptDescriptions[0].id
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Required property "preferredName" is missing at: assetAdministrationShells[0].embeddedDataSpecifications[0].dataSpecificationContent
Unexpected null for a required property at: assetAdministrationShells[0].embeddedDataSpecifications[0].dataSpecificationContent.preferredName
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Required property "dataSpecification" is missing at: assetAdministrationShells[0].embeddedDataSpecifications[0]
Unexpected null for a required property at: assetAdministrationShells[0].embeddedDataSpecifications[0].dataSpecification
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Required property "dataSpecificationContent" is missing at: assetAdministrationShells[0].embeddedDataSpecifications[0]
Unexpected null for a required property at: assetAdministrationShells[0].embeddedDataSpecifications[0].dataSpecificationContent
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Required property "entityType" is missing at: submodels[0].submodelElements[0]
Unexpected null for a required property at: submodels[0].submodelElements[0].entityType
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Required property "name" is missing at: assetAdministrationShells[0].extensions[0]
Unexpected null for a required property at: assetAdministrationShells[0].extensions[0].name
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Required property "contentType" is missing at: submodels[0].submodelElements[0]
Unexpected null for a required property at: submodels[0].submodelElements[0].contentType
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Required property "type" is missing at: assetAdministrationShells[0].derivedFrom.keys[0]
Unexpected null for a required property at: assetAdministrationShells[0].derivedFrom.keys[0].type
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Required property "value" is missing at: assetAdministrationShells[0].derivedFrom.keys[0]
Unexpected null for a required property at: assetAdministrationShells[0].derivedFrom.keys[0].value
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Required property "language" is missing at: assetAdministrationShells[0].embeddedDataSpecifications[0].dataSpecificationContent.definition[0]
Unexpected null for a required property at: assetAdministrationShells[0].embeddedDataSpecifications[0].dataSpecificationContent.definition[0].language
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Required property "text" is missing at: assetAdministrationShells[0].embeddedDataSpecifications[0].dataSpecificationContent.definition[0]
Unexpected null for a required property at: assetAdministrationShells[0].embeddedDataSpecifications[0].dataSpecificationContent.definition[0].text
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Required property "language" is missing at: assetAdministrationShells[0].displayName[0]
Unexpected null for a required property at: assetAdministrationShells[0].displayName[0].language
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Required property "text" is missing at: assetAdministrationShells[0].displayName[0]
Unexpected null for a required property at: assetAdministrationShells[0].displayName[0].text
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Required property "language" is missing at: assetAdministrationShells[0].embeddedDataSpecifications[0].dataSpecificationContent.preferredName[0]
Unexpected null for a required property at: assetAdministrationShells[0].embeddedDataSpecifications[0].dataSpecificationContent.preferredName[0].language
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Required property "text" is missing at: assetAdministrationShells[0].embeddedDataSpecifications[0].dataSpecificationContent.preferredName[0]
Unexpected null for a required property at: assetAdministrationShells[0].embeddedDataSpecifications[0].dataSpecificationContent.preferredName[0].text
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Required property "language" is missing at: assetAdministrationShells[0].embeddedDataSpecifications[0].dataSpecificationContent.shortName[0]
Unexpected null for a required property at: assetAdministrationShells[0].embeddedDataSpecifications[0].dataSpecificationContent.shortName[0].language
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Required property "text" is missing at: assetAdministrationShells[0].embeddedDataSpecifications[0].dataSpecificationContent.shortName[0]
Unexpected null for a required property at: assetAdministrationShells[0].embeddedDataSpecifications[0].dataSpecificationContent.shortName[0].text
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Required property "language" is missing at: assetAdministrationShells[0].description[0]
Unexpected null for a required property at: assetAdministrationShells[0].description[0].language
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Required property "text" is missing at: assetAdministrationShells[0].description[0]
Unexpected null for a required property at: assetAdministrationShells[0].description[0].text
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Required property "max" is missing at: assetAdministrationShells[0].embeddedDataSpecifications[0].dataSpecificationContent.levelType
Unexpected null for a required property at: assetAdministrationShells[0].embeddedDataSpecifications[0].dataSpecificationContent.levelType.max
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Required property "min" is missing at: assetAdministrationShells[0].embeddedDataSpecifications[0].dataSpecificationContent.levelType
Unexpected null for a required property at: assetAdministrationShells[0].embeddedDataSpecifications[0].dataSpecificationContent.levelType.min
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Required property "nom" is missing at: assetAdministrationShells[0].embeddedDataSpecifications[0].dataSpecificationContent.levelType
Unexpected null for a required property at: assetAdministrationShells[0].embeddedDataSpecifications[0].dataSpecificationContent.levelType.nom
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Required property "typ" is missing at: assetAdministrationShells[0].embeddedDataSpecifications[0].dataSpecificationContent.levelType
Unexpected null for a required property at: assetAdministrationShells[0].embeddedDataSpecifications[0].dataSpecificationContent.levelType.typ
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Required property "value" is missing at: submodels[0].submodelElements[0].inputVariables[0]
Unexpected null for a required property at: submodels[0].submodelElements[0].inputVariables[0].value
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Required property "valueType" is missing at: submodels[0].submodelElements[0]
Unexpected null for a required property at: submodels[0].submodelElements[0].valueType
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Required property "type" is missing at: submodels[0].qualifiers[0]
Unexpected null for a required property at: submodels[0].qualifiers[0].type
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Required property "valueType" is missing at: submodels[0].qualifiers[0]
Unexpected null for a required property at: submodels[0].qualifiers[0].valueType
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Required property "valueType" is missing at: submodels[0].submodelElements[0]
Unexpected null for a required property at: submodels[0].submodelElements[0].valueType
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Required property "keys" is missing at: assetAdministrationShells[0].derivedFrom
Unexpected null for a required property at: assetAdministrationShells[0].derivedFrom.keys
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Required property "type" is missing at: assetAdministrationShells[0].derivedFrom
Unexpected null for a required property at: assetAdministrationShells[0].derivedFrom.type
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Required property "first" is missing at: submodels[0].submodelElements[0]
Unexpected null for a required property at: submodels[0].submodelElements[0].first
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Required property "second" is missing at: submodels[0].submodelElements[0]
Unexpected null for a required property at: submodels[0].submodelElements[0].second
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Required property "path" is missing at: assetAdministrationShells[0].assetInformation.defaultThumbnail
Unexpected null for a required property at: assetAdministrationShells[0].assetInformation.defaultThumbnail.path
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Required property "name" is missing at: assetAdministrationShells[0].assetInformation.specificAssetIds[0]
Unexpected null for a required property at: assetAdministrationShells[0].assetInformation.specificAssetIds[0].name
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Required property "value" is missing at: assetAdministrationShells[0].assetInformation.specificAssetIds[0]
Unexpected null for a required property at: assetAdministrationShells[0].assetInformation.specificAssetIds[0].value
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Required property "id" is missing at: submodels[0]
Unexpected null for a required property at: submodels[0].id
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Required property "typeValueListElement" is missing at: submodels[0].submodelElements[0]
Unexpected null for a required property at: submodels[0].submodelElements[0].typeValueListElement
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Required property "valueReferencePairs" is missing at: assetAdministrationShells[0].embeddedDataSpecifications[0].dataSpecificationContent.valueList
Unexpected null for a required property at: assetAdministrationShells[0].embeddedDataSpecifications[0].dataSpecificationContent.valueList.valueReferencePairs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Required property "value" is missing at: assetAdministrationShells[0].embeddedDataSpecifications[0].dataSpecificationContent.valueList.valueReferencePairs[0]
Unexpected null for a required property at: assetAdministrationShells[0].embeddedDataSpecifications[0].dataSpecificationContent.valueList.valueReferencePairs[0].value
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Required property "valueId" is missing at: assetAdministrationShells[0].embeddedDataSpecifications[0].dataSpecificationContent.valueList.valueReferencePairs[0]
Unexpected null for a required property at: assetAdministrationShells[0].embeddedDataSpecifications[0].dataSpecificationContent.valueList.valueReferencePairs[0].valueId
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Expected Nodes.JsonObject, but got {node.GetType()} at: assetAdministrationShells[0].embeddedDataSpecifications[0].dataSpecificationContent
Expected Nodes.JsonObject, but got System.Text.Json.Nodes.JsonValueTrimmable`1[System.Text.Json.JsonElement] at: assetAdministrationShells[0].embeddedDataSpecifications[0].dataSpecificationContent
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Expected Nodes.JsonObject, but got {node.GetType()} at: submodels[0].submodelElements[0].inputVariables[0].value
Expected Nodes.JsonObject, but got System.Text.Json.Nodes.JsonValueTrimmable`1[System.Text.Json.JsonElement] at: submodels[0].submodelElements[0].inputVariables[0].value
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Required property "observableReference" is missing at:
Unexpected null for a required property at: observableReference
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Required property "source" is missing at:
Unexpected null for a required property at: source
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Required property "timeStamp" is missing at:
Unexpected null for a required property at: timeStamp

0 comments on commit 6080bc6

Please sign in to comment.