> ## Documentation Index
> Fetch the complete documentation index at: https://cosmo-docs.wundergraph.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Update

> 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.

> [!NOTE]
>
> To delete a contract, please use [federated-graph delete](https://cosmo-docs.wundergraph.com/cli/federated-graph/delete.md).

## Usage

#### Exclude (the items that have the tag(s) specified will be removed from the source federated graph)

By default, all top-level nodes will be included in the schema unless explicitly excluded.

```bash theme={"system"}
npx wgc contract update <name> --source <contract-name> --exclude internal
```

#### Include (the items that have the tag(s) specified will be included in the source federated graph)

> [!NOTE]
>
> Child nodes inherit inclusion from their parent unless explicitly excluded.
> For example, an included Object would include all its field unless explicitly excluded.
> Similarly, an included field would include all its field arguments unless explicitly excluded.

By default, no top-level nodes will be included in the schema unless explicitly included.
Child nodes inherit inclusion from their parents unless explicitly excluded.

```bash theme={"system"}
npx wgc contract update <name> --source <contract-name> --include public
```

#### Include and exclude together

##### Minimum Requirements

| Package | Minimum version |
| - | - |
| [wgc](https://cosmo-docs.wundergraph.com/cli/intro.md) | [0.126.2](https://github.com/wundergraph/cosmo/releases/tag/wgc%400.126.2) |

> [!WARNING]
>
> The include and exclude tag sets must be mutually exclusive.
> If the same tag is added to both the include and exclude sets, an error will be returned.

If both include and exclude tags are provided, the behaviour is thus:

1. The schema starts blank (no nodes)
2. Top-level (parent) nodes (Enums, Inputs, Interfaces, Objects, Scalars, and Unions) are included if they define a
   specified tag to include.
3. Child-level nodes (Enum values, Input fields, Interface fields, Object fields) are also included unless
   the child defines a specified tag to exclude.
4. Argument nodes (Object field arguments and Interface field arguments) are included if the corresponding field is
   included unless the field argument defines a specified tag to exclude.

```bash theme={"system"}
npx wgc contract update <name> --source <contract-name> --include public --exclude internal
```

## Description

The `npx wgc contract update` command allows you to update the tag filters for the contract.
This will result in overwriting existing ones and causes a recomposition of the contract graph.

## Parameters

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

## Options

* `-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.

## Examples

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

```bash theme={"system"}
npx wgc contract update production-external --exclude experimental deprecated
```

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

```bash theme={"system"}
npx wgc contract update production-external --include public api
```

Updates a contract graph named `public-api` with the new include tags `core` and `api` and the new exclude tags `classified` and `internal`:

```bash theme={"system"}
npx wgc contract update public-api --include core api --exclude classified internal
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.