Skip to content

fix: contract multiple tags examples #53

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
33 changes: 13 additions & 20 deletions docs/cli/schema-contracts/create.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "Create"
description: "Creates a contract from a federated graph or monograph."
icon: plus
icon: "plus"
---

## Usage
Expand All @@ -24,7 +24,7 @@ The `npx wgc contract create` command allows you to create a contract from a fed

## Parameters

* `<name>`: The name of the contract graph you want to create.
- `<name>`: The name of the contract graph you want to create.

## Required Options

Expand All @@ -35,34 +35,27 @@ The `npx wgc contract create` command allows you to create a contract from a fed
## Options

<Note>
The --exclude and --include options are currently *mutually exclusive*. An error will be returned if more than one are defined.
The --exclude and --include options are currently _mutually exclusive_. An error will be returned if more than one are defined.
</Note>

* `-n, --namespace` : The namespace of the contract graph and source graph (Default: "default").

* `--exclude` : The list of tags that need to be excluded from the source graph schema.

* `--include` : The list of tags that need to be included from the source graph schema.

* `--admission-webhook-url <url>` the base url of the admission webhook. This is the url that the controlplane will use to implement admission control for the contract graph. Example: `https://admission.example.com` (without the `/validate-config` path name)

* `--admission-webhook-secret`: Allows you to sign requests (HMAC) made to your admission webhook url. The header containing this signature is `X-Cosmo-Signature-256`

* `--readme` : The markdown file which describes the contract graph.

* `--suppress-warnings`: This flag suppresses any warnings produced by composition.
- `-n, --namespace` : The namespace of the contract graph and source graph (Default: "default").
- `--exclude` : The list of tags that need to be excluded from the source graph schema.
- `--include` : The list of tags that need to be included from the source graph schema.
Comment on lines +42 to +43
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's give an example for multiple tags here.

- `--admission-webhook-url <url>` the base url of the admission webhook. This is the url that the controlplane will use to implement admission control for the contract graph. Example: `https://admission.example.com` (without the `/validate-config` path name)
- `--admission-webhook-secret`: Allows you to sign requests (HMAC) made to your admission webhook url. The header containing this signature is `X-Cosmo-Signature-256`
- `--readme` : The markdown file which describes the contract graph.
- `--suppress-warnings`: This flag suppresses any warnings produced by composition.

## Examples

```bash
npx wgc contract create production-external --source production --exlude internal,experimental -r http://router.example.com/graphql
npx wgc contract create production-external --source production --exlude internal experimental -r http://router.example.com/graphql
```

Create a contract graph named `production-external` from the source graph schema of `production` that excludes all schema elements tagged with `internal` or `experimental`.

```bash
npx wgc contract create production-external --source production --include public,api -r http://router.example.com/graphql
npx wgc contract create production-external --source production --include public api -r http://router.example.com/graphql
```

Create a contract graph named `production-external` from the source graph schema of `production` that excludes all schema elements tagged with `public` or `api`.

Create a contract graph named `production-external` from the source graph schema of `production` that excludes all schema elements tagged with `public` or `api`.
36 changes: 14 additions & 22 deletions docs/cli/schema-contracts/update.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "Update"
description: "This command updates the tag filters for the contract. To update other aspects of the contract graph please use the federated-graph or monograph update commands."
icon: pen-to-square
icon: "pen-to-square"
---

## Usage
Expand All @@ -24,41 +24,33 @@ The `npx wgc contract update` command allows you to update the tag filters for t

## Parameters

* `<name>`: The name of the contract graph you want to update.
- `<name>`: The name of the contract graph you want to update.

## Options

<Note>
The --exclude and --include options are currently *mutually exclusive*. An error will be returned if more than one are defined. The undefined option will be automatically unset.
The --exclude and --include options are currently _mutually exclusive_. An error will be returned if more than one are defined. The undefined option will be automatically unset.
</Note>

* `-n, --namespace` : The namespace of the federated graph (Default: "default").

* `--exclude` : The list of tags that should be excluded from the source graph schema.

* `--include` : The list of tags that should be included from the source graph schema.

* `-r , --routing-url`: The routing URL of your router. This URL defines the endpoint where the router will be accessible. The contract graph will be accessible through this router.

* `--admission-webhook-url <url>` the base url of the admission webhook. This is the url that the controlplane will use to implement admission control for the contract graph. Example: `https://admission.example.com` (without the `/validate-config` path name)

* `--admission-webhook-secret`: Allows you to sign requests (HMAC) made to your admission webhook url. The header containing this signature is `X-Cosmo-Signature-256`

* `--readme` : The markdown file which describes the contract graph.

* `--suppress-warnings`: This flag suppresses any warnings produced by composition.
- `-n, --namespace` : The namespace of the federated graph (Default: "default").
- `--exclude` : The list of tags that should be excluded from the source graph schema.
- `--include` : The list of tags that should be included from the source graph schema.
Comment on lines +36 to +37
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's also add an example here as well

- `-r , --routing-url`: The routing URL of your router. This URL defines the endpoint where the router will be accessible. The contract graph will be accessible through this router.
- `--admission-webhook-url <url>` the base url of the admission webhook. This is the url that the controlplane will use to implement admission control for the contract graph. Example: `https://admission.example.com` (without the `/validate-config` path name)
- `--admission-webhook-secret`: Allows you to sign requests (HMAC) made to your admission webhook url. The header containing this signature is `X-Cosmo-Signature-256`
- `--readme` : The markdown file which describes the contract graph.
- `--suppress-warnings`: This flag suppresses any warnings produced by composition.

## Examples

```bash
npx wgc contract update production-external --exclude experimental,deprecated
npx wgc contract update production-external --exclude experimental deprecated
```

Updates a contract graph named `production-external` with the new exclude tags: `experimental` and `deprecated`.

```bash
npx wgc contract update production-external --include public,api
npx wgc contract update production-external --include public api
```

Updates a contract graph named `production-external` with the new include tags: `public` and `api`.

Updates a contract graph named `production-external` with the new include tags: `public` and `api`.