Rover contract Commands
For use with GraphOS contract variants
GraphOS contracts enable you to create variants of a supergraph that filter out schema elements according to inclusion and exclusion rules:
The rover contract
command set enables you to interact with your existing contracts and create new ones.
Publishing a contract to GraphOS
contract publish
This command requires authenticating Rover with GraphOS.
You can use Rover to publish a new contract or publish configuration changes to an existing contract.
Run the contract publish
command, like so:
1rover contract publish my-graph@my-contract-variant \
2 --source-variant my-source-variant \
3 --include-tag foo \
4 --include-tag bar \
5 --exclude-tag baz \
6 --hide-unreachable-types
The argument my-graph@my-contract-variant
in the example above is a graph ref that specifies the ID of the graph you're publishing to, along with which contract variant you're creating or modifying.
If this contract variant already exists in the graph registry, its configuration is updated. Otherwise, a new contract variant is created.
Options include:
Name | Description |
---|---|
| The name of the source variant to use for supergraph schema filtering.The source variant must belong to the same graph as the contract variant. It must also be a federated variant with subgraphs. If your graph uses Federation 1, you must enable its support for the @tag directive in GraphOS Studio.Required the first time you publish a contract.Optional after your first publish. If provided, it must match the value provided for the first publish (the source variant for a particular contract variant can't change). |
| A tag name to include when filtering. To include multiple tag names, specify --include-tag multiple times:Bash
--no-include-tags instead of this option.Every tag name must:
--include-tag or --no-include-tags is required. |
| Specifies an empty include list for the published contract.One of --include-tag or --no-include-tags is required. |
| A tag name to exclude when filtering. To exclude multiple tag names, specify --exclude-tag multiple times:Text
--no-exclude-tags instead of this option.Every tag name must:
--exclude-tag or --no-exclude-tags is required. |
| Specifies an empty exclude list for the published contract.One of --exclude-tag or --no-exclude-tags is required. |
| If provided, the contract automatically hides types that are unreachable from the contract schema's root fields.One of --hide-unreachable-types or --no-hide-unreachable-types is required. |
| If provided, the contract doesn't automatically hide types that are unreachable from the contract schema's root fields.One of --hide-unreachable-types or --no-hide-unreachable-types is required. |
| Optional. If provided, this command does not trigger a launch in GraphOS after updating the contract configuration. |
Fetching contract details
contract describe
This command requires authenticating Rover with GraphOS.
You can use Rover to fetch the configuration of any contract variant that Rover has access to.
Run the contract describe
command, like so:
1rover contract describe my-graph@my-contract-variant
The argument my-graph@my-contract-variant
in the example above is a graph ref that specifies the ID of the GraphOS graph you're fetching from, along with which contract variant you're fetching.
This command prints a summary of the contract's configuration, including its source variant and include/exclude lists:
1Fetching description for configuration of my-graph@my-contract-variant using credentials from the default profile.
2
3Configuration Description:
4
5Contract variant "my-graph@my-contract-variant" is derived from the source variant "my-graph@my-source-variant".
6
7Included tags:
8
9- "foo"
10- "bar"
11
12Excluded tags:
13
14- "baz"
15
16Unreachable types are automatically hidden.
17
18View the variant's full configuration at https://studio.apollographql.com/graph/my-graph/settings/variant?variant=my-contract-variant