Join us from October 8-10 in New York City to learn the latest tips, trends, and news about GraphQL federation and API platform engineering.Join us for GraphQL Summit 2024 in NYC
Docs
Start for Free

Rover Conventions

Terminology and I/O conventions for Rover commands


These conventions apply to all commands.

Terminology

Graph / Subgraph / Supergraph

Rover provides commands for interacting with federated subgraphs and supergraphs, along with commands for interacting with a monolithic (non-federated) graph.

A supergraph is the of multiple subgraphs in a federated architecture:

Supergraph (A + B + C)
Subgraph A
Subgraph B
Subgraph C

When working on a federated , you'll run most Rover commands on a particular (using a subgraph command), rather than on the whole composed . The supergraph commands are useful when working with supergraph schemas.

Graph refs

Rover uses graph refs to refer to a particular of a particular graph in GraphOS. A is a string with the following format:

graph_id@variant_name

For example: docs-example-graph@staging

All Rover commands that interact with require a graph ref as their first positional .

I/O

Using stdout

Rover commands print to stdout in a predictable, portable format. This enables output to be used elsewhere (such as in another CLI, or as input to another Rover command). To help maintain this predictability, Rover prints progress logs to stderr instead of stdout.

To redirect Rover's output to a location other than your terminal, you can use the --output <OUTPUT_FILE> argument, the pipe | operator, or the redirect > operator.

Pipe |

Use the pipe operator to pass the stdout of one command directly to the stdin of another, like so:

rover graph introspect http://localhost:4000 | pbcopy

In this example, the output of the introspect command is piped to pbcopy, a MacOS command that copies a value to the clipboard. Certain Rover commands also accept values from stdin, as explained in Using stdin.

Output to a file

Use the --output <OUTPUT_FILE> argument to write command output to a file.

rover graph fetch my-graph@prod --output schema.graphql

In this example, the schema returned by graph fetch is written to the file schema.graphql. If this file already exists, it's overwritten. Otherwise, it's created.

Using stdin

Rover commands that take a file path as an option can instead accept input from stdin. To do so, pass - as the argument for the file path:

rover graph introspect http://localhost:4000 | rover graph check my-graph --schema -

In this example, the schema returned by graph introspect is then passed as the --schema option to graph check.

Previous
CI/CD
Next
Privacy and Data Collection
Rate articleRateEdit on GitHubEditForumsDiscord

© 2024 Apollo Graph Inc.

Privacy Policy

Company