Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
183 changes: 183 additions & 0 deletions packages/components/API.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
## Functions
### **CloseConnection** - Renders a WebSocket close connection method with optional pre and post execution logic.
### Parameters
| Name | Type | Description |
|------|------|-------------|
| props | Object | Component props. |
| props.language | Language | Programming language used for method formatting. |
| props.framework | string | Framework used, if any (e.g., 'quarkus' for Java). |
| props.methodName | string | Name of the method to generate. |
| props.methodParams | Array.<string> | List of parameters for the method. |
| props.preExecutionCode | string | Code to insert before the main function logic. |
| props.postExecutionCode | string | Code to insert after the main function logic. |
| props.indent | number | Indentation level for the method block. |

@returns JSX.Element
### **Connect** - Component that renders WebSocket connection method for the specified programming language.
### Parameters
| Name | Type | Description |
|------|------|-------------|
| props | Object | Component properties. |
| props.language | SupportedLanguage | The programming language for which to generate connection code. |
| props.title | string | The title of the WebSocket server. |

### **resolveDependencies** - Helper function to resolve dependencies based on language, framework, and role.
### Parameters
| Name | Type | Description |
|------|------|-------------|
| language | Language | The programming language. |
| framework | string | The framework (e.g., 'quarkus' for Java). |
| role | string | The role (e.g., 'client', 'connector' for Java). |

@returns Array.<string>
### **DependencyProvider** - Renders the top-of-file dependency statements for the selected programming language.
### Parameters
| Name | Type | Description |
|------|------|-------------|
| props | Object | Component props. |
| props.language | Language | The programming language for which to render dependency statements. |
| props.framework | string | The framework (e.g., 'quarkus' for Java). |
| props.role | string | The role (e.g., 'client', 'connector' for Java). |
| props.additionalDependencies | Array.<string> | Optional additional dependencies to include. |

@returns JSX.Element
### **FileHeaderInfo** - Renders a file header with metadata information such as title, version, protocol, host, and path.
### Parameters
| Name | Type | Description |
|------|------|-------------|
| props | Object | Component props. |
| props.info | object | Info object from the AsyncAPI document. |
| props.server | object | Server object from the AsyncAPI document. |
| props.language | Language | Programming language used for comment formatting. |

@returns JSX.Element
### **HandleMessage** - Renders a WebSocket message handler method with optional pre and post execution logic.
### Parameters
| Name | Type | Description |
|------|------|-------------|
| props | Object | Component props. |
| props.language | Language | Programming language used for method formatting. |
| props.methodName | string | Name of the method to generate. |
| props.methodParams | Array.<string> | List of parameters for the method. |
| props.preExecutionCode | string | Code to insert before the main function logic. |
| props.postExecutionCode | string | Code to insert after the main function logic. |
| props.customMethodConfig | Object | Optional overrides for default method configuration. |

@returns JSX.Element
### **resolveDocsAndLogic** - Resolve docs and logic for the given language + framework config.

### **buildIndentedLogic** - Build indented method body.

### **MethodGenerator** - Generic Method rendering component.
### Parameters
| Name | Type | Description |
|------|------|-------------|
| props | Object | Component props. |
| props.language | Language | Programming language used for method formatting. |
| props.methodName | string | Name of the method. |
| props.methodParams | Array.<string> | Method parameters. |
| props.methodDocs | string | Optional documentation string. |
| props.methodLogic | string | Core method logic. |
| props.preExecutionCode | string | Code before main logic. |
| props.postExecutionCode | string | Code after main logic. |
| props.indent | number | Indentation for the method block. |
| props.newLines | number | Number of new lines after method. |
| props.customMethodConfig | Object | Optional custom syntax configuration for the current language. |
| props.methodConfig | Record.<Language, ({methodDocs: string, methodLogic: string}|Record.<string, {methodDocs: string, methodLogic: string}>)> | Language-level or framework-level configuration. |
| props.framework | string | Framework name for nested configurations (e.g., 'quarkus' for Java). |

### **Models** - Generates and returns an array of model files based on the AsyncAPI document.
### Parameters
| Name | Type | Description |
|------|------|-------------|
| params | Object | The parameters for the function. |
| params.asyncapi | AsyncAPIDocumentInterface | Parsed AsyncAPI document object. |
| params.language | Language | Target programming language for the generated models. |
| params.format | Format | Naming format for generated files. |
| params.presets | object | Custom presets for the generator instance. |
| params.constraints | object | Custom constraints for the generator instance. |

