ZOD_SCHEMA_KEY
constZOD_SCHEMA_KEY:"_zodSchema"
Defined in: packages/pipeline-zod/src/zod-validation.behavior.ts:63
Conventional property key used to attach a Zod schema to a command, query, or event class.
Classes built with createCommand(), createQuery(), or createZodRequest() automatically receive this property, so
ZodValidationBehavior can introspect and validate without extra wiring.
For manually-written event classes you can attach the schema yourself:
Example
Section titled “Example”import { ZOD_SCHEMA_KEY } from '@cqrs-ddd/pipeline-zod';import { z } from 'zod';
const userCreatedSchema = z.object({ userId: z.uuid(), username: z.string().min(1), email: z.email(),});
export class UserCreatedEvent { static readonly [ZOD_SCHEMA_KEY] = userCreatedSchema;
constructor( public readonly userId: string, public readonly username: string, public readonly email: string, ) {}}