Validator V2

Discover more about the Validator V2 component and how to use it on the Digibee Integration Platform.

Validator V2 (JSON Schema) validates JSON content based on a JSON Schema.

JSON Schema is a market standard language for annotating and validating JSON documents that act as a "contract" that must be followed by the component. For more information about it, refer to the official JSON documentation.

Parameters

Take a look at the configuration options for the component. Parameters supported by Double Braces expressions are marked with (DB).

Parameter
Description
Default value
Data type

Schema Draft version

Schema Draft version. Supported versions: v4, v6, v7, v2019-09, and v2020-12.

v4

String

Detect Draft version

If this option is active, the Schema Draft version will be based on the version inserted in the JSON Schema parameter.

False

Boolean

JSON Payload (DB)

The JSON content to be validated.

N/A

String

JSON Schema (DB)

The JSON Schema to be used as the basis for validating the JSON content.

N/A

String

Simplify validation results

If this option is active, validation errors will be shown in a simplified way; otherwise, they will be displayed in a detailed way.

False

Boolean

Fail on Error

If the option is active, the execution of the pipeline with an error will be interrupted. Otherwise, the pipeline execution proceeds, but the result will show a false value for the “success” property.

False

Boolean

Messages flow

Output

If Validator V2 successfully validates the JSON content, it outputs the JSON configured in the JSON Payload parameter.

In case of error, the component outputs a JSON content with the following structure by default:

{
    "success": false,
    "validation": [
        {
            "type": "type",
            "code": "1029",
            "path": "$.code",
            "schemaPath": "#/properties/code/type",
            "arguments": [
                "string",
                "integer"
            ],
            "details": null,
            "message": "$.code: string found, integer expected"
        },
        {
            "type": "required",
            "code": "1028",
            "path": "$",
            "schemaPath": "#/required",
            "arguments": [
                "field"
            ],
            "details": null,
            "message": "$.field: is missing but it is required"
        }
    ]
}

The "validation" array contains a JSON object for each validation performed. Each JSON object has the following properties:

  • type: the type of the applied validation.

  • code: internal validation code.

  • path: path where the validated property is configured on the JSON content.

  • schemaPath: path where the validated property is configured on the JSON Schema.

  • arguments: data of the analyzed property during validation.

  • details: additional validation details.

  • message: message of the validation error found.

If the Simplify validation results parameter is active, the “validation” array will contain only error messages, like this:

{
    "success": false,
    "validation": [
        "$.code: string found, integer expected",
        "$.field: is missing but it is required"
    ]
}

If the Fail on Error parameter is activated, a status error http 500 (Internal Server Error) is returned for every error that occurs when the component is executed:

{
  "timestamp": 1703004877585,
  "error": "com.digibee.pipelineengine.elements.connector.ValidatorConnectorV2$PayloadNotMatchSchemaException: [{\"type\":\"required\",\"code\":\"1028\",\"path\":\"$\",\"schemaPath\":\"#/required\",\"arguments\":[\"nome\"],\"details\":null,\"message\":\"$.nome: is missing but it is required\"}]",
  "code": 500
}

Last updated