Docs
Launch GraphOS Studio

Rover contract commands

For use with GraphOS contract variants


contracts enable you to create of a that filter out schema 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 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 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 you're publishing to, along with which you're creating or modifying.

If this already exists in the , 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 must belong to the same as the variant. It must also be a federated variant with . If your graph uses Federation 1, you must enable its support for the @tag in Apollo Studio.

Required the first time you publish a .

Optional after your first publish. If provided, it must match the value provided for the first publish (the for a particular 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 .

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 .

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

--hide-unreachable-types

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

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

--no-hide-unreachable-types

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

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 configuration.

Fetching contract details

contract describe

This command requires authenticating Rover with GraphOS.

You can use to fetch the configuration of any 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 you're fetching.

This command prints a summary of the 's configuration, including its 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

© 2024 Apollo Graph Inc.

Privacy Policy

Company