Skip to main content
Version: 5.5

JSON Schema Validation

Purpose of Validation

Validation ensures that a JSON document corresponds to the expected structure and meets the requirements defined in the schema. The check is performed either when reading JSON data or when creating or patching in the transfer object.

Supported Validation Functions

The supported features and restrictions for validation are documented centrally in: 👉 json-schema-plugin.md There you will also find information on:

  • Partially supported constructs (allOf, oneOf, anyOf)
  • Special features for arrays and $ref
  • Recommendations for project planning

Error diagnosis and testing options

Validation in the JSON Schema transfer object offers two operating modes:

  • Mode 1 – Output errors as result items:

  • All validation errors are collected.

  • The fields IsValid and ValidationErrors contain the status and a structured list of violations.

    • Processing runs through completely.
  • The errors can be transmitted to external systems or logged in a database, for example, depending on the use case.

  • Mode 2 – Abort in case of violation:

  • The data transfer is aborted if validation is unsuccessful.

  • The error message appears in the status field of the transfer object and in the log file.

  • Triggers with retry logic can automatically restart the transfer. Further information on error diagnosis:

  • Validation errors include, among others:

  • Missing required fields (required)

  • Incorrect data types (type)

  • Invalid value ranges (enum, minimum, format, etc.)

  • Unresolved $ref references

  • Validation errors are documented in the log with the JsonPointer path and plain text.

  • Ensure that all referenced sub-schemas ($ref) are loaded correctly and accessible.

Examples of more complex validations

  • uns-machine-context.schema uses oneOf, anyOf, allOf to model alternative configurations.
  • job_status.schema uses enum, pattern, format to validate fields such as timestamps, status codes, and ID formats. These examples are installed with the OPC Router, but are not intended as productive templates; rather, they serve as examples of how JSON Schema can be used.

Legal notice: Included schemas such as OPC UA (opc.ua.openapi.allservices), Siemens IECTL, or Portainer are for illustrative purposes only. No claim is made as to their completeness or functionality.