diff --git a/docs/cli/monograph/check.mdx b/docs/cli/monograph/check.mdx index 89b788cc..ed1f1d20 100644 --- a/docs/cli/monograph/check.mdx +++ b/docs/cli/monograph/check.mdx @@ -30,6 +30,10 @@ The `npx wgc monograph check` command checks for breaking changes and compositio * `--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": @@ -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 @@ -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. - diff --git a/docs/cli/subgraph/check.mdx b/docs/cli/subgraph/check.mdx index ee08ba6e..187beda0 100644 --- a/docs/cli/subgraph/check.mdx +++ b/docs/cli/subgraph/check.mdx @@ -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 `= =`. This parameter is always ignored if the subgraph already exists. @@ -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 + ``` + The labels should match the labels of the federated graph you want to check against. @@ -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. -