The code in this repository is experimental and has been provided for reference purposes only. Community feedback is welcome but this project may not be supported in the same way that repositories in the official Apollo GraphQL GitHub organization are. If you need help you can file an issue on this repository, contact Apollo to talk to an expert, or create a ticket directly in Apollo Studio.
To enable developers to easily build against new or local subgraphs, you may end up using rover dev
to simulate the full supergraph as it stands. With the recent addition of starting a session with multiple subgraphs within Rover, developers can easily get their supergraph up and running quickly.
In order to accelerate the building of that configuration, this quick CLI tool will do that instead.
To use this, you will need at least two things:
- An
APOLLO_KEY
which has access to the target graph - The
APOLLO_GRAPH_REF
(or graph reference, such asgraph@variant
) for the graph you'll develop against
To use this, run npx github:@apollosolutions/supergraph-yaml-generator
. There are a number of flags you can use:
--graphref graph@variant
to directly pass the graph reference via argument--out file_out.yaml
to set the output file location; defaults tosupergraph.yaml
within the currently run location--config
to inherit a supergraph.yaml configuration file
By default this tool will listen for three places for the graph reference, listed in terms of priority:
- The
--config
provided file's definedsupergraph.graphref
attribute; more on this below. - The
--graphref
argument - The
APOLLO_GRAPH_REF
environment variable
In addition, this supports additional syntax within the supergraph.yaml
format:
supergraph:
graphref: variant@dev
This syntax allows for a declarative way to set the graphref, and is prioritized over the other options.
When using the --config
flag, this will append to the provided supergraph configuration, and allow you to update as new subgraphs are added (or if you would prefer to update multiple subgraphs at once). This configuration prefers the existing subgraphs within the configuration and will not overwrite them with subgraphs within Apollo Studio.