You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| `workspacePath` | string | Full path to the target workspace root directory |
260
+
| `name` | string | Name provided for the newly rendered flow file |
261
+
| `directory` | string | Target directory that the template will be render in to |
262
+
| `flowFilePath` | string | Full path to the target flow file |
263
+
| `templatePath` | string | Path to the template file being rendered |
264
+
| `env` | map (string -> string) | Environment variables accessible to the template |
265
+
| `form` | map (string -> any) | Values provided through template form inputs |
243
266
244
-
Templates can use the [Sprig functions](https://masterminds.github.io/sprig/) to manipulate data during the rendering process.
245
-
Additionally, the following keys are available to the template:
267
+
**See the [Expr language documentation](https://expr-lang.org/docs/language-definition) for more information on the
268
+
additional expression functions and syntax.**
246
269
247
-
- `FlowFileName`: The name of the flowfile being rendered. This is the argument passed into the `generate` command.
248
-
- `FlowFilePath`: The output path to the flowfile being rendered.
249
-
- `FlowWorkspace`: The name of the workspace that the template is rendering into.
250
-
- `FlowWorkspacePath`: The path to the workspace root directory.
270
+
> [!NOTE]
271
+
> The `env` map contains environment variables that were present when the template was rendered. The `form` map contains values from any form inputs defined in the template configuration.
Copy file name to clipboardExpand all lines: docs/schemas/flowfile_schema.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -390,7 +390,7 @@
390
390
"default": "30m0s"
391
391
},
392
392
"transformResponse": {
393
-
"description": "JQ query to transform the response before saving it to a file or outputting it.",
393
+
"description": "[Expr](https://expr-lang.org/docs/language-definition) expression used to transform the response before \nsaving it to a file or outputting it.\n\nThe following variables are available in the expression:\n - `status`: The response status string.\n - `code`: The response status code.\n - `body`: The response body.\n - `headers`: The response headers.\n\nFor example, to capitalize a JSON body field's value, you can use `upper(fromJSON(body)[\"field\"])`.\n",
Copy file name to clipboardExpand all lines: docs/schemas/template_schema.json
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -30,7 +30,7 @@
30
30
"default": ""
31
31
},
32
32
"if": {
33
-
"description": "A condition to determine if the artifact should be copied. The condition is evaluated using Go templating \nfrom the form data. If the condition is not met, the artifact will not be copied.\n[Sprig functions](https://masterminds.github.io/sprig/) are available for use in the condition.\n\nFor example, to copy the artifact only if the `name` field is set:\n```\n{{ if .name }}true{{ end }}\n```\n",
33
+
"description": "An expression that determines whether the the artifact should be copied, using the Expr language syntax. \nThe expression is evaluated at runtime and must resolve to a boolean value. If the condition is not met, \nthe artifact will not be copied.\n\nThe expression has access to OS/architecture information (os, arch), environment variables (env), form input \n(form), and context information (name, workspace, directory, etc.).\n\nSee the [flow documentation](https://flowexec.io/#/guide/templating) for more information.\n",
34
34
"type": "string",
35
35
"default": ""
36
36
},
@@ -121,7 +121,7 @@
121
121
"default": ""
122
122
},
123
123
"if": {
124
-
"description": "A condition to determine if the executable should be run. The condition is evaluated using Go templating \nfrom the form data. If the condition is not met, the executable run will be skipped.\n[Sprig functions](https://masterminds.github.io/sprig/) are available for use in the condition.\n\nFor example, to run a command only if the `name` field is set:\n```\n{{ if .name }}true{{ end }}\n```\n",
124
+
"description": "An expression that determines whether the executable should be run, using the Expr language syntax. \nThe expression is evaluated at runtime and must resolve to a boolean value. If the condition is not met, \nthe executable will be skipped.\n\nThe expression has access to OS/architecture information (os, arch), environment variables (env), form input \n(form), and context information (name, workspace, directory, etc.).\n\nSee the [flow documentation](https://flowexec.io/#/guide/templating) for more information.\n",
|`timeout`| The timeout for the request in Go duration format (e.g. 30s, 5m, 1h). |`string`| 30m0s ||
305
-
|`transformResponse`|JQ query to transform the response before saving it to a file or outputting it. |`string`|||
305
+
|`transformResponse`|[Expr](https://expr-lang.org/docs/language-definition) expression used to transform the response before saving it to a file or outputting it. The following variables are available in the expression: - `status`: The response status string. - `code`: The response status code. - `body`: The response body. - `headers`: The response headers. For example, to capitalize a JSON body field's value, you can use `upper(fromJSON(body)["field"])`. |`string`|||
306
306
|`url`| The URL to make the request to. |`string`|| ✘ |
307
307
|`validStatusCodes`| A list of valid status codes. If the response status code is not in this list, the executable will fail. If not set, the response status code will not be checked. |`array` (`integer`) |[]||
Copy file name to clipboardExpand all lines: docs/types/template.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,7 +39,7 @@ Go templating from form data is supported in all fields.
39
39
|`asTemplate`| If true, the artifact will be copied as a template file. The file will be rendered using Go templating from the form data. [Sprig functions](https://masterminds.github.io/sprig/) are available for use in the template. |`boolean`| false ||
40
40
|`dstDir`| The directory to copy the file to. If not set, the file will be copied to the root of the flow file directory. The directory will be created if it does not exist. |`string`|||
41
41
|`dstName`| The name of the file to copy to. If not set, the file will be copied with the same name. |`string`|||
42
-
|`if`|A condition to determine if the artifact should be copied. The condition is evaluated using Go templating from the form data. If the condition is not met, the artifact will not be copied. [Sprig functions](https://masterminds.github.io/sprig/) are available for use in the condition. For example, to copy the artifact only if the `name` field is set: ``` {{ if .name }}true{{ end }} ```|`string`|||
42
+
|`if`|An expression that determines whether the the artifact should be copied, using the Expr language syntax. The expression is evaluated at runtime and must resolve to a boolean value. If the condition is not met, the artifact will not be copied. The expression has access to OS/architecture information (os, arch), environment variables (env), form input (form), and context information (name, workspace, directory, etc.). See the [flow documentation](https://flowexec.io/#/guide/templating) for more information.|`string`|||
43
43
|`srcDir`| The directory to copy the file from. If not set, the file will be copied from the directory of the template file. |`string`|||
44
44
|`srcName`| The name of the file to copy. |`string`| <novalue> ||
45
45
@@ -94,7 +94,7 @@ Configuration for a template executable.
|`args`| Arguments to pass to the executable. |`array` (`string`) |[]||
96
96
|`cmd`| The command to execute. One of `cmd` or `ref` must be set. |`string`|||
97
-
|`if`|A condition to determine if the executable should be run. The condition is evaluated using Go templating from the form data. If the condition is not met, the executable run will be skipped. [Sprig functions](https://masterminds.github.io/sprig/) are available for use in the condition. For example, to run a command only if the `name` field is set: ``` {{ if .name }}true{{ end }} ```|`string`|||
97
+
|`if`|An expression that determines whether the executable should be run, using the Expr language syntax. The expression is evaluated at runtime and must resolve to a boolean value. If the condition is not met, the executable will be skipped. The expression has access to OS/architecture information (os, arch), environment variables (env), form input (form), and context information (name, workspace, directory, etc.). See the [flow documentation](https://flowexec.io/#/guide/templating) for more information.|`string`|||
98
98
|`ref`| A reference to another executable to run in serial. One of `cmd` or `ref` must be set. |[ExecutableRef](#ExecutableRef)|||
0 commit comments