Skip to content
Open
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions .github/workflows/release-with-changesets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
# Using macos-13 instead of latest (macos-14) due to an issue with Puppeteer and such runner.
# See: https://github.com/puppeteer/puppeteer/issues/12327 and https://github.com/asyncapi/parser-js/issues/1001
os: [ubuntu-latest, macos-13, windows-latest]
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: Set git to use LF # To once and for all finish the never-ending fight between Unix and Windows
run: |
Expand All @@ -53,6 +51,7 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: "${{ steps.lockversion.outputs.version }}"
registry-url: "https://registry.npmjs.org"
- if: steps.lockversion.outputs.version == '18' && matrix.os == 'windows-latest'
name: Install npm cli 8
shell: bash
Expand All @@ -79,6 +78,10 @@ jobs:
needs: [test-nodejs]
name: Publish to any of NPM, GitHub, or Docker Hub
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
pull-requests: write
steps:
- name: Set git to use LF # To once and for all finish the never-ending fight between Unix and Windows
run: |
Expand All @@ -92,7 +95,9 @@ jobs:
shell: bash
- if: steps.packagejson.outputs.exists == 'true'
name: Check package-lock version
uses: asyncapi/.github/.github/actions/get-node-version-from-package-lock@master
uses: derberg/.github-asyncapi/.github/actions/get-node-version-from-package-lock@fixnodereelase
with:
node-version: ${{ vars.NODE_VERSION }}
id: lockversion
- if: steps.packagejson.outputs.exists == 'true'
name: Setup Node.js
Expand Down Expand Up @@ -121,7 +126,6 @@ jobs:
setupGitUser: false
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GIT_AUTHOR_NAME: asyncapi-bot
GIT_AUTHOR_EMAIL: [email protected]
GIT_COMMITTER_NAME: asyncapi-bot
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/update-docs-on-docs-commits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@ jobs:
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Check package-lock version
uses: asyncapi/.github/.github/actions/get-node-version-from-package-lock@master
- name: Determine what node version to use
# This workflow is from our own org repo and safe to reference by 'master'.
uses: asyncapi/.github/.github/actions/get-node-version-from-package-lock@master # //NOSONAR
with:
node-version: ${{ vars.NODE_VERSION }}
id: lockversion
- name: Use Node.js
uses: actions/setup-node@v4
Expand Down
24 changes: 13 additions & 11 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,16 @@ We use [All Contributors](https://allcontributors.org/docs/en/specification) spe

## Guidelines for New Contributors

1. Read the [generator docs](https://www.asyncapi.com/docs/tools/generator) to get an overview of what the project is about.
2. While reading through the docs one might identify issues (e.g., broken links, text formatting issues, etc.).
3. Some concepts in the documentation might not be presented clearly, so contributors can suggest improvements (e.g., adding more examples or code snippets to make the documentation easy to understand).
4. Familiarize yourself with the project's structure by reviewing the source code and understanding the roles of different files and components.
5. Testing is one of the areas where new contributors can contribute, as running tests reveals uncovered lines in a particular file (e.g., a **test coverage report**).
6. You can then try to add tests for those uncovered lines (e.g., a function within a file might not be covered). For reference, you can check out this [PR](https://github.com/asyncapi/generator/pull/1379).
7. Instead of creating entirely new tests, consider enhancing existing ones by adding more edge cases to include additional test scenarios.
8. We encourage contributors to help improve code quality by reviewing reported issues on [SonarCloud](https://sonarcloud.io/project/issues?issueStatuses=OPEN%2CCONFIRMED&id=asyncapi_generator) and suggesting improvements, identifying false reported issues that may need to be removed, and proposing fixes for valid issues.
1. **Watch the Onboarding Webinar** - Before diving into code, watch our [Generator onboarding webinar](https://www.youtube.com/watch?v=Mkd7FgKOMNE) to understand the architecture and design decisions.
2. Read the [generator docs](https://www.asyncapi.com/docs/tools/generator) to get an overview of what the project is about.
3. While reading through the docs one might identify issues (e.g., broken links, text formatting issues, etc.).
4. Some concepts in the documentation might not be presented clearly, so contributors can suggest improvements (e.g., adding more examples or code snippets to make the documentation easy to understand).
5. Familiarize yourself with the project's structure by reviewing the source code and understanding the roles of different files and components.
6. Testing is one of the areas where new contributors can contribute, as running tests reveals uncovered lines in a particular file (e.g., a **test coverage report**).
7. You can then try to add tests for those uncovered lines (e.g., a function within a file might not be covered). For reference, you can check out this [PR](https://github.com/asyncapi/generator/pull/1379).
8. Instead of creating entirely new tests, consider enhancing existing ones by adding more edge cases to include additional test scenarios.
9. We encourage contributors to help improve code quality by reviewing reported issues on [SonarCloud](https://sonarcloud.io/project/issues?issueStatuses=OPEN%2CCONFIRMED&id=asyncapi_generator) and suggesting improvements, identifying false reported issues that may need to be removed, and proposing fixes for valid issues.
10. See the [Development Guide](Development.md#before-you-begin---new-contributor-onboarding) for more details on what you'll learn during onboarding.

## Few Tips for Effective Contributions

Expand All @@ -46,10 +48,10 @@ We use [All Contributors](https://allcontributors.org/docs/en/specification) spe
3. **PATIENCE** is crucial. Focus on creating meaningful contributions rather than rushing to submit a PR that adds little or no value to the project.
4. Adding entirely new features might be challenging because most features are already well-established. You may need to spend more time understanding the repository to identify areas for improvement.
5. You should research on Google regarding the @asyncapi/generator and related repositories (e.g., @asyncapi/parser or any of the template repositories) to identify potential improvements. AI can be a helpful assistant, but always double-check the information it provides with Google or StackOverflow.
6. Follow **Issue First, PR Later** - Always check if theres an existing issue before creating a new one, and raise your PR once the issue is confirmed/approved by any of the maintainers.
6. Follow **Issue First, PR Later** - Always check if there's an existing issue before creating a new one, and raise your PR once the issue is confirmed/approved by any of the maintainers.
7. Keep **PRs small and focused** – A small PR with a well-defined scope is easier to review and merge. Avoid bundling multiple changes into one PR.
8. Collaborate with Other Contributors – If someone else has already raised an issue and you are interested in contributing to it, please communicate with them and collaborate instead of raising a separate PR independently. Working together leads to better contributions and avoids duplication of efforts. Open source is driven by **collaboration, not competition**.
9. **Respond to Maintainer Reviews Promptly** - If a maintainer requests changes or provides feedback on your PR, please try to address them within **7 days**. If youre unable to respond by then, the PR may be closed. Contributors are always welcome to open a new PR once theyre ready to continue.
9. **Respond to Maintainer Reviews Promptly** - If a maintainer requests changes or provides feedback on your PR, please try to address them within **7 days**. If you're unable to respond by then, the PR may be closed. Contributors are always welcome to open a new PR once they're ready to continue.

## Summary of the Contribution Flow

Expand Down Expand Up @@ -207,4 +209,4 @@ This document was adapted from:

- [Facebook’s Draft Contributor Guide](https://github.com/facebook/draft-js/blob/master/CONTRIBUTING.md)
- [Modelina Champion Guidelines](https://github.com/asyncapi/modelina)
- [Website Triager/Committer Guidelines](https://github.com/asyncapi/website/blob/master/CONTRIBUTING.md#maintainers-setup)
- [Website Triager/Committer Guidelines](https://github.com/asyncapi/website/blob/master/CONTRIBUTING.md#maintainers-setup)
21 changes: 20 additions & 1 deletion Development.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,25 @@

This guide will help you set up the `generator` locally, run tests, and use Docker for isolated testing.

## Before You Begin - New Contributor Onboarding

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](https://www.youtube.com/watch?v=Mkd7FgKOMNE)**

### What you'll learn:

- 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
- The shift from Nunjucks to React render engine
- 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.

## Getting started

1. Fork & Clone the repository:
Expand Down Expand Up @@ -181,4 +200,4 @@ If you encounter any issues during development or testing, please check the foll
2. Clear the `node_modules` directory and reinstall dependencies if you encounter unexpected behavior.
3. 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.
If problems persist, please open an issue on the GitHub repository.
18 changes: 18 additions & 0 deletions apps/generator/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# @asyncapi/generator

## 2.11.0

### Minor Changes

- ced1404: Pushing of release https://github.com/asyncapi/generator/pull/1747 that failed due to pipeline issues.

## 2.10.0

### Minor Changes

- aee45ba: Pushing of release https://github.com/asyncapi/generator/pull/1747 that failed due to pipeline issues.

## 2.9.0

### Minor Changes

- 8168bcd: Pushing of release https://github.com/asyncapi/generator/pull/1747 that failed due to pipeline issues.

## 2.8.4

### Patch Changes
Expand Down
12 changes: 7 additions & 5 deletions apps/generator/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
const path = require('path');
const baseConfig = require('../../jest.config.base');

module.exports = {
...baseConfig(__dirname, {
moduleNameMapper: {
'^@asyncapi/nunjucks-filters$': path.resolve(__dirname, '../nunjucks-filters'),
},
}),
clearMocks: true,
moduleNameMapper: {
'^nimma/legacy$': '<rootDir>../../node_modules/nimma/dist/legacy/cjs/index.js',
'^nimma/(.*)': '<rootDir>../../node_modules/nimma/dist/cjs/$1',
'^@asyncapi/nunjucks-filters$': path.resolve(__dirname, '../nunjucks-filters'),
},
};
2 changes: 1 addition & 1 deletion apps/generator/lib/templates/config/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ async function loadTemplateConfig(templateDir, templateParams) {
*/
function loadDefaultValues(templateConfig, templateParams) {
const parameters = templateConfig.parameters;
const defaultValues = Object.keys(parameters || {}).filter(key => parameters[key].default);
const defaultValues = Object.keys(parameters || {}).filter(key => Object.hasOwn(parameters[key], "default"));

defaultValues.filter(dv => !Object.prototype.hasOwnProperty.call(templateParams, dv)).forEach(dv =>
Object.defineProperty(templateParams, dv, {
Expand Down
2 changes: 1 addition & 1 deletion apps/generator/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@asyncapi/generator",
"version": "2.8.4",
"version": "2.11.0",
"description": "The AsyncAPI generator. It can generate documentation, code, anything!",
"main": "./lib/generator.js",
"bin": {
Expand Down
25 changes: 25 additions & 0 deletions apps/keeper/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# @asyncapi/keeper

## 0.5.0

### Minor Changes

- ced1404: Pushing of release https://github.com/asyncapi/generator/pull/1747 that failed due to pipeline issues.

## 0.4.0

### Minor Changes

- aee45ba: Pushing of release https://github.com/asyncapi/generator/pull/1747 that failed due to pipeline issues.

## 0.3.0

### Minor Changes

- 8168bcd: Pushing of release https://github.com/asyncapi/generator/pull/1747 that failed due to pipeline issues.

## 0.2.0

### Minor Changes

- 2bd801e: Initial release of `@asyncapi/keeper` to make it available for JS templates in `@asyncapi/generator`. The generator release will contain a new JS client version with enabled message validation.
14 changes: 14 additions & 0 deletions apps/keeper/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const baseConfig = require('../../jest.config.base');

module.exports = {
...baseConfig(__dirname),
moduleFileExtensions: [
'js',
'json',
'jsx'
],
transform: {
'^.+\\.jsx?$': 'babel-jest'
},
};

5 changes: 0 additions & 5 deletions apps/keeper/jest.setup.js

This file was deleted.

38 changes: 12 additions & 26 deletions apps/keeper/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@asyncapi/keeper",
"version": "0.0.1",
"version": "0.5.0",
"description": "AsyncAPI message payload validation library that validates messages against JSON Schema (Draft-07)",
"scripts": {
"build": "babel src --out-dir lib",
Expand All @@ -13,46 +13,32 @@
"type": "git",
"url": "https://github.com/asyncapi/generator.git"
},
"files": [
"lib/**",
"README.md",
"LICENSE"
],
"main": "lib/index.js",
"author": "Adi Boghawala <[email protected]>",
"license": "Apache-2.0",
"publishConfig": {
"access": "public"
},
"dependencies": {
"@asyncapi/parser": "^3.4.0",
"@hyperjump/json-schema": "^1.16.2"
"ajv": "^8.17.1"
},
"devDependencies": {
"@babel/cli": "^7.25.9",
"@babel/core": "^7.26.0",
"@babel/preset-env": "^7.26.0",
"@ungap/structured-clone": "^1.3.0",
"babel-jest": "^27.3.1",
"jest": "^27.3.1",
"jest-esm-transformer": "^1.0.0"
},
"jest": {
"setupFiles": [
"<rootDir>/jest.setup.js"
],
"transformIgnorePatterns": [
"node_modules/(?!@hyperjump)"
],
"moduleFileExtensions": [
"js",
"json",
"jsx"
],
"transform": {
"^.+\\.jsx?$": "jest-esm-transformer"
},
"moduleNameMapper": {
"^nimma/legacy$": "<rootDir>/../../node_modules/nimma/dist/legacy/cjs/index.js",
"^nimma/(.*)": "<rootDir>/../../node_modules/nimma/dist/cjs/$1",
"^@hyperjump/browser/jref$": "<rootDir>/../../node_modules/@hyperjump/browser/lib/jref/index.js",
"^@hyperjump/json-schema/experimental$": "<rootDir>/node_modules/@hyperjump/json-schema/lib/experimental.js"
}
},
"babel": {
"presets": [
"@babel/preset-env"
]
}
}
}
Loading