Skip to content

SchemaRegistry

Defined in: zod/src/index.ts:119

Schema registry for runtime validation

TEventMap extends Record<string, WebhookEvent> = Record<string, WebhookEvent>

new SchemaRegistry<TEventMap>(options?): SchemaRegistry<TEventMap>

Defined in: zod/src/index.ts:123

SchemaRegistryOptions = {}

SchemaRegistry<TEventMap>

get(type): ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>> | undefined

Defined in: zod/src/index.ts:160

Get the schema for an event type

string

ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>> | undefined


has(type): boolean

Defined in: zod/src/index.ts:167

Check if a schema exists for an event type

string

boolean


register<TType>(type, schema): this

Defined in: zod/src/index.ts:132

Register a schema for an event type

TType extends string

TType

ZodType

this

Error if a schema already exists for this type and strict mode is enabled


registerAll(definitions): this

Defined in: zod/src/index.ts:150

Register multiple event definitions

Record<string, EventSchemaDefinition>

this


safeParse(event): SafeParseResult<WebhookEvent>

Defined in: zod/src/index.ts:187

Safely validate an event, returning a result object

WebhookEvent

SafeParseResult<WebhookEvent>


validate(event): WebhookEvent

Defined in: zod/src/index.ts:176

Validate an event against its registered schema

WebhookEvent

WebhookEvent

ZodError if validation fails