AutomationFlowsGeneral › Code Pro — Zod Validation

Code Pro — Zod Validation

Code Pro — Zod validation. Uses n8n-nodes-code-pro. Event-driven trigger; 3 nodes.

Event trigger★★★★☆ complexity3 nodesN8N Nodes Code Pro
General Trigger: Event Nodes: 3 Complexity: ★★★★☆ Added:

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "name": "Code Pro \u2014 Zod validation",
  "nodes": [
    {
      "parameters": {},
      "id": "manual-trigger",
      "name": "When clicking \u2018Execute workflow\u2019",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        0,
        0
      ]
    },
    {
      "parameters": {
        "jsCode": "return [\n  { json: { email: 'ok@example.com', age: 30 } },\n  { json: { email: 'bad', age: 12 } }\n];"
      },
      "id": "sample-data",
      "name": "Sample Data",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        240,
        0
      ]
    },
    {
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "const schema = z.object({\n  email: z.string().email(),\n  age: z.number().int().min(18),\n});\n\nconst result = schema.safeParse($json);\n\nif (!result.success) {\n  return {\n    json: {\n      valid: false,\n      errors: result.error.issues.map((i) => i.message),\n      input: $json,\n    },\n  };\n}\n\nreturn {\n  json: {\n    valid: true,\n    data: result.data,\n  },\n};\n",
        "options": {
          "timeout": 30,
          "maxOutputItems": 10000
        }
      },
      "id": "code-pro",
      "name": "Code Pro",
      "type": "n8n-nodes-code-pro.codePro",
      "typeVersion": 1,
      "position": [
        480,
        0
      ]
    }
  ],
  "connections": {
    "When clicking \u2018Execute workflow\u2019": {
      "main": [
        [
          {
            "node": "Sample Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Sample Data": {
      "main": [
        [
          {
            "node": "Code Pro",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  }
}
Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Code Pro — Zod validation. Uses n8n-nodes-code-pro. Event-driven trigger; 3 nodes.

Source: https://github.com/Danielnke/n8n-nodes-code-pro/blob/522ada85ada251f39375320118eb181b3ec0fd54/examples/code-pro-validate-zod.json — original creator credit. Request a take-down →

More General workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

General

This workflow contains community nodes that are only compatible with the self-hosted version of n8n.

Read Binary File, Write Binary File, Execute Command
General

A modular schema checker that returns detailed error messages on validation failure.

Execute Workflow Trigger
General

Subworkflow-Debugging-Execute-Workflow. Uses debugHelper. Event-driven trigger; 15 nodes.

Debug Helper
General

Validate Totp Token Without Creating A Credential. Uses manualTrigger, stickyNote. Event-driven trigger; 5 nodes.

General

📄 Extract Key Value from JSON - n8n Workflow. Event-driven trigger; 5 nodes.