Docs
Try Apollo Studio

Rover contract commands

For use with Apollo Contract variants


A contract is a variant that is the result of filtering out schema elements from a source variant.

Rover commands that interact with contracts begin with rover contract.

Publishing a contract to Apollo Studio

contract publish

You can use Rover to publish a new contract or publish configuration changes to an existing contract.

Run the contract publish command, like so:

rover contract publish my-graph@my-contract-variant \
--source-variant my-source-variant \
--include-tag foo \
--include-tag bar \
--exclude-tag baz \
--hide-unreachable-types

The argument my-graph@my-contract-variant in the example above is a graph ref that specifies the ID of the Studio graph you're publishing to, along with which variant you're publishing to.

If this variant already exists in the graph registry, its configuration is updated; otherwise, a new contract variant is created.

Options include:

NameDescription
--source-variant

The name of the source variant whose supergraph schema is used for filtering.

The source variant must be on the same graph as the contract variant and cannot be changed after contract creation. It must also be a federated variant with subgraphs. If your graph is using Federation 1, support for the @tag directive must be explicitly enabled in Studio.

Required the first time you publish a contract.

Optional after your first publish, but if provided it must match the previously published source variant in Studio.

--include-tag

Required unless --no-include-tags is used. A tag name to include when filtering. To include multiple tag names, specify --include-tag multiple times (e.g. --include-tag foo --include-tag bar). To include no tag names/use an empty list, specify --no-include-tags instead.

Every tag name must:

  • Begin with a letter (capital or lowercase) or underscore.
  • Include only letters, numbers, underscores (_), hyphens (-), or slashes (/).
  • Have a maximum of 128 characters.
--no-include-tags

Required unless --include-tag is used. Include no tag names when filtering. To include a non-empty list of tag names, specify --include-tag instead.

--exclude-tag

Required unless --no-exclude-tags is used. A tag name to exclude when filtering. To exclude multiple tag names, specify --exclude-tag multiple times (e.g. --exclude-tag foo --exclude-tag bar). To exclude no tag names/use an empty list, specify --no-exclude-tags instead.

Every tag name must:

  • Begin with a letter (capital or lowercase) or underscore.
  • Include only letters, numbers, underscores (_), hyphens (-), or slashes (/).
  • Have a maximum of 128 characters.
--no-exclude-tags

Required unless --exclude-tag is used. Exclude no tag names when filtering. To exclude a non-empty list of tag names, specify --exclude-tag instead.

--hide-unreachable-types

Required unless --no-hide-unreachable-types is used. Automatically hide types that can never be reached in operations on the contract schema

--no-hide-unreachable-types

Required unless --hide-unreachable-types is used. Do not automatically hide types that can never be reached in operations on the contract schema

--no-launch

Optional. Do not trigger a launch in Studio after updating the contract configuration

Describing a contract variant

contract describe

You can use Rover to describe the configuration of any contract variant that Rover has access to.

Run the contract describe command, like so:

rover 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 Studio graph you're fetching from, along with which variant you're fetching.

The output will contain information of how the contract variant was configured such as the source variant, include and exclude tags.

Fetching description for configuration of my-graph@my-contract-variant using credentials from the default profile.
Configuration Description:
Contract variant "my-graph@my-contract-variant" is derived from the source variant "my-graph@my-source-variant".
Included tags:
- "foo"
- "bar"
Excluded tags:
- "baz"
Unreachable types are automatically hidden.
View the variant's full configuration at https://studio.apollographql.com/graph/my-graph/settings/variant?variant=my-contract-variant
Edit on GitHub
Previous
config
Next
dev