@@ -43,6 +43,8 @@ export class N8NINodeProperties {
43
43
let type : NodePropertyTypes ;
44
44
let defaultValue = this . schemaExample . extractExample ( schema )
45
45
46
+ let options = undefined
47
+
46
48
switch ( schema . type ) {
47
49
case 'boolean' :
48
50
type = 'boolean' ;
@@ -58,8 +60,20 @@ export class N8NINodeProperties {
58
60
defaultValue = defaultValue !== undefined ? JSON . stringify ( defaultValue , null , 2 ) : '{}' ;
59
61
break ;
60
62
case 'array' :
61
- type = 'json' ;
62
- defaultValue = defaultValue !== undefined ? JSON . stringify ( defaultValue , null , 2 ) : '[]' ;
63
+ let schemaAsArray = schema as any ;
64
+ if ( schemaAsArray . items && schemaAsArray . items . enum && schemaAsArray . items . enum . length > 0 ) {
65
+ type = 'multiOptions' ;
66
+ options = schemaAsArray . items . enum . map ( ( value : string ) => {
67
+ return {
68
+ name : lodash . startCase ( value ) ,
69
+ value : value ,
70
+ } ;
71
+ } ) ;
72
+ defaultValue = defaultValue !== undefined ? defaultValue : [ ] ;
73
+ } else {
74
+ type = 'json' ;
75
+ defaultValue = defaultValue !== undefined ? JSON . stringify ( defaultValue , null , 2 ) : '[]' ;
76
+ }
63
77
break ;
64
78
case 'number' :
65
79
case 'integer' :
@@ -68,11 +82,14 @@ export class N8NINodeProperties {
68
82
break ;
69
83
}
70
84
71
- const field : FromSchemaNodeProperty = {
85
+ let field : FromSchemaNodeProperty = {
72
86
type : type ,
73
87
default : defaultValue ,
74
88
description : schema . description ,
75
89
} ;
90
+ if ( options ) {
91
+ field . options = options ;
92
+ }
76
93
if ( schema . enum && schema . enum . length > 0 ) {
77
94
field . type = 'options' ;
78
95
field . options = schema . enum . map ( ( value : string ) => {
@@ -115,7 +132,7 @@ export class N8NINodeProperties {
115
132
send : {
116
133
type : 'query' ,
117
134
property : parameter . name ,
118
- value : '={{ $value }}' ,
135
+ value : fieldSchemaKeys . type === "multiOptions" && ! parameter . explode ? "={{ $value.join(',') }}" : '={{ $value }}' ,
119
136
propertyInDotNotation : false ,
120
137
} ,
121
138
} ;
0 commit comments