-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
20240620-simplify-subgraph-getting-started-and-federation
- Loading branch information
Showing
1 changed file
with
40 additions
and
0 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
v3/rfcs/dx/20240620-simplify-subgraph-getting-started-and-federation.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# DX: simplify subgraphs for getting started and federation workflows | ||
|
||
Status: Review required | ||
|
||
## subgraph init command | ||
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. | ||
|
||
init-ing a supergraph or connector will create files for both local and cloud environments. This is about what happens for the subgraphs. | ||
|
||
```bash | ||
# creates a subgraph folder and subgraph.yaml file | ||
ddn subgraph init app | ||
|
||
# add subgraph.yaml to the supergraph.yaml file and create an env file for the env | ||
ddn supergraph add subgraph --supergraph supergraph.local.yaml --subgraph app/subgraph.yaml | ||
touch app/.env.app.local | ||
|
||
# create the supergraph build | ||
ddn supergraph build --supergraph supergraph.yaml --env-file app/.env.app.local | ||
|
||
# deploy to cloud | ||
touch app/.env.app.cloud | ||
ddn connector build create --connector connector.yaml --target-env-file app/.env.app.cloud | ||
``` | ||
|
||
## --subgraph flag should take the file name | ||
|
||
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. | ||
|
||
```bash | ||
ddn connector init mydb --subgraph app/subgraph.yaml --hub-connector hasura/postgres | ||
|
||
ddn connector build create --connector mydb/connector.yaml --target-env-file app/.env.app.cloud | ||
|
||
ddn model add --subgraph app/subgraph.yaml --connector-link mydb --name Album | ||
|
||
ddn connector build get --connector-name mypg --subgraph-name app --project proj-1234 | ||
|
||
ddn connector build get --connector mypg/connector.yaml | ||
``` |