Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion docs/cli/monograph/check.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ The `npx wgc monograph check` command checks for breaking changes and compositio

* `--schema <path-to-schema>`: The path to the new schema file that you want to validate. This file should contain the complete schema definition in the GraphQL Schema Definition Language (SDL) format.

* `-j, --json`: Prints the check result in JSON format instead of table output. Useful for CI/CD automation and scripts.

* `-o, --out [string]`: Writes the JSON check result to a destination file. This option enables JSON output automatically.

## Example

Check for breaking changes and composition errors for the monograph "production" in the default namespace with the new schema file located at "./schemas/new\_schema.graphql":
Expand All @@ -38,6 +42,18 @@ Check for breaking changes and composition errors for the monograph "production"
npx wgc monograph check production -n default --schema ./schemas/new_schema.graphql
```

Output the check result as JSON for automation:

```bash
npx wgc monograph check production -n default --schema ./schemas/new_schema.graphql --json
```

Write the JSON check result to a file:

```bash
npx wgc monograph check production -n default --schema ./schemas/new_schema.graphql --out ./check-result.json
```

## Sample output with changes and errors

Changes
Expand All @@ -56,4 +72,3 @@ Checkout the tutorial [here](/tutorial/pr-based-workflow-for-federation) on how
* The `npx wgc monograph check` command interacts with the Cosmo platform's control plane to perform the validation checks.

* If there are no breaking changes or composition errors detected, the tables will be empty, indicating that the new schema is safe to be used in production.

17 changes: 16 additions & 1 deletion docs/cli/subgraph/check.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ The `npx wgc subgraph check` command checks for breaking changes and composition

* `--skip-traffic-check` : This will skip checking against client traffic and any breaking change will fail the run.

* `-j, --json`: Prints the check result in JSON format instead of table output. Useful for CI/CD automation and scripts.

* `-o, --out [string]`: Writes the JSON check result to a destination file. This option enables JSON output automatically.

* `--suppress-warnings`: This flag suppresses any warnings produced by composition.

* `--label [labels...]`: The labels to apply to the new subgraph. The labels are passed in the format `<key>=<value> <key>=<value>`. This parameter is always ignored if the subgraph already exists.
Expand All @@ -79,6 +83,18 @@ The `npx wgc subgraph check` command checks for breaking changes and composition
npx wgc subgraph check newSubgraph -n default --schema ./schemas/new_schema.graphql --label team=A
```

3. Output the check result as JSON for automation:

```bash
npx wgc subgraph check products -n default --schema ./schemas/new_schema.graphql --json
```

4. Write the JSON check result to a file:

```bash
npx wgc subgraph check products -n default --schema ./schemas/new_schema.graphql --out ./check-result.json
```

<Info>
The labels should match the labels of the federated graph you want to check against.
</Info>
Expand Down Expand Up @@ -147,4 +163,3 @@ Checkout the tutorial [here](/tutorial/pr-based-workflow-for-federation) on how
* The `npx wgc subgraph check` command interacts with the Cosmo platform's control plane and connected federated graphs to perform the validation checks.

* If there are no breaking changes or composition errors detected, the tables will be empty, indicating that the new schema is compatible with the existing federated graphs.