Skip to content

Commit 95ba4c2

Browse files
authored
feat: support the .yaml ext for flow files (#260)
1 parent adf7f7c commit 95ba4c2

File tree

14 files changed

+60
-26
lines changed

14 files changed

+60
-26
lines changed

desktop/src-tauri/src/types/generated/flowfile.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2182,15 +2182,15 @@ impl ::std::default::Default for ExecutableVerb {
21822182
ExecutableVerb::Exec
21832183
}
21842184
}
2185-
#[doc = "Configuration for a group of Flow CLI executables. The file must have the extension `.flow` in order to be discovered \nby the CLI. It's configuration is used to define a group of executables with shared metadata (namespace, tags, etc).\nA workspace can have multiple flow files located anywhere in the workspace directory\n"]
2185+
#[doc = "Configuration for a group of Flow CLI executables. The file must have the extension `.flow`, `.flow.yaml`, or `.flow.yml` \nin order to be discovered by the CLI. It's configuration is used to define a group of executables with shared metadata \n(namespace, tags, etc). A workspace can have multiple flow files located anywhere in the workspace directory\n"]
21862186
#[doc = r""]
21872187
#[doc = r" <details><summary>JSON schema</summary>"]
21882188
#[doc = r""]
21892189
#[doc = r" ```json"]
21902190
#[doc = "{"]
21912191
#[doc = " \"$id\": \"https://flowexec.io/schemas/flowfile_schema.json\","]
21922192
#[doc = " \"title\": \"FlowFile\","]
2193-
#[doc = " \"description\": \"Configuration for a group of Flow CLI executables. The file must have the extension `.flow` in order to be discovered \\nby the CLI. It's configuration is used to define a group of executables with shared metadata (namespace, tags, etc).\\nA workspace can have multiple flow files located anywhere in the workspace directory\\n\","]
2193+
#[doc = " \"description\": \"Configuration for a group of Flow CLI executables. The file must have the extension `.flow`, `.flow.yaml`, or `.flow.yml` \\nin order to be discovered by the CLI. It's configuration is used to define a group of executables with shared metadata \\n(namespace, tags, etc). A workspace can have multiple flow files located anywhere in the workspace directory\\n\","]
21942194
#[doc = " \"type\": \"object\","]
21952195
#[doc = " \"properties\": {"]
21962196
#[doc = " \"description\": {"]

desktop/src/types/generated/flowfile.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ export type CommonVisibility = 'public' | 'private' | 'internal' | 'hidden';
4444
export type FromFile = string[];
4545

