Have ideas to improve npm?Join in the discussion! »

    asyncapi-decorators
    TypeScript icon, indicating that this package has built-in type declarations

    1.1.3 • Public • Published

    asyncapi-decorators

    NPM/Yarn module for generate automatic asyncapi documentation

    Getting Started

    npm i asyncapi-decorators
    

    Notes:

    • To enable experimental support for metadata decorators in your TypeScript project, you must add "experimentalDecorators": true to your tsconfig.json file.
    • To enable experimental support for auto-generated type metadata in your TypeScript project, you must add "emitDecoratorMetadata": true to your tsconfig.json file. Please note that auto-generated type metadata may have issues with circular or forward references for types.

    Decorators

    ApiChannel()

    This decorator is used to create a Channel definition. You can add message subscription/publishing using the format { publish: YourMessageClass } or { publish: () => YourMessageClass } (in case you have cross references).

    It optionally accepts all channel item definition schema attributes from AsyncAPI Channel specification

    ApiMessage()

    This decorator is used to create a Message definition. It optionally accepts all message definition schema attributes from AsyncAPI Message specification

    ApiProperty()

    This decorator is used to create a Message property definition. It optionally accepts all message property definition schema attributes from AsyncAPI Message Properties specification

    Documentation Builder

    const yaml: string = new DocumentationBuilder()
      .setTitle('Awesome API')
      .setDescription('Awesome api description')
      .setVersion('v1.0.0')
      .addServer('production', 'http://localhost:3000', 'http')
      .setDefaultContentType('application/json')
      .toYAML();
    

    Examples

    Look into the examples directory to find some ones.

    Install

    npm i asyncapi-decorators

    DownloadsWeekly Downloads

    44

    Version

    1.1.3

    License

    MIT

    Unpacked Size

    78.2 kB

    Total Files

    51

    Last publish

    Collaborators

    • avatar