Checks for breaking changes and composition errors for all the connected federated graphs.
npx wgc subgraph check
command checks for breaking changes and composition errors in all connected federated graphs associated with the specified subgraph. This validation process ensures that the new schema you intend to use does not introduce any issues that could negatively impact existing federated graphs.
<name>
: The name of the subgraph for which you want to perform the validation check. This should be the exact name of the subgraph you wish to check.-n, --namespace
: The namespace of the federated graph (Default: “default”).
--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.
--delete
: Check for breaking changes and composition errors in case the subgraph will be deleted.
--skip-traffic-check
: This will skip checking against client traffic and any breaking change will fail the run.
--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.
--schema
or --delete
parameter.CHANGE | TYPE | DESCRIPTION | BREAKING |
---|---|---|---|
BREAKING | FIELD_REMOVED | Field ‘email’ was removed from object type ‘User’ | |
NON-BREAKING | FIELD_ADDED | Field ‘emailID’ was added to object type ‘User’ |
FEDERATED_GRAPH_NAME | ERROR_MESSAGE |
---|---|
inventory | Type “Product” is an extension type, but there is no type definition for “Product” in any subgraphs. |
CHANGE | TYPE | DESCRIPTION | BREAKING |
---|---|---|---|
BREAKING | TYPE_REMOVED | Type ‘Department’ was removed | |
NON-BREAKING | TYPE_REMOVED | Type ‘RoleType’ was removed |
FEDERATED_GRAPH_NAME | ERROR_MESSAGE |
---|---|
inventory | The subgraph “products” could not be federated for the following reason: The object type “Employee” defines the directive “@override(from: “employees)” on the following field: “notes”. The required “from” argument of type “String!” must be provided with an existing subgraph name. However, a subgraph by the name of “employees” does not exist. |
COSMO_VCS_AUTHOR
: The author’s email address associated with the commit (e.g: foo@bar.com
).
COSMO_VCS_COMMIT
: The specific commit hash for the changes you are testing (e.g: de233ddwqedqwe
).
COSMO_VCS_BRANCH
: The branch name where the commit resides (e.g: main
).
npx wgc subgraph check
command interacts with the Cosmo platform’s control plane and connected federated graphs to perform the validation checks.