Docs
Launch GraphOS Studio

Rover contract commands

For use with GraphOS contract variants


contracts enable you to create s of a that filter out elements according to inclusion and exclusion rules:

Contract variant A
Contract variant B
Source variant
Filter schema
according to contract A
Filter schema
according to contract B
Contract schema A
Contract schema B
Supergraph
schema

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 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 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 you're creating or modifying.

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

Options include:

NameDescription
--source-variant

The name of the source variant to use for filtering.

The source must belong to the same graph as the contract variant. It must also be a federated variant with s. If your graph uses Federation 1, you must enable its support for the @tag in Apollo 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 for a particular contract variant can't change).

--include-tag

A tag name to include when filtering. To include multiple tag names, specify --include-tag multiple times:

--include-tag foo --include-tag bar

To specify an empty include list, provide--no-include-tags instead of this option.

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.

One of --include-tag or --no-include-tags is required.

--no-include-tags

Specifies an empty include list for the published contract.

One of --include-tag or --no-include-tags is required.

--exclude-tag

A tag name to exclude when filtering. To exclude multiple tag names, specify --exclude-tag multiple times:

--exclude-tag foo --exclude-tag bar

To specify an empty exclude list, provide--no-exclude-tags instead of this option.

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.

One of --exclude-tag or --no-exclude-tags is required.

--no-exclude-tags

Specifies an empty exclude list for the published contract.

One of --exclude-tag or --no-exclude-tags is required.

--hide-unreachable-types

If provided, the contract automatically hides types that are unreachable from the contract 's root s.

One of --hide-unreachable-types or --no-hide-unreachable-types is required.

--no-hide-unreachable-types

If provided, the contract does not automatically hide types that are unreachable from the contract 's root s.

One of --hide-unreachable-types or --no-hide-unreachable-types is required.

--no-launch

Optional. If provided, this command does not trigger a launch in after updating the contract configuration.

Fetching contract details

contract describe

This command requires authenticating Rover with GraphOS.

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

Run the contract describe command, like so:

rover contract describe my-graph@my-contract-variant

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

This command prints a summary of the contract's configuration, including its source and include/exclude lists:

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
Previous
config
Next
dev
Edit on GitHubEditForumsDiscord