# KafkaSchemaValidationAttribute

Specific schema validation configuration settings that tell Lambda the message attributes you want to validate and filter using your schema registry.

- Source: [`aws-lambda/lib/schema-registry.ts`](https://github.com/aws/aws-cdk/blob/v2.274.0/packages/aws-cdk-lib/aws-lambda/lib/schema-registry.ts#L110)
- Type last changed: v2.202.0 · 20 Jun 2025

## Example

```ts
import { ManagedKafkaEventSource, ConfluentSchemaRegistry } from 'aws-cdk-lib/aws-lambda-event-sources';
import { Secret } from 'aws-cdk-lib/aws-secretsmanager';

// Your MSK cluster arn
declare const clusterArn: string;

// The Kafka topic you want to subscribe to
const topic = 'some-cool-topic';

const secret = new Secret(this, 'Secret', { secretName: 'AmazonMSK_KafkaSecret' });

declare const myFunction: lambda.Function;
myFunction.addEventSource(new ManagedKafkaEventSource({
  clusterArn,
  topic,
  startingPosition: lambda.StartingPosition.TRIM_HORIZON,
  provisionedPollerConfig: {
    minimumPollers: 1,
    maximumPollers: 3,
  },
  schemaRegistryConfig: new ConfluentSchemaRegistry({
    schemaRegistryUri: 'https://example.com',
    eventRecordFormat: lambda.EventRecordFormat.JSON,
    authenticationType: lambda.KafkaSchemaRegistryAccessConfigType.BASIC_AUTH,
    secret: secret,
    schemaValidationConfigs: [{ attribute: lambda.KafkaSchemaValidationAttribute.KEY }],
  }),
}));
```

## Properties

- `KEY`: [KafkaSchemaValidationAttribute](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.KafkaSchemaValidationAttribute.html) (required) (static) — De-serialize the key field of the parload to target function.

- `value`: string (required) — The enum to use in `SchemaRegistryConfig.SchemaValidationConfigs.Attribute` property in CloudFormation.

- `VALUE`: [KafkaSchemaValidationAttribute](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.KafkaSchemaValidationAttribute.html) (required) (static) — De-serialize the value field of the parload to target function.

## Methods

- `of(name: string): KafkaSchemaValidationAttribute // chainable` (static) — A custom schema validation attribute property.
