File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
modules/st2-auto-form/fields Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,10 @@ const jsonCheck = (value) => {
2727 return true ;
2828} ;
2929
30+ const jsonInArrayCheck = ( value ) => {
31+ return value . every ( item => typeof ( item ) === 'object' ) ;
32+ } ;
33+
3034const typeChecks = ( type , value ) => {
3135 const v = String ( value ) ;
3236 switch ( type ) {
@@ -35,7 +39,7 @@ const typeChecks = (type, value) => {
3539 case 'integer' :
3640 return ! validator . isInt ( v ) && `'${ v } ' is not an integer` ;
3741 case 'object' :
38- return ! _ . isPlainObject ( v ) && `'${ v } ' is not an object` ;
42+ return ! _ . isPlainObject ( value ) && `'${ v } ' is not an object` ;
3943 case 'string' :
4044 default :
4145 return false ;
@@ -111,6 +115,10 @@ export default class ArrayField extends BaseTextField {
111115 return v ;
112116 }
113117
118+ if ( Array . isArray ( v ) && jsonInArrayCheck ( v ) ) {
119+ return JSON . stringify ( v ) ;
120+ }
121+
114122 const { secret } = this . props . spec || { } ;
115123
116124 if ( secret && v && ! Array . isArray ( v ) ) {
You can’t perform that action at this time.
0 commit comments