@alt-stack/zod-asyncapi
v1.5.1
Published
Convert AsyncAPI schemas to Zod schemas with TypeScript code generation
Maintainers
Readme
@alt-stack/zod-asyncapi
Generate Zod 4 message schemas, TypeScript types, and a typed Topics map from AsyncAPI 3-style channels.
Install
pnpm add zod
pnpm add -D @alt-stack/zod-asyncapiGenerate
zod-asyncapi ./asyncapi.json --output ./src/generated-topics.tsinput may be a local JSON path or HTTP(S) URL. The CLI also supports --registry, --include, and --help.
import { Topics, type MessageType } from "./generated-topics.js";
type EmailJob = MessageType<"email.send">;
const job: EmailJob = Topics["email.send"].parse(input);The generator reads channel addresses/messages, not top-level operations. Use one effective payload per channel address and treat the output file as replaceable.
