elsa-core icon indicating copy to clipboard operation
elsa-core copied to clipboard

Error 400 when creating json array through wfl designer

Open Holistiker opened this issue 3 years ago • 2 comments

Declaring a json array inside of the global variable definition window from the designer (

unknown ) Will throw Error 400 when you try to save that. Copy/cut everything and put it back inside will fix it.

Holistiker avatar Jun 25 '22 14:06 Holistiker

I did a quick check and found the issue here: Source

  onMonacoValueChanged(e: MonacoValueChangedArgs) {
    // Don't try and parse JSON if it contains errors.
    const errorCount = e.markers.filter(x => x.severity == MarkerSeverity.Error).length;

    if (errorCount > 0)
      return;

    this.workflowDefinitionInternal.variables = e.value;
  }

For some reason, after entering the closing bracket ], the editor still considers the syntanx invalid. It is required to provide another input (white space, comma, anything really) for the editor to consider the syntax valid and store it.

I'm not sure if this is a bug with Monaco editor itself or the way it is integrated into Elsa designer. It requires some further investigation.

Probably a fix would be to not rely on value changed event and instead update the value only when the user clicks save.

@sfmskywalker please let me know your thoughts.

mohdali avatar Jun 25 '22 16:06 mohdali

Makes sense to rely on the value after the user clicks save 👍🏻

sfmskywalker avatar Jun 27 '22 11:06 sfmskywalker