mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
fix(Execute Workflow Trigger Node): Show helpful error message when passing array to JSON Example (#15458)
This commit is contained in:
@@ -27,6 +27,18 @@ import {
|
|||||||
const SUPPORTED_TYPES = TYPE_OPTIONS.map((x) => x.value);
|
const SUPPORTED_TYPES = TYPE_OPTIONS.map((x) => x.value);
|
||||||
|
|
||||||
function parseJsonSchema(schema: JSONSchema7): FieldValueOption[] | string {
|
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) {
|
if (!schema?.properties) {
|
||||||
return 'Invalid JSON schema. Missing key `properties` in schema';
|
return 'Invalid JSON schema. Missing key `properties` in schema';
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user