Describe workflow's input JSON
Introduction
As explained in the article about workflow's and blocks' input, there can be special needs that can be addressed by explicitly describing to NL Flow the structure of the input JSON that is submitted to the workflow when it is executed.
In this way, both at design and execution time, a virtual block named $nlflow_input is defined, ideally located upstream of any workflow block, whose output keys are those indicated as component parts of the workflow input JSON with the procedure described below.
The virtual block can then be referenced as a source of data when setting the input properties of blocks.
Procedure
To explicitly describe the workflow's input JSON, in the workflow editor, select Input format definition on the canvas toolbar. The Input format definition window appears.
Use the Basic tab to describe the JSON by listing its top-level keys interactively. Inputs correspond to top-level keys of the workflow's input JSON.
-
To add a top-level key to the list:
- Select the plus button. A couple of boxes appears below the list. Enter the name of the input key in the left box then select the data type from the drop-down box on the right.
Or:
-
You can copy the name and the data type from an input property of another block of the workflow:
- Select the block from the first drop-down menu on the right of the dialog's toolbar.
- Select an input property of the block from the second drop-down menu on the right of the dialog's toolbar.
-
To modify a key, simply edit its name or data type.
- To remove a key from the list, select it and then select Delete.
Alternatively, use the text editor in the Advanced tab to describe the workflow's input JSON by providing a template—that is an empty example—of it.
The entire template must be enclosed in curly braces.
The syntax of the definition for a top-level key is:
"name": type
where name
is the name of the input. type
represents the type of the key and can be:
{}
for an object[]
for an array""
for a string0
for a numberfalse
for a boolean
Use the comma ,
to separate multiple inputs.
- To delete all the inputs select Clear text.
- To save the definition select Save.