# WarningOptions

Options for adding an acknowledgeable warning via `Annotations.addWarningV2` or `Validations.addWarning`.

- Source: [`core/lib/annotations.ts`](https://github.com/aws/aws-cdk/blob/v2.276.0/packages/aws-cdk-lib/core/lib/annotations.ts#L13)

## Example

```ts
// The construct attaches context describing this specific occurrence:
Validations.of(this).addWarning(
  'my-lib:unsupportedActionType',
  'This action type is not supported and will be ignored',
  { context: { service: 'aiops', resource: 'investigation-group' } },
);

// Acknowledge only the occurrences that match. `where` is an objectLike partial
// match against the context: any key you do not mention is left unconstrained,
// so the filter below also suppresses an occurrence whose context is
// `{ service: 'aiops', resource: 'other' }`:
Validations.of(this).acknowledge({
  id: 'my-lib:unsupportedActionType',
  reason: 'aiops actions are attached intentionally',
  where: { service: 'aiops' },
});
```

## Properties

- `context`: { [key: string]: any } — Structured context describing this specific warning occurrence.

  **Default:** no context is attached

  The construct chooses the keys and values (e.g. `{ service: 'aiops' }`, or
  richer values such as numbers or arrays). A later `acknowledge({ where })`
  is matched against this context as an `objectLike` partial match, to
  selectively suppress only the matching occurrences of the warning id while
  the rest continue to warn. When omitted, the warning carries no context and
  can only be suppressed by an unfiltered acknowledgement.