@returns Array.<File>
### **OnClose** - Component that renders WebSocket onClose event handler for the specified programming language.
### Parameters
| Name | Type | Description |
|------|------|-------------|
| props | Object | Component properties. |
| props.language | SupportedLanguage | The programming language for which to generate onClose handler code. |
| props.framework | string | Optional framework variant (e.g., 'quarkus' for java). |
| props.title | string | The title of the WebSocket server. |

### **OnError** - Component that renders WebSocket onError event handler for the specified programming language.
### Parameters
| Name | Type | Description |
|------|------|-------------|
| props | Object | Component properties. |
| props.language | SupportedLanguage | The programming language for which to generate onError handler code. |

### **OnMessage** - Component that renders WebSocket onMessage event handler for the specified programming language.
### Parameters
| Name | Type | Description |
|------|------|-------------|
| props | Object | Component properties. |
| props.language | SupportedLanguage | The programming language for which to generate onMessage handler code. |

### **OnOpen** - Component that renders WebSocket onOpen event handler for the specified programming language.
### Parameters
| Name | Type | Description |
|------|------|-------------|
| props | Object | Component properties. |
| props.language | SupportedLanguage | The programming language for which to generate onOpen handler code. |
| props.framework | string | Optional framework variant (e.g., 'quarkus' for java). |
| props.title | string | The title of the WebSocket server. |

### **resolveQueryParamLogic** - Resolve the appropriate query parameter configuration function based on language and framework.
### Parameters
| Name | Type | Description |
|------|------|-------------|
| language | SupportedLanguage | The target programming language. |
| framework | string | Optional framework (e.g., 'quarkus' for Java). |

@returns function
### **QueryParamsVariables** - Component for rendering query parameter variables code.
### Parameters
| Name | Type | Description |
|------|------|-------------|
| props | Object | Component props. |
| props.language | SupportedLanguage | The target programming language. |
| props.framework | string | Optional framework for the language. |
| props.queryParams | Array.<Array.<string>> | Array of query parameters, each represented as [paramName, paramType?]. |

### **RegisterErrorHandler** - Renders a WebSocket error handler registration method with optional pre and post execution logic.
### Parameters
| Name | Type | Description |
|------|------|-------------|
| props | Object | Component props. |
| props.language | Language | Programming language used for method formatting. |
| props.methodName | string | Name of the method to generate. |
| props.methodParams | Array.<string> | List of parameters for the method. |
| props.preExecutionCode | string | Code to insert before the main function logic. |
| props.postExecutionCode | string | Code to insert after the main function logic. |
| props.customMethodConfig | Object | Optional overrides for default method configuration. |

@returns JSX.Element
### **RegisterMessageHandler** - Renders a WebSocket message handler registration method with optional pre and post execution logic.
### Parameters
| Name | Type | Description |
|------|------|-------------|
| props | Object | Component props. |
| props.language | Language | Programming language used for method formatting. |
| props.methodName | string | Name of the method to generate. |
| props.methodParams | Array.<string> | List of parameters for the method. |
| props.preExecutionCode | string | Code to insert before the main function logic. |
| props.postExecutionCode | string | Code to insert after the main function logic. |

@returns JSX.Element
### **SendOperations** - Component for rendering WebSocket send operation methods.Generates both static and instance methods for sending messages through WebSocket connections.
### Parameters
| Name | Type | Description |
|------|------|-------------|
| props | Object | Component props. |
| props.language | SupportedLanguage | The target programming language. |
| props.sendOperations | Array.<Object> | Array of send operations from AsyncAPI document. |
| props.clientName | string | The name of the client class. |

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

Generated file - issues should be fixed in source.

This file is auto-generated by jsdoc2md from source JSDoc comments and the api.hbs template. Static analysis has flagged several issues:

  1. Line 86 table column count mismatch - The table has 4 columns but the header defines 3. This indicates a problem in the source JSDoc for the MethodGenerator component's methodConfig parameter.
  2. Grammar issues - Multiple instances of "pre and post execution" should be "pre- and post-execution" in the source JSDoc comments.
  3. Markdown formatting - Tables missing blank lines and duplicate headings are caused by the template structure.

