AsyncAPI specification generator for amqp-contract
npm install @amqp-contract/asyncapiAsyncAPI 3.0.0 specification generator for amqp-contract.





``bash`
pnpm add @amqp-contract/asyncapi
`typescript
import { AsyncAPIGenerator } from "@amqp-contract/asyncapi";
import { ZodToJsonSchemaConverter } from "@orpc/zod/zod4";
import { writeFileSync } from "fs";
import { contract } from "./contract";
// Create generator with schema converters
const generator = new AsyncAPIGenerator({
schemaConverters: [new ZodToJsonSchemaConverter()],
});
// Generate AsyncAPI specification
const asyncAPISpec = await generator.generate(contract, {
info: {
title: "My AMQP API",
version: "1.0.0",
description: "Type-safe AMQP messaging API",
},
servers: {
development: {
host: "localhost:5672",
protocol: "amqp",
description: "Development RabbitMQ server",
},
production: {
host: "rabbitmq.example.com:5672",
protocol: "amqp",
description: "Production RabbitMQ server",
},
},
});
// Output as JSON
console.log(JSON.stringify(asyncAPISpec, null, 2));
// Or write to file
writeFileSync("asyncapi.json", JSON.stringify(asyncAPISpec, null, 2));
``
- ā
AsyncAPI 3.0 compliant with proper AMQP bindings (v0.3.0)
- ā
Schema validation - Converts Zod, Valibot, and ArkType schemas to JSON Schema
- ā
Queue-exchange binding documentation in channel descriptions
- ā
Type-safe with full TypeScript support
For examples and detailed guides, see the documentation.
For complete API documentation, see the AsyncAPI API Reference.
š Read the full documentation ā
MIT