Skip to content

Commit 7ab3fa5

Browse files
committed
20240620-simplify-subgraph-getting-started-and-federation
1 parent 726d5d8 commit 7ab3fa5

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# DX: simplify subgraphs for getting started and federation workflows
2+
3+
Status: Review required
4+
5+
## subgraph init command
6+
What this is: as a part of making it easier for people to work through the getting started guide, or to scaffold project files, allow the user to go from scratch to an API with only CLI commands.
7+
8+
init-ing a supergraph or connector will create files for both local and cloud environments. This is about what happens for the subgraphs.
9+
10+
```bash
11+
# creates a subgraph folder and subgraph.yaml file
12+
ddn subgraph init app
13+
14+
# add subgraph.yaml to the supergraph.yaml file and create an env file for the env
15+
ddn supergraph add subgraph --supergraph supergraph.local.yaml --subgraph app/subgraph.yaml
16+
touch app/.env.app.local
17+
18+
# create the supergraph build
19+
ddn supergraph build --supergraph supergraph.yaml --env-file app/.env.app.local
20+
21+
# deploy to cloud
22+
touch app/.env.app.cloud
23+
ddn connector build create --connector connector.yaml --target-env-file app/.env.app.cloud
24+
```
25+
26+
## --subgraph flag should take the file name
27+
28+
What this is about: on introducing federation, we realize that the primitive is the subgraph not the supergraph. The following commands are updated to consider the subgraph.yaml file instead of specifying a supergraph.yaml file and the subgraph by name.
29+
30+
```bash
31+
ddn connector init mydb --subgraph app/subgraph.yaml --hub-connector hasura/postgres
32+
33+
ddn connector build create --connector mydb/connector.yaml --target-env-file app/.env.app.cloud
34+
35+
ddn model add --subgraph app/subgraph.yaml --connector-link mydb --name Album
36+
37+
ddn connector build get --connector-name mypg --subgraph-name app --project proj-1234
38+
39+
ddn connector build get --connector mypg/connector.yaml
40+
```

0 commit comments

Comments
 (0)