This guide will help you set up the generator locally, run tests, and use Docker for isolated testing.
New to AsyncAPI Generator? We strongly recommend watching our comprehensive onboarding webinar first:
Watch: One Tool, One Flow: AsyncAPI's New Take on Code/Docs/Config Generation
- What AsyncAPI is and the challenges it solves
- The origins and evolution of the Generator (legacy vs. future architecture)
- Understanding event-driven architectures and protocol complexity
- How the Generator works: templates, render engines, and the generation process
- Component-based template development for better reusability
- Baked-in templates and the monorepo structure
- Live demonstrations of code generation from AsyncAPI documents
This webinar provides essential context about the Generator's architecture, design decisions, and development workflow. Watching it will make the rest of this development guide much clearer and help you contribute more effectively.
- Fork & Clone the repository:
First fork the repository from github and then clone it,
git clone https://github.com/{your_username}/generator.git
cd generatorAfter cloning the repository, you should setup the fork properly and configure the remote repository as described in the AsyncAPI git workflow guidelines
- Install dependencies:
npm install --workspacesTo run all tests locally:
- Unit tests:
npm run generator:test:unit - Integration tests:
npm run generator:test:integration
-
Create new test files in the appropriate directory under
apps/generator/test/: -
Follow the existing test patterns.
-
Run your new tests using the commands mentioned above.
To run tests in an isolated Docker environment:
-
Ensure Docker is installed and running on your machine.
-
Run the following command from the project root:
docker compose upYou can also opt in to run the lint checks after the tests, by setting an environment variable LINT with any value before the command:
- Windows:
set LINT=true && docker compose up - Linux/macOS:
LINT=true docker compose up
This approach ensures a clean environment for each test run by cleanly installing dependencies and running tests in a Docker container.
To test template features, use the react-template in apps/generator/test/test-templates. You can run your changes against this template as follows:
- Navigate to the generator directory:
cd apps/generator-
Modify the react-template in
./test/test-templates/react-templateto test different features. -
Run the generator with the react-template:
node ./test/cli ./test/docs/dummy.yml ./test/test-templates/react-template -o ./test/output --force-write- Check the output in the
./test/outputdirectory to verify the output that you desired.
To release a major/minor/patch:
For a detailed explanation of conventional commits, refer to this guide 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
To ensure successful workflow execution, all PR titles must follow the Conventional Commits format and PR titles should start with a lowercase character. Incorrect PR titles can cause workflow failures, preventing PRs from being merged. For the PR titles you can refer to this guide
-
Create a new release markdown file in the
.changesetdirectory. The filename should indicate what the change is about. -
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.
-
Include the file in your pull request.
-
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/cli@2.27.7 changeset -
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
-
Add a Changeset:
- When you make changes that need to be released, create a markdown file in the
.changesetdirectory stating the package name and level of change (major/minor/patch).
- When you make changes that need to be released, create a markdown file in the
-
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).
-
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
.changesetfolder 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.
-
-
Release the Package:
- After the PR is merged, the CI/CD pipeline triggers again. The
changesets/actionstep 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.
- After the PR is merged, the CI/CD pipeline triggers again. The
- Lint the code:
npm run lint - Generate documentation:
npm run docs - Build Docker image:
npm run docker:build
If you encounter any issues during development or testing, please check the following:
- Ensure you're using the correct Node.js version (24.11 or higher) and npm version (11.5.1 or higher).
- Clear the
node_modulesdirectory and reinstall dependencies if you encounter unexpected behavior. - For Docker-related issues, make sure Docker is running and you have sufficient permissions.
If problems persist, please open an issue on the GitHub repository.