Libraries
    Preparing search index...
    • Generates an AsyncAPI 3.0 document from a set of WebSocket subscription registrations.

      Each subscription becomes:

      • A channel with its address and optional messages (for outgoing server→client events and/or incoming client→server messages).
      • One or two operations: a send operation for server→client events and/or a receive operation for client→server messages.

      Named schemas (those with .schemaName() set) are automatically collected and emitted as components.schemas entries with $ref pointers.

      Parameters

      • options: AsyncApiOptions

        Configuration including subscription registrations and API info.

      Returns AsyncApiDocument

      A plain AsyncAPI 3.0 document object suitable for JSON.stringify.

      import { generateAsyncApiSpec } from '@cleverbrush/server-openapi';
      import { server } from './server.js';

      const spec = generateAsyncApiSpec({
      server,
      info: { title: 'My API', version: '1.0.0' },
      servers: {
      production: { host: 'api.example.com', protocol: 'wss' },
      },
      });