JSON-Schema for the Value-Only Serialization

The following JSON-Schema represents the validation schema for the ValueOnly-Serialization of submodel elements. This holds true for all submodel elements mentioned in the previous clause except for SubmodelElementCollections. Since SubmodelElementCollections are treated as objects containing submodel elements of any kind, the integration into the same validation schema would result in a circular reference or ambiguous results ignoring the actual validation of submodel elements other than SubmodelElementCollections. Hence, the same validation schema must be applied for each SubmodelElementCollection within a submodel element hierarchy. In this case, it may be necessary to create a specific JSON-Schema for the individual use case. The SubmodelElementCollection is added to the following schema for completeness and clarity. It is, however, not referenced from the SubmodelElementValue-oneOf-Enumeration due to the reasons mentioned above.

See Annex ValueOnly-Serialization Example for an example that validates against this schema

{
  "$schema": "https://json-schema.org/draft/2019-09/schema",
  "title": "ValueOnly-Serialization-Schema",
  "$id": "https://admin-shell.io/schema/valueonly/json/V3.0",
  "definitions": {
    "AnnotatedRelationshipElementValue": {
      "type": "object",
      "properties": {
        "first": {
          "$ref": "#/definitions/ReferenceValue"
        },
        "second": {
          "$ref": "#/definitions/ReferenceValue"
        },
        "annotations": {
          "$ref": "#/definitions/ValueOnly"
        }
      },
      "required": [
        "first",
        "second"
      ],
      "additionalProperties": false
    },
    "BasicEventElementValue": {
      "type": "object",
      "properties": {
        "observed": {
          "$ref": "#/definitions/ReferenceValue"
        }
      },
      "required": [
        "observed"
      ],
      "additionalProperties": false
    },
    "BlobValue": {
      "type": "object",
      "properties": {
        "contentType": {
          "type": "string",
          "minLength": "1",
          "maxLength": "100"
        },
        "value": {
          "type": "string",
          "minLength": 1
        }
      },
      "required": [
        "contentType"
      ],
      "additionalProperties": false
    },
    "BooleanValue": {
      "type": "boolean",
      "additionalProperties": false
    },
    "EntityValue": {
      "type": "object",
      "properties": {
        "statements": {
          "$ref": "#/definitions/ValueOnly"
        },
        "entityType": {
          "enum": [
            "SelfManagedEntity",
            "CoManagedEntity"
          ]
        },
        "globalAssetId": {
          "type": "string"
        },
        "specificAssetIds": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/SpecificAssetIdValue"
          }
        }
      },
      "required": [
        "entityType"
      ],
      "additionalProperties": false
    },
    "FileValue": {
      "type": "object",
      "properties": {
        "contentType": {
          "type": "string",
          "minLength": "1",
          "maxLength": "100"
        },
        "value": {
          "type": "string",
          "minLength": "1",
          "maxLength": "2000"
        }
      },
      "required": [
        "contentType"
      ],
      "additionalProperties": false
    },
    "Identifier": {
      "type": "string"
    },
    "Key": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string"
        },
        "value": {
          "type": "string"
        }
      },
      "required": [
        "type",
        "value"
      ],
      "additionalProperties": false
    },
    "LangString": {
      "type": "object",
      "patternProperties": {
        "^[a-z]{2,4}(-[A-Z][a-z]{3})?(-([A-Z]{2}|[0-9]{3}))?$": {
          "type": "string"
        }
      },
      "additionalProperties": false
    },
    "MultiLanguagePropertyValue": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/LangString"
      },
      "additionalProperties": false
    },
    "NumberValue": {
      "type": "number",
      "additionalProperties": false
    },
    "OperationRequestValueOnly": {
      "inoutputArguments": {
        "$ref": "#/definitions/ValueOnly"
      },
      "inputArguments": {
        "$ref": "#/definitions/ValueOnly"
      },
      "timestamp": {
        "type": "string",
        "pattern": "^-?(([1-9][0-9][0-9][0-9]+)|(0[0-9][0-9][0-9]))-((0[1-9])|(1[0-2]))-((0[1-9])|([12][0-9])|(3[01]))T(((([01][0-9])|(2[0-3])):[0-5][0-9]:([0-5][0-9])(\\.[0-9]+)?)|24:00:00(\\.0+)?)(Z|\\+00:00|-00:00)$"
      },
      "additionalProperties": false
    },
    "OperationResultValueOnly": {
      "executionState": {
        "type": "string",
        "enum": ["Initiated", "Running", "Completed", "Canceled",
                 "Failed", "Timeout"]
      },
      "inoutputArguments": {
        "$ref": "#/definitions/ValueOnly"
      },
      "outputArguments": {
        "$ref": "#/definitions/ValueOnly"
      },
      "additionalProperties": false
    },
    "PropertyValue": {
      "oneOf": [
        {
          "$ref": "#/definitions/StringValue"
        },
        {
          "$ref": "#/definitions/NumberValue"
        },
        {
          "$ref": "#/definitions/BooleanValue"
        }
      ]
    },
    "RangeValue": {
      "type": "object",
      "properties": {
        "min": {
          "$ref": "#/definitions/RangeValueType"
        },
        "max": {
          "$ref": "#/definitions/RangeValueType"
        }
      },
      "additionalProperties": false
    },
    "RangeValueType": {
      "oneOf": [
        {
          "$ref": "#/definitions/StringValue"
        },
        {
          "$ref": "#/definitions/NumberValue"
        },
        {
          "$ref": "#/definitions/BooleanValue"
        }
      ]
    },
    "ReferenceElementValue": {
      "$ref": "#/definitions/ReferenceValue"
    },
    "ReferenceValue": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": ["ModelReference", "ExternalReference"]
        },
        "keys": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/Key"
          }
        }
      },
      "additionalProperties": false
    },
    "RelationshipElementValue": {
      "type": "object",
      "properties": {
        "first": {
          "$ref": "#/definitions/ReferenceValue"
        },
        "second": {
          "$ref": "#/definitions/ReferenceValue"
        }
      },
      "required": [
        "first",
        "second"
      ],
      "additionalProperties": false
    },
    "SpecificAssetIdValue": {
      "type": "object",
      "patternProperties": {
        "(.*?)": {
          "type": "string"
        }
      }
    },
    "StringValue": {
      "type": "string",
      "additionalProperties": false
    },
    "SubmodelElementCollectionValue": {
      "$ref": "#/definitions/ValueOnly"
    },
    "SubmodelElementListValue": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/SubmodelElementValue"
      }
    },
    "SubmodelElementValue": {
      "oneOf": [
        {
          "$ref": "#/definitions/BasicEventElementValue"
        },
        {
          "$ref": "#/definitions/RangeValue"
        },
        {
          "$ref": "#/definitions/MultiLanguagePropertyValue"
        },
        {
          "$ref": "#/definitions/FileBlobValue"
        },
        {
          "$ref": "#/definitions/ReferenceElementValue"
        },
        {
          "$ref": "#/definitions/RelationshipElementValue"
        },
        {
          "$ref": "#/definitions/AnnotatedRelationshipElementValue"
        },
        {
          "$ref": "#/definitions/EntityValue"
        },
        {
          "$ref": "#/definitions/PropertyValue"
        },
        {
          "$ref": "#/definitions/SubmodelElementListValue"
        }
      ]
    },
    "ValueOnly": {
      "propertyNames": {
        "pattern": "^[A-Za-z_][A-Za-z0-9_-]*$"
      },
      "patternProperties": {
        "^[A-Za-z_][A-Za-z0-9_-]*$": {
          "$ref": "#/definitions/SubmodelElementValue"
        }
      },
      "additionalProperties": false
    }
  }
}