From 06e938687584d4f3a57a444171396152b0491c59 Mon Sep 17 00:00:00 2001 From: Daria Date: Fri, 16 May 2025 16:48:08 +0300 Subject: [PATCH] fix(Execute Workflow Trigger Node): Show helpful error message when passing array to JSON Example (#15458) --- .../GenericFunctions.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/nodes-base/utils/workflowInputsResourceMapping/GenericFunctions.ts b/packages/nodes-base/utils/workflowInputsResourceMapping/GenericFunctions.ts index 441e14c4b4..9cdf1538c1 100644 --- a/packages/nodes-base/utils/workflowInputsResourceMapping/GenericFunctions.ts +++ b/packages/nodes-base/utils/workflowInputsResourceMapping/GenericFunctions.ts @@ -27,6 +27,18 @@ import { const SUPPORTED_TYPES = TYPE_OPTIONS.map((x) => x.value); function parseJsonSchema(schema: JSONSchema7): FieldValueOption[] | string { + if (schema.type !== 'object') { + if (schema.type === undefined) { + return 'Invalid JSON schema. Missing key `type` in schema'; + } + + if (Array.isArray(schema.type)) { + return `Invalid JSON schema type. Only object type is supported, but got an array of types: ${schema.type.join(', ')}`; + } + + return `Invalid JSON schema type. Only object type is supported, but got ${schema.type}`; + } + if (!schema?.properties) { return 'Invalid JSON schema. Missing key `properties` in schema'; }