@@ -341,11 +341,20 @@ export default {
341341 }
342342 return validTypes;
343343 },
344+ isProcessGraphValue (value ) {
345+ return Utils .isObject (value) && Utils .isObject (value .process_graph );
346+ },
344347 async detectType () {
345348 let keys = Object .keys (this .allowedTypes );
346349 let valueUndefined = typeof this .state === ' undefined' ;
347350 if (keys .length === 0 ) {
348- await this .setSelected (' json' );
351+ // If the value looks like a process graph, use process-graph subtype
352+ if (! valueUndefined && this .isProcessGraphValue (this .state )) {
353+ await this .setSelected (' process-graph' );
354+ }
355+ else {
356+ await this .setSelected (' json' );
357+ }
349358 }
350359 else if (keys .length === 1 ) {
351360 await this .setSelected (keys[0 ], valueUndefined);
@@ -362,7 +371,13 @@ export default {
362371 else {
363372 let types = await this .getTypeForValue (this .detectableTypes , this .state );
364373 if (types .length === 0 ) {
365- await this .setSelected (' json' );
374+ // If the value looks like a process graph, use process-graph subtype
375+ if (! valueUndefined && this .isProcessGraphValue (this .state )) {
376+ await this .setSelected (' process-graph' );
377+ }
378+ else {
379+ await this .setSelected (' json' );
380+ }
366381 }
367382 else if (types .length === 1 ) {
368383 await this .setSelected (types[0 ]);
@@ -374,6 +389,11 @@ export default {
374389 types = types .filter (type => type !== ' integer' );
375390 }
376391
392+ // If process-graph is detected and value has a process_graph property, prefer process-graph over native object
393+ if (types .includes (' process-graph' ) && this .isProcessGraphValue (this .state )) {
394+ types = types .filter (type => type !== ' object' );
395+ }
396+
377397 if (! Utils .isRef (this .state ) && types .length > 1 ) {
378398 console .warn (" A parameter is ambiguous. Potential types: " + types .join (' , ' ) + " . Value: " + JSON .stringify (this .state ));
379399 }
0 commit comments