Skip to main content

Validate Schema

Uncontrolled node

Overview

The Validate Schema node validates data against a JSON Schema and outputs whether the data matches the schema. It uses AJV with format support, so standard JSON Schema validation rules and common formats such as email, URI, and date-time can be checked.

This node is useful when you need to verify structured data before passing it to downstream nodes, storing it in a database, or using it as the output of an AI Write Data workflow.

Inputs

InputTypeDescriptionDefault
DataDataThe data to validate. If provided as a JSON string, the node attempts to parse it before validation.-
Json SchemaDataThe JSON Schema to validate against. This can be connected from a Schema node or configured in the schema editor. If provided as a JSON string, the node attempts to parse it before validation.-

Outputs

OutputTypeDescription
Is ValidDatatrue when the data matches the schema, otherwise false.
ErrorsDataA list of validation error messages. Returns an empty list when the data is valid.

Runtime Behavior and Defaults

  • Uncontrolled Node: This node runs automatically when its inputs are available or change. It does not require an event trigger.
  • JSON Parsing: If Data or Json Schema is a string, the node attempts to parse it as JSON before validation.
  • Schema Validation: The schema must be a valid JSON Schema object. If the schema is missing, invalid, or cannot be parsed, Is Valid is false.
  • Error Output: Validation errors are returned as readable strings that include the failing instance path and AJV error message.
  • Format Support: AJV format validation is enabled through ajv-formats, allowing schemas to validate supported string formats.

Example Usage

Validating Data Before Insert

Connect a Schema node to Json Schema and the data you want to check to Data. Then use an If node to branch based on Is Valid.

{
"type": "object",
"properties": {
"name": { "type": "string" },
"email": { "type": "string", "format": "email" }
},
"required": ["name", "email"]
}

If the data is:

{
"name": "Alex",
"email": "alex@example.com"
}

Is Valid will be true and Errors will be an empty list.

If the email is missing or not a valid email address, Is Valid will be false and Errors will contain messages describing what failed.

tip

Use the Schema node when you want to build the schema visually, then connect its output directly to Json Schema.