4646
/**
47-
* Configuration for a group of Flow CLI executables. The file must have the extension `.flow` in order to be discovered
48-
* by the CLI. It's configuration is used to define a group of executables with shared metadata (namespace, tags, etc).
49-
* A workspace can have multiple flow files located anywhere in the workspace directory
47+
* Configuration for a group of Flow CLI executables. The file must have the extension `.flow`, `.flow.yaml`, or `.flow.yml`
48+
* in order to be discovered by the CLI. It's configuration is used to define a group of executables with shared metadata
49+
* (namespace, tags, etc). A workspace can have multiple flow files located anywhere in the workspace directory
5050
*
5151
*/
5252
export interface FlowFile {

docs/guide/executable.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ flow build my-project/
7171
## Flowfile
7272
7373
The flowfile is the primary configuration file that defines what an executable should do. The file is written in YAML but
74-
should have a `.flow` extension.
74+
should have a `.flow`, `.flow.yaml`, or `.flow.yml` extension.
7575
7676
The [flow sync](../cli/flow_sync.md) command is used to trigger a discovery of executables within workspaces. This
7777
command should be run whenever an executable is created, moved, or deleted from a flowfile.

docs/quickstart.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ workspace's configurations. For more information on workspaces see the [workspac
2222

2323
**Create an executable**
2424

25-
Executables are the core of flow. Each executable is driven by its definition within a flow file (`*.flow`).
25+
Executables are the core of flow. Each executable is driven by its definition within a flow file (`*.flow`, `*.flow.yaml`, or `*.flow.yml`).
2626
There are several types of executables that can be defined. For more information on executables and the flow file, see the [executable guide](guide/executable.md).
2727

2828
To get started, create a new flow file in the workspace directory.

docs/schemas/flowfile_schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"$schema": "http://json-schema.org/draft-07/schema#",
33
"$id": "https://flowexec.io/schemas/flowfile_schema.json",
44
"title": "FlowFile",
5-
"description": "Configuration for a group of Flow CLI executables. The file must have the extension `.flow` in order to be discovered \nby the CLI. It's configuration is used to define a group of executables with shared metadata (namespace, tags, etc).\nA workspace can have multiple flow files located anywhere in the workspace directory\n",
5+
"description": "Configuration for a group of Flow CLI executables. The file must have the extension `.flow`, `.flow.yaml`, or `.flow.yml` \nin order to be discovered by the CLI. It's configuration is used to define a group of executables with shared metadata \n(namespace, tags, etc). A workspace can have multiple flow files located anywhere in the workspace directory\n",
66
"type": "object",
77
"definitions": {
88
"CommonAliases": {

docs/types/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ You can add the following comment to the top of your flow files to enable this:
1616

1717
See the [schemas directory on GitHub](https://github.com/jahvon/flow/tree/main/docs/schemas) for all available schemas.
1818

19-
Note: If using the flow file schema, you will need to make sure your IDE is configured to treat `*.flow` files as YAML files.
19+
Note: If using the flow file schema, you will need to make sure your IDE is configured to treat `*.flow`, `*.flow.yaml`, and `*.flow.yml` files as YAML files.

docs/types/flowfile.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
# FlowFile
44

5-
Configuration for a group of Flow CLI executables. The file must have the extension `.flow` in order to be discovered
6-
by the CLI. It's configuration is used to define a group of executables with shared metadata (namespace, tags, etc).
7-
A workspace can have multiple flow files located anywhere in the workspace directory
5+
Configuration for a group of Flow CLI executables. The file must have the extension `.flow`, `.flow.yaml`, or `.flow.yml`
6+
in order to be discovered by the CLI. It's configuration is used to define a group of executables with shared metadata
7+
(namespace, tags, etc). A workspace can have multiple flow files located anywhere in the workspace directory
88

99

1010
## Properties

internal/filesystem/executables.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ func findFlowFiles(logger io.Logger, workspaceCfg *workspace.Workspace) ([]strin
116116
return filepath.SkipDir
117117
}
118118

119-
if filepath.Ext(entry.Name()) == executable.FlowFileExt {
119+
if executable.HasFlowFileExt(entry.Name()) {
120120
cfgPaths = append(cfgPaths, path)
121121
}
122122
}

internal/templates/templates.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func ProcessTemplate(
3636
flowfileName = fmt.Sprintf("executables_%s", time.Now().Format("20060102150405"))
3737
}
3838
flowfileName = strings.ReplaceAll(strings.ToLower(flowfileName), " ", "_")
39-
if !strings.HasSuffix(flowfileName, executable.FlowFileExt) {
39+
if !executable.HasFlowFileExt(flowfileName) {
4040
flowfileName += executable.FlowFileExt
4141
}
4242

types/executable/executables_test.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,3 +309,22 @@ var _ = Describe("ExecutableList", func() {
309309
})
310310
})
311311
})
312+
313+
var _ = DescribeTable("HasFlowFileExt", func(file string, expected bool) {
314+
Expect(executable.HasFlowFileExt(file)).To(Equal(expected))
315+
},
316+
Entry("ends with .flow", "development.flow", true),
317+
Entry("ends with .flow.yaml", "development.flow.yaml", true),
318+
Entry("ends with .flow.yml", "development.flow.yml", true),
319+
Entry("ends with something else", "development.txt", false),
320+
)
321+
322+
var _ = DescribeTable("HasFlowFileTemplateExt", func(file string, expected bool) {
323+
Expect(executable.HasFlowFileTemplateExt(file)).To(Equal(expected))
324+
},
325+
Entry("ends with .flow.tmpl", "development.flow.tmpl", true),
326+
Entry("ends with .flow.tmpl.yaml", "development.flow.tmpl.yaml", true),
327+
Entry("ends with .flow.tmpl.yml", "development.flow.tmpl.yml", true),
328+
Entry("ends with .flow", "development.flow", false),
329+
Entry("ends with something else", "development.flow.txt", false),
330+
)

0 commit comments

Comments
 (0)