-
-
Notifications
You must be signed in to change notification settings - Fork 342
docs: add api generation for components #1767
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
3ff3f65
810948d
431b8d1
c521c81
20dc33b
3fcc3d4
a5b9b38
34f53ff
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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}} | | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion | 🟠 Major Use Handlebars-standard array index syntax. The bracket notation Apply this diff: -| {{name}} | {{type.names.[0]}} | {{description}} |
+| {{name}} | {{type.names.0}} | {{description}} |📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
| {{/each}} | ||||||
| {{/if}} | ||||||
|
|
||||||
| {{#each returns}} | ||||||
| @returns {{type.names.[0]}} | ||||||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
| {{/each}} | ||||||
| {{/functions}} | ||||||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -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 }>} | ||||||||||
|
||||||||||
| * @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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
| * @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.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -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.). | ||||||||||||||||||
|
||||||||||||||||||
| * @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.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -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 }>} | ||||||
|
||||||
| * @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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 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:
MethodGeneratorcomponent'smethodConfigparameter.Do not manually edit this file. Instead:
src/Run this script to find the source of the table issue:
🏁 Script executed:
Length of output: 20265
</shell_scripts_instructions>
🏁 Script executed:
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
methodConfigparameter 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.jspackages/components/src/components/RegisterErrorHandler.jspackages/components/src/components/HandleMessage.jspackages/components/src/components/CloseConnection.jsChange "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