Do not manually edit this file. Instead:

  • Fix the source JSDoc comments in the component files under src/
  • Update the api.hbs template to address formatting issues

Run this script to find the source of the table issue:


🏁 Script executed:

#!/bin/bash
# Find the MethodGenerator component and check its JSDoc
echo "Looking for MethodGenerator JSDoc..."
rg -A 20 "MethodGenerator" packages/components/src/ --type js

# Check for "methodConfig" parameter documentation
echo -e "\n\nLooking for methodConfig parameter..."
rg -B 5 -A 5 "methodConfig" packages/components/src/ --type js

Length of output: 20265


</shell_scripts_instructions>


🏁 Script executed:

#!/bin/bash
# Search for "pre and post execution" phrase in JSDoc comments
echo "Searching for 'pre and post execution' phrase..."
rg "pre and post execution" packages/components/src/ --type js

# Also check for any grammar issues in JSDoc descriptions
echo -e "\n\nSearching for descriptions with 'execution' in component files..."
rg -B 2 "execution" packages/components/src/components/ --type js | head -50

Length of output: 1819


Looking at the API.md snippet provided in the review comment, I can find the MethodGenerator function documentation. Counting the parameters table columns for MethodGenerator:

The table header shows: | Name | Type | Description | (3 columns)

Looking at the rows, all appear to have 3 columns properly filled. However, the methodConfig parameter entry has a particularly complex type definition that spans multiple lines in the rendered markdown, which could be causing the rendering issue being flagged.

The grammar issue is confirmed. I found the exact phrase in 4 component files:

  • RegisterMessageHandler.js: "optional pre and post execution logic"
  • RegisterErrorHandler.js: "optional pre and post execution logic"
  • HandleMessage.js: "optional pre and post execution logic"
  • CloseConnection.js: "optional pre and post execution logic"

These should all be changed to "pre- and post-execution" (with hyphens) in the source JSDoc comments.


Fix grammar in source JSDoc descriptions.

The generated API.md file correctly reflects issues in the source code. Update these 4 component files to use proper hyphenation:

  • packages/components/src/components/RegisterMessageHandler.js
  • packages/components/src/components/RegisterErrorHandler.js
  • packages/components/src/components/HandleMessage.js
  • packages/components/src/components/CloseConnection.js

Change "pre and post execution logic" to "pre- and post-execution logic" in each component's main JSDoc description.

🧰 Tools
🪛 LanguageTool

[grammar] ~2-~2: Use a hyphen to join words.
Context: ...ection method with optional pre and post execution logic.

Parameters

| Name...

(QB_NEW_EN_HYPHEN)


[grammar] ~54-~54: Use a hyphen to join words.
Context: ...andler method with optional pre and post execution logic.

Parameters

| Name...

(QB_NEW_EN_HYPHEN)


[grammar] ~150-~150: Use a hyphen to join words.
Context: ...ration method with optional pre and post execution logic.

Parameters

| Name...

(QB_NEW_EN_HYPHEN)


[grammar] ~163-~163: Use a hyphen to join words.
Context: ...ration method with optional pre and post execution logic.

Parameters

| Name...

(QB_NEW_EN_HYPHEN)

🪛 markdownlint-cli2 (0.18.1)

4-4: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)


17-17: Multiple headings with the same content

(MD024, no-duplicate-heading)


18-18: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)


25-25: Multiple headings with the same content

(MD024, no-duplicate-heading)


26-26: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)


34-34: Multiple headings with the same content

(MD024, no-duplicate-heading)


35-35: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)


45-45: Multiple headings with the same content

(MD024, no-duplicate-heading)


46-46: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)


55-55: Multiple headings with the same content

(MD024, no-duplicate-heading)


56-56: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)


72-72: Multiple headings with the same content

(MD024, no-duplicate-heading)


73-73: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)


86-86: Table column count
Expected: 3; Actual: 4; Too many cells, extra data will be missing

(MD056, table-column-count)


90-90: Multiple headings with the same content

(MD024, no-duplicate-heading)


91-91: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)


102-102: Multiple headings with the same content

(MD024, no-duplicate-heading)


