Skip to content

Use your AsyncAPI definition to generate literally anything. Markdown documentation, Node.js code, HTML documentation, anything!

License

Notifications You must be signed in to change notification settings

asyncapi/generator

AsyncAPI Generator

This is a Monorepo managed using Turborepo and contains the following package:

  1. Generator: This is a tool that you can use to generate whatever you want basing on the AsyncAPI specification file as an input.

  2. Nunjucks-filters: This library contains generator filters that can be reused across multiple templates, helping to avoid redundant work. These filters are designed specifically for Nunjucks templates and are included by default with the generator, so there's no need to add them to dependencies seprately.

npm npm

warning: This package doesn't support AsyncAPI 1.x anymore. We recommend to upgrade to the latest AsyncAPI version using the AsyncAPI converter (You can refer to installation guide). If you need to convert documents on the fly, you may use the Node.js or Go converters.

Overview

Generator is a tool that you can use to generate whatever you want basing on the AsyncAPI specification file as an input. For more information read the docs.

There is a large number of templates that are ready to use and are officially supported by the AsyncAPI Initiative.

List of official generator templates

Template Name Description Source code
@asyncapi/nodejs-template Generates Nodejs service that uses Hermes package click here
@asyncapi/nodejs-ws-template Generates Nodejs service that supports WebSockets protocol only click here
@asyncapi/java-template Generates Java JMS application click here
@asyncapi/java-spring-template Generates Java Spring service click here
@asyncapi/java-spring-cloud-stream-template Generates Java Spring Cloud Stream service click here
@asyncapi/python-paho-template Generates Python service that uses Paho library click here
@asyncapi/html-template Generates HTML documentation site click here
@asyncapi/markdown-template Generates documentation in Markdown file click here
@asyncapi/ts-nats-template Generates TypeScript NATS client click here
@asyncapi/go-watermill-template Generates Go client using Watermill click here
@asyncapi/dotnet-nats-template Generates .NET C# client using NATS click here
@asyncapi/php-template Generates PHP client using RabbitMQ click here
@asyncapi/dotnet-rabbitmq-template Generates .NET C# client using RabbitMQ click here

You can find above templates and the ones provided by the community in this list

Generator Filters

This library contains generator filters that can be reused across multiple templates, helping to avoid redundant work. These filters are designed specifically for Nunjucks templates and are included by default with the generator, so there's no need to add them to dependencies seprately.

This library consists of:

  • Custom filters. Check out API docs for complete list
  • Lodash-powered filters. For the list of all available filters check official docs

Release Process

To release a major/minor/patch:

Conventional Commits:

To maintain a clear git history of commits and easily identify what each commit changed and whether it triggered a release, we use conventional commits. The feat and fix prefixes are particularly important as they are needed to trigger changesets. Using these prefixes ensures that the changes are correctly categorized and the versioning system functions as expected.

For Example:

feat: add new feature

Manual

  1. Create a new release markdown file in the .changeset directory. The filename should indicate what the change is about.

  2. Add the following content to the file in this particular format:

    ---
    "@package-name-1": [type] (major/minor/patch)
    "@package-name-2": [type]
    ---
    
    [Provide a brief description of the changes. For example: Added a new Release GitHub Flow to the Turborepo. No new features or bugfixes were introduced.]

    For Example:

    ---
    "@asyncapi/generator": minor
    ---
    
    Adding new Release Github Flow to the Turborepo. No new features or bugfixes were introduced.
    
  3. Include the file in your pull request.

Using CLI

  1. Create a new release markdown file using changeset CLI. Below command will trigger an interactive prompt that you can use to specify release type and affected packages.

    npx -p @changesets/[email protected] changeset
    
  2. Include the file in your pull request.

Tip

For more detailed instructions, you can refer to the official documentation for creating a changeset: Adding a changeset

Release Flow:

  1. Add a Changeset:

    • When you make changes that need to be released, create a markdown file in the .changeset directory stating the package name and level of change (major/minor/patch).
  2. Open a Pull Request:

    • Push your changes and open a Pull Request (PR). After the PR is merged the changeset file helps communicate the type of changes (major, minor, patch).
  3. CI Processes Changeset:

    • After PR is merged, a dedicated GitHub Actions release workflow runs using changeset action,

    • This action reads the markdown files in the .changeset folder and creates a PR with the updated version of the package and removes the markdown file. For example:

      Before:

      "name": "@asyncapi/generator",
      "version": "2.0.1",

      After:

      "name": "@asyncapi/generator",
      "version": "3.0.1",
    • The new PR will also contain the description from the markdown files,

    • AsyncAPI bot automatically merge such release PR.

  4. Release the Package:

    • After the PR is merged, the CI/CD pipeline triggers again. The changesets/action step identifies that the PR was created by itself. It then verifies if the current version of the package is greater than the previously released version. If a difference is detected, it executes the publish command to release the updated package.

Contributing

Read CONTRIBUTING guide.

Contributors ✨

Thanks goes to these wonderful people (emoji key):

Fran MΓ©ndez
Fran MΓ©ndez

πŸ’¬ πŸ› πŸ’» πŸ“– πŸ€” 🚧 πŸ”Œ πŸ‘€ ⚠️ βœ…
Jonas Lagoni
Jonas Lagoni

πŸ’¬ πŸ› πŸ’» πŸ“– πŸ€” πŸ”Œ πŸ‘€ ⚠️
Lukasz Gornicki
Lukasz Gornicki

πŸ’¬ πŸ› πŸ“ πŸ’» πŸ“– πŸ€” 🚧 πŸ”Œ πŸ‘€ ⚠️ βœ… πŸš‡
Travis Reeder
Travis Reeder

πŸš‡ πŸ“–
Semen
Semen

πŸ› πŸ’» πŸ“– πŸ€” πŸ”Œ πŸ‘€ ⚠️
Waleed Ashraf
Waleed Ashraf

πŸ’» πŸ›
SebastiΓ‘n
SebastiΓ‘n

πŸ’»
Derk Muenchhausen
Derk Muenchhausen

πŸ’»
Ben Timby
Ben Timby

πŸ’»
Amanda  Shafack
Amanda Shafack

πŸ“–
Florence Njeri
Florence Njeri

πŸ“– πŸ‘€ πŸš‡ 🚧
Pratik Haldankar
Pratik Haldankar

πŸ“– πŸ‘€ 🚧 πŸ“’
swastik suvam singh
swastik suvam singh

πŸ’»
GavinZhengOI
GavinZhengOI

πŸ“–
lmgyuan
lmgyuan

πŸ“–
pierrick-boule
pierrick-boule

πŸ’» ⚠️ πŸ“–

This project follows the all-contributors specification. Contributions of any kind welcome!