fix(Execute Workflow Trigger Node): Show helpful error message when passing array to JSON Example (#15458)

This commit is contained in:
Daria
2025-05-16 16:48:08 +03:00
committed by GitHub
parent 4f82040083
commit 06e9386875

View File

@@ -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';
}