Skip to content

Commit dea3f2c

Browse files
authored
Merge pull request #42 from sjfhsjfh/dataflow-doc
feat: add a json schema viewer
2 parents b3a03ff + 861617c commit dea3f2c

File tree

6 files changed

+11831
-9833
lines changed

6 files changed

+11831
-9833
lines changed

docs/api/dataflow-config.md renamed to docs/api/dataflow-config.mdx

Lines changed: 40 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
# Dataflow Specification
2-
1+
# Dataflow Structure
32

43
Dora dataflows are specified through a YAML file.
54
This dataflow configuration file specifies the nodes of the dataflow and their inputs and outputs.
@@ -18,12 +17,12 @@ Each node is identified by a unique `id`:
1817

1918
```yaml
2019
nodes:
21-
- id: foo
22-
path: path/to/the/executable
23-
# ... (see below)
24-
- id: bar
25-
path: path/to/another/executable
26-
# ... (see below)
20+
- id: foo
21+
path: path/to/the/executable
22+
# ... (see below)
23+
- id: bar
24+
path: path/to/another/executable
25+
# ... (see below)
2726
```
2827

2928
For each node, you need to specify the `path` of the executable or script that Dora should run when starting the node.
@@ -47,29 +46,29 @@ The `inputs` field should be a key-value map of the following format:
4746
`input_id: source_node_id/source_node_output_id`
4847

4948
The components are defined as follows:
50-
- `input_id` is the local identifier that should be used for this input.
49+
50+
- `input_id` is the local identifier that should be used for this input.
5151
This will map to the `id` field of
5252
[`Event::Input`](https://docs.rs/dora-node-api/latest/dora_node_api/enum.Event.html#variant.Input)
5353
events sent to the node event loop.
54-
- `source_node_id` should be the `id` field of the node that sends the output that we want
54+
- `source_node_id` should be the `id` field of the node that sends the output that we want
5555
to subscribe to
56-
- `source_node_output_id` should be the identifier of the output that that we want
56+
- `source_node_output_id` should be the identifier of the output that that we want
5757
to subscribe to
5858

5959
#### Input/Output Example
6060

6161
```yaml
6262
nodes:
63-
- id: example-node
64-
outputs:
65-
- one
66-
- two
67-
- id: receiver
68-
inputs:
69-
my_input: example-node/two
63+
- id: example-node
64+
outputs:
65+
- one
66+
- two
67+
- id: receiver
68+
inputs:
69+
my_input: example-node/two
7070
```
7171
72-
7372
### Fields Controlling Node Execution
7473
7574
Use the following fields to define how a node is executed, including command-line arguments and environment
@@ -82,10 +81,10 @@ This can point to a normal executable (e.g. when using a compiled language such
8281

8382
```yaml
8483
nodes:
85-
- id: rust-example
86-
path: target/release/rust-node
87-
- id: python-example
88-
path: ./receive_data.py
84+
- id: rust-example
85+
path: target/release/rust-node
86+
- id: python-example
87+
path: ./receive_data.py
8988
```
9089

9190
See the
@@ -104,12 +103,12 @@ field for setting environment variables.
104103

105104
```yaml
106105
nodes:
107-
- id: example
108-
path: example-node
109-
args: -v --some-flag foo
110-
env:
111-
IMAGE_WIDTH: 640
112-
IMAGE_HEIGHT: 480
106+
- id: example
107+
path: example-node
108+
args: -v --some-flag foo
109+
env:
110+
IMAGE_WIDTH: 640
111+
IMAGE_HEIGHT: 480
113112
```
114113

115114
### Fields Controlling Node Build
@@ -153,14 +152,13 @@ Afterwards it runs the `build` command if specified.
153152

154153
```yaml
155154
nodes:
156-
- id: rust-node
157-
git: https://github.com/dora-rs/dora.git
158-
branch: main
159-
build: cargo build -p rust-dataflow-example-node
160-
path: target/debug/rust-dataflow-example-node
155+
- id: rust-node
156+
git: https://github.com/dora-rs/dora.git
157+
branch: main
158+
build: cargo build -p rust-dataflow-example-node
159+
path: target/debug/rust-dataflow-example-node
161160
```
162161

163-
164162
## Operators
165163

166164
Operators are an experimental, lightweight alternative to nodes.
@@ -177,3 +175,10 @@ field instead.
177175
See the [`Descriptor`](https://docs.rs/dora-core/latest/dora_core/descriptor/struct.Descriptor.html)
178176
struct for a full list of supported fields.
179177

178+
## Full Specification
179+
180+
```mdx-code-block
181+
import SchemaViewer from "@site/src/components/SchemaViewer";
182+
183+
<SchemaViewer />
184+
```

docusaurus.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const config = {
1313
markdown: {
1414
mermaid: true,
1515
},
16-
themes: ["@docusaurus/theme-mermaid"],
16+
themes: ["@docusaurus/theme-mermaid", "docusaurus-json-schema-plugin"],
1717

1818
// Set the production url of your site here
1919
url: "https://dora-rs.ai",

0 commit comments

Comments
 (0)