103-103: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)


111-111: Multiple headings with the same content

(MD024, no-duplicate-heading)


112-112: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)


118-118: Multiple headings with the same content

(MD024, no-duplicate-heading)


119-119: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)


125-125: Multiple headings with the same content

(MD024, no-duplicate-heading)


126-126: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)


134-134: Multiple headings with the same content

(MD024, no-duplicate-heading)


135-135: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)


142-142: Multiple headings with the same content

(MD024, no-duplicate-heading)


143-143: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)


151-151: Multiple headings with the same content

(MD024, no-duplicate-heading)


152-152: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)


164-164: Multiple headings with the same content

(MD024, no-duplicate-heading)


165-165: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)


177-177: Multiple headings with the same content

(MD024, no-duplicate-heading)


178-178: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)

🤖 Prompt for AI Agents
In packages/components/API.md lines 1-183: the documentation flags inconsistent
hyphenation for "pre and post execution logic" originating from source JSDoc;
update the source JSDoc in the four component files to use the corrected
hyphenation "pre- and post-execution logic" — edit
packages/components/src/components/RegisterMessageHandler.js,
packages/components/src/components/RegisterErrorHandler.js,
packages/components/src/components/HandleMessage.js, and
packages/components/src/components/CloseConnection.js and replace the phrase
exactly in each component's main JSDoc description so the generated API.md
reflects the corrected wording.

