@@ -43,6 +43,8 @@ export class N8NINodeProperties {
4343 let type : NodePropertyTypes ;
4444 let defaultValue = this . schemaExample . extractExample ( schema )
4545
46+ let options = undefined
47+
4648 switch ( schema . type ) {
4749 case 'boolean' :
4850 type = 'boolean' ;
@@ -58,8 +60,20 @@ export class N8NINodeProperties {
5860 defaultValue = defaultValue !== undefined ? JSON . stringify ( defaultValue , null , 2 ) : '{}' ;
5961 break ;
6062 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+ }
6377 break ;
6478 case 'number' :
6579 case 'integer' :
@@ -68,11 +82,14 @@ export class N8NINodeProperties {
6882 break ;
6983 }
7084
71- const field : FromSchemaNodeProperty = {
85+ let field : FromSchemaNodeProperty = {
7286 type : type ,
7387 default : defaultValue ,
7488 description : schema . description ,
7589 } ;
90+ if ( options ) {
91+ field . options = options ;
92+ }
7693 if ( schema . enum && schema . enum . length > 0 ) {
7794 field . type = 'options' ;
7895 field . options = schema . enum . map ( ( value : string ) => {
@@ -115,7 +132,7 @@ export class N8NINodeProperties {
115132 send : {
116133 type : 'query' ,
117134 property : parameter . name ,
118- value : '={{ $value }}' ,
135+ value : fieldSchemaKeys . type === "multiOptions" && ! parameter . explode ? "={{ $value.join(',') }}" : '={{ $value }}' ,
119136 propertyInDotNotation : false ,
120137 } ,
121138 } ;
0 commit comments