Schema
Uncontrolled node
Overview
The Schema node creates and outputs JSON schema definitions that can be used to validate data structures or enforce structured output formats in other nodes. This node is particularly useful when working with AI generation nodes (like AI Write Data) that need to produce data matching a specific schema, or for validating data against a predefined structure.
The node provides a visual schema editor interface where you can define the structure, types, and constraints of your data. The schema is parsed and output as a JSON object that can be consumed by other nodes in your workflow.
Inputs
This node has no inputs.
Outputs
| Output | Type | Description |
|---|---|---|
| output | Data | Contains the parsed JSON schema object, or an error object if the schema is invalid or null. |
Properties
| Property | Type | Description | Default |
|---|---|---|---|
| schema | Schema | The JSON schema definition created via the schema editor UI. This defines the structure, types, and validation rules for your data. | null |
Runtime Behavior
When the workflow runs, the Schema node immediately parses the schema definition stored in its schema property. If the schema is valid JSON, it outputs the parsed schema object through the output socket. If the schema is null, empty, or contains invalid JSON, the node outputs an error object with a descriptive message.
Since this is an uncontrolled node, it does not wait for a run event and outputs its data immediately when requested by downstream nodes.
Example Usage
Structured AI Output
Connect the Schema node to the Schema input of an AI Write Data node to enforce a specific JSON structure for AI-generated content:
[Schema Node] --(output)--> [AI Write Data Node: schema input]
^
|
[Text Node: prompt] ----------------+
In this setup, the AI Write Data node will use the schema definition to constrain the AI's output to match the specified structure (e.g., ensuring the AI returns an object with specific fields like name, age, and email with correct data types).
Data Validation
You can also use the Schema node with validation nodes (like Assert or custom code nodes) to validate that incoming data matches an expected structure before processing it further in your workflow.
Schema Definition
The schema property accepts standard JSON Schema format. For example, a simple schema might look like:
{
"type": "object",
"properties": {
"name": {"type": "string"},
"age": {"type": "number"},
"email": {"type": "string"}
},
"required": ["name", "email"]
}
When using with AI Write Data, ensure your schema is compatible with the AI model's JSON mode capabilities. Complex nested schemas are supported, but very deep nesting may exceed the model's context window when serialized.