Expand Down
16 changes: 16 additions & 0 deletions packages/components/api.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
## Functions
{{#functions}}
### **{{name}}** - {{description}}
{{#if params.length}}
### Parameters
| Name | Type | Description |
|------|------|-------------|
{{#each params}}
| {{name}} | {{type.names.[0]}} | {{description}} |
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion | 🟠 Major

Use Handlebars-standard array index syntax.

The bracket notation .[0] is non-standard for Handlebars. Use .0 instead to access the first array element.

Apply this diff:

-| {{name}} | {{type.names.[0]}} | {{description}} |
+| {{name}} | {{type.names.0}} | {{description}} |
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
| {{name}} | {{type.names.[0]}} | {{description}} |
| {{name}} | {{type.names.0}} | {{description}} |
🤖 Prompt for AI Agents
In packages/components/api.hbs around line 9, the template uses non-standard
Handlebars bracket notation `.[0]` to access the first array element; replace
`{{type.names.[0]}}` with the Handlebars-standard `{{type.names.0}}` so the
template uses proper array index syntax and renders correctly.

{{/each}}
{{/if}}

{{#each returns}}
@returns {{type.names.[0]}}
{{/each}}
{{/functions}}
6 changes: 4 additions & 2 deletions packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"prepublishOnly": "npm run build",
"lint": "eslint --max-warnings 0 --config ../../.eslintrc --ignore-path ../../.eslintignore .",
"lint:fix": "eslint --max-warnings 0 --config ../../.eslintrc --ignore-path ../../.eslintignore . --fix",
"generate:assets": "npm run prepublishOnly"
"generate:assets": "npm run prepublishOnly & npm run docs",
"docs": "jsdoc2md --template api.hbs ./src/**/*.js > API.md"
},
"files": [
"lib/**",
Expand Down Expand Up @@ -38,7 +39,8 @@
"@babel/preset-env": "^7.26.0",
"@babel/preset-react": "^7.25.9",
"jest": "^27.3.1",
"jest-esm-transformer": "^1.0.0"
"jest-esm-transformer": "^1.0.0",
"jsdoc-to-markdown": "^9.1.3"
},
"jest": {
"moduleFileExtensions": [
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/components/CloseConnection.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const delayExit = 1000;

/**
* Configuration for WebSocket close method logic per language.
* @type {Record<Language, { methodDocs?: string, methodLogic: string }>}
* @type {Record<Language, { methodDocs=: string, methodLogic: string }>}
*/
const websocketCloseConfig = {
python: {
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/components/HandleMessage.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { MethodGenerator } from './MethodGenerator';

/**
* Configuration for WebSocket message handler method logic per language.
* @type {Record<Language, { methodDocs?: string, methodLogic: string }>}
* @type {Record<Language, { methodDocs=: string, methodLogic: string }>}
*/
const websocketHandleMessageConfig = {
python: {
Expand Down
6 changes: 3 additions & 3 deletions packages/components/src/components/MethodGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Text } from '@asyncapi/generator-react-sdk';

/**
* Configuration for method syntax based on programming language.
* @type {Record<Language, { returnType?: string, openingTag?: string, closingTag?: string, indentSize?: number }>}
* @type {Record<Language, { returnType=: string, openingTag=: string, closingTag=: string, indentSize=: number }>}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Fix invalid JSDoc syntax and incorrect required properties.

The type annotation uses invalid =: syntax and incorrectly marks all properties as required. Based on the runtime configuration (lines 13-16), returnType, openingTag, and closingTag are optional—for example, JavaScript doesn't define returnType, and Python doesn't define closingTag.

Apply this diff:

-* @type {Record<Language, { returnType=: string, openingTag=: string, closingTag=: string, indentSize=: number }>}
+* @type {Record<Language, { returnType?: string, openingTag?: string, closingTag?: string, indentSize?: number, parameterWrap?: boolean }>}

Note: Also added the missing parameterWrap property that exists in the runtime config.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
* @type {Record<Language, { returnType=: string, openingTag=: string, closingTag=: string, indentSize=: number }>}
* @type {Record<Language, { returnType?: string, openingTag?: string, closingTag?: string, indentSize?: number, parameterWrap?: boolean }>}
🤖 Prompt for AI Agents
In packages/components/src/components/MethodGenerator.js around line 10, the
JSDoc type uses invalid `=:` syntax and incorrectly marks properties as
required; update the JSDoc to valid TypeScript-style object property annotations
and mark optional properties with `?`: e.g. change to something like `@type
{Record<Language, { returnType?: string, openingTag?: string, closingTag?:
string, indentSize: number, parameterWrap: string }>} ` so returnType,
openingTag and closingTag are optional, include the missing parameterWrap
property, and keep indentSize as required to match the runtime configuration.

*/
const defaultMethodConfig = {
python: { returnType: 'def', openingTag: ':', indentSize: 2, parameterWrap: true },
Expand Down Expand Up @@ -67,8 +67,8 @@ const buildIndentedLogic = (logic, preExecutionCode, postExecutionCode, indentSi
* @param {string} [props.postExecutionCode=''] - Code after main logic.
* @param {number} [props.indent=2] - Indentation for the method block.
* @param {number} [props.newLines=1] - Number of new lines after method.
* @param {{ returnType?: string, openingTag?: string, closingTag?: string, indentSize?: number, parameterWrap?: boolean }} [props.customMethodConfig] - Optional custom syntax configuration for the current language.
* @param {Record<Language, ({ methodDocs?: string, methodLogic?: string } | Record<string, { methodDocs?: string, methodLogic?: string }>)} [props.methodConfig] - Language-level or framework-level configuration.
* @param {{ returnType: string, openingTag: string, closingTag: string, indentSize: number, parameterWrap: boolean }} [props.customMethodConfig] - Optional custom syntax configuration for the current language.
* @param {Record<Language, { methodDocs: string, methodLogic: string } | Record<string, { methodDocs: string, methodLogic: string }>>} [props.methodConfig] - Language-level or framework-level configuration.
Comment on lines +70 to +71
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Fix incorrect required properties in JSDoc.

The type annotations mark all properties as required, but based on the runtime behavior and the defaultMethodConfig fallback logic (lines 96-102), all properties in customMethodConfig should be optional. Similarly, methodDocs and methodLogic in methodConfig are optional based on the resolution logic (lines 31-35).

Apply this diff:

-* @param {{ returnType: string, openingTag: string, closingTag: string, indentSize: number, parameterWrap: boolean }} [props.customMethodConfig]  - Optional custom syntax configuration for the current language.
-* @param {Record<Language, { methodDocs: string, methodLogic: string } | Record<string, { methodDocs: string, methodLogic: string }>>} [props.methodConfig] - Language-level or framework-level configuration.
+* @param {{ returnType?: string, openingTag?: string, closingTag?: string, indentSize?: number, parameterWrap?: boolean }} [props.customMethodConfig]  - Optional custom syntax configuration for the current language.
+* @param {Record<Language, { methodDocs?: string, methodLogic?: string } | Record<string, { methodDocs?: string, methodLogic?: string }>>} [props.methodConfig] - Language-level or framework-level configuration.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
* @param {{ returnType: string, openingTag: string, closingTag: string, indentSize: number, parameterWrap: boolean }} [props.customMethodConfig] - Optional custom syntax configuration for the current language.
* @param {Record<Language, { methodDocs: string, methodLogic: string } | Record<string, { methodDocs: string, methodLogic: string }>>} [props.methodConfig] - Language-level or framework-level configuration.
* @param {{ returnType?: string, openingTag?: string, closingTag?: string, indentSize?: number, parameterWrap?: boolean }} [props.customMethodConfig] - Optional custom syntax configuration for the current language.
* @param {Record<Language, { methodDocs?: string, methodLogic?: string } | Record<string, { methodDocs?: string, methodLogic?: string }>>} [props.methodConfig] - Language-level or framework-level configuration.
🤖 Prompt for AI Agents
In packages/components/src/components/MethodGenerator.js around lines 70 to 71,
the JSDoc types currently mark properties as required even though runtime logic
and defaultMethodConfig treat them as optional; update the JSDoc so
customMethodConfig's object properties are optional (e.g. returnType?: string,
openingTag?: string, closingTag?: string, indentSize?: number, parameterWrap?:
boolean) and adjust methodConfig so methodDocs and methodLogic are optional in
both the language-level shape and the nested framework-level shape (e.g.
methodDocs?: string, methodLogic?: string or Record<string, { methodDocs?:
string, methodLogic?: string }>), ensuring the annotations match the fallback
behavior.

* @param {string} [props.framework] - Framework name for nested configurations (e.g., 'quarkus' for Java).
*/
export function MethodGenerator({
Expand Down
8 changes: 7 additions & 1 deletion packages/components/src/components/Models.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,15 @@ import {
* Represents the available programming languages for model generation.
*/

/**
* @class ModelinaGenerator
* @classdesc Represents a Modelina generator class.
* @param {object} [options] - Optional generator options.
*/

/**
* Mapping of language strings to Modelina generator classes and file extensions.
* @type {Record<string, { generator: new (options?: object) => any; extension: string }>}
* @type {Record<string, { generator: ModelinaGenerator, extension: string }>}
*/
const generatorConfig = {
python: { generator: PythonGenerator, extension: 'py' },
Expand Down
8 changes: 4 additions & 4 deletions packages/components/src/components/QueryParamsVariables.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import { toCamelCase } from '@asyncapi/generator-helpers';

/**
* @typedef {Object} QueryParamCodeBlock
* @property {{ text: string, indent?: number, newLines?: number }} variableDefinition - Code block for variable initialization.
* @property {{ text: string, indent?: number, newLines?: number }} ifCondition - Conditional statement block.
* @property {{ text: string, indent?: number, newLines?: number }} assignment - Code block assigning query param.
* @property {{ text: string, indent?: number, newLines?: number } | null} [closing] - Optional closing block (for braces, etc.).
* @property {{ text: string, indent=: number, newLines=: number }} variableDefinition - Code block for variable initialization.
* @property {{ text: string, indent=: number, newLines=: number }} ifCondition - Conditional statement block.
* @property {{ text: string, indent=: number, newLines=: number }} assignment - Code block assigning query param.
* @property {{ text: string, indent=: number, newLines=: number } | null} [closing] - Optional closing block (for braces, etc.).
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Fix invalid JSDoc syntax.

The type annotations use =: syntax (e.g., indent=: number), which is invalid in JSDoc/TypeScript. The =: combination is not recognized by JSDoc parsers.

Based on the runtime configuration (lines 27-88), all three properties (text, indent, newLines) are consistently provided, so they should be required properties. The closing property can be null and should remain optional.

Apply this diff:

 * @typedef {Object} QueryParamCodeBlock
-* @property {{ text: string, indent=: number, newLines=: number }} variableDefinition - Code block for variable initialization.
-* @property {{ text: string, indent=: number, newLines=: number }} ifCondition - Conditional statement block.
-* @property {{ text: string, indent=: number, newLines=: number }} assignment - Code block assigning query param.
-* @property {{ text: string, indent=: number, newLines=: number } | null} [closing] - Optional closing block (for braces, etc.).
+* @property {{ text: string, indent: number, newLines: number }} variableDefinition - Code block for variable initialization.
+* @property {{ text: string, indent: number, newLines: number }} ifCondition - Conditional statement block.
+* @property {{ text: string, indent: number, newLines: number }} assignment - Code block assigning query param.
+* @property {{ text: string, indent: number, newLines: number } | null} [closing] - Optional closing block (for braces, etc.).
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
* @property {{ text: string, indent=: number, newLines=: number }} variableDefinition - Code block for variable initialization.
* @property {{ text: string, indent=: number, newLines=: number }} ifCondition - Conditional statement block.
* @property {{ text: string, indent=: number, newLines=: number }} assignment - Code block assigning query param.
* @property {{ text: string, indent=: number, newLines=: number } | null} [closing] - Optional closing block (for braces, etc.).
* @property {{ text: string, indent: number, newLines: number }} variableDefinition - Code block for variable initialization.
* @property {{ text: string, indent: number, newLines: number }} ifCondition - Conditional statement block.
* @property {{ text: string, indent: number, newLines: number }} assignment - Code block assigning query param.
* @property {{ text: string, indent: number, newLines: number } | null} [closing] - Optional closing block (for braces, etc.).
🤖 Prompt for AI Agents
In packages/components/src/components/QueryParamsVariables.js around lines 11 to
14, the JSDoc uses invalid `=:` syntax for typing (e.g., `indent=: number`) and
incorrectly marks properties as optional; update the JSDoc to use valid
JSDoc/TypeScript style (e.g., `indent: number`, `newLines: number`, `text:
string`) making text, indent, and newLines required, and keep closing as an
optional property that can be null (e.g., `{ { text: string, indent: number,
newLines: number } | null } [closing]`), ensuring the annotations match the
runtime usage.

*/

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { MethodGenerator } from './MethodGenerator';

/**
* Configuration for WebSocket error handler registration method logic per language.
* @type {Record<Language, { methodDocs?: string, methodLogic: string }>}
* @type {Record<Language, { methodDocs=: string, methodLogic: string }>}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Fix invalid JSDoc syntax.

The type annotation uses methodDocs=: string, which is invalid JSDoc/TypeScript syntax. Based on the runtime configuration where methodDocs is absent in the python entry, this should be an optional property.

Apply this diff:

-* @type {Record<Language, { methodDocs=: string, methodLogic: string }>}
+* @type {Record<Language, { methodDocs?: string, methodLogic: string }>}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
* @type {Record<Language, { methodDocs=: string, methodLogic: string }>}
* @type {Record<Language, { methodDocs?: string, methodLogic: string }>}
🤖 Prompt for AI Agents
In packages/components/src/components/RegisterErrorHandler.js around line 10,
the JSDoc type annotation is invalid because it uses "methodDocs=: string";
change the property to be optional and valid by replacing that fragment with
"methodDocs?: string" so the type becomes Record<Language, { methodDocs?:
string, methodLogic: string }>, reflecting that python entries may omit
methodDocs.

*/
const websocketErrorRegisterConfig = {
python: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { MethodGenerator } from './MethodGenerator';

/**
* Configuration for WebSocket message handler registration method logic per language.
* @type {Record<Language, { methodDocs?: string, methodLogic: string }>}
* @type {Record<Language, { methodDocs=: string, methodLogic: string }>}
*/
const websocketMessageRegisterConfig = {
python: {
Expand Down
15 changes: 14 additions & 1 deletion packages/components/src/components/SendOperations.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,22 @@ import { toSnakeCase } from '@asyncapi/generator-helpers';
* Supported programming languages for WebSocket send operation generation.
*/

/**
* @typedef {Object} SendOperationMethods
* @property {string} nonStaticMethod
* @property {string} staticMethod
*/

/**
* @callback SendOperationGenerator
* @param {Object} operation
* @param {string} clientName
* @returns {SendOperationMethods}
*/

/**
* Configuration object for generating WebSocket send operations for different languages.
* @type {Object.<string, function(operation: Object, clientName: string): {nonStaticMethod: string, staticMethod: string}>}
* @type {Object.<string, SendOperationGenerator>}
*/
const websocketSendOperationConfig = {
python: (operation, clientName) => {
Expand Down