Skip to content

Commit 0264c57

Browse files
committed
refine jsdoc comments
1 parent 62a49f9 commit 0264c57

File tree

6 files changed

+37
-39
lines changed

6 files changed

+37
-39
lines changed

packages/components/docs/API.md

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -248,13 +248,12 @@ const asyncapi_websocket_query = path.resolve(__dirname, "../../../helpers/test/
248248
const language = "javascript"
249249
let parsedAsyncAPIDocument;
250250

251-
async () => {
252-
const parseResult = await fromFile(parser, asyncapi_websocket_query).parse();
253-
parsedAsyncAPIDocument = parseResult.document;
254-
}
251+
// Parse the AsyncAPI document (async operation)
252+
const parseResult = await fromFile(parser, asyncapi_websocket_query).parse();
253+
const parsedAsyncAPIDocument = parseResult.document;
255254

256255
return (
257-
<FileHeaderInfo info={parsedAsyncAPIDocument.info()} server={parsedAsyncAPIDocument.servers().get("withPathname")} language={javascript} />
256+
<FileHeaderInfo info={parsedAsyncAPIDocument.info()} server={parsedAsyncAPIDocument.servers().get("withPathname")} language={language} />
258257
)
259258
```
260259

@@ -291,16 +290,16 @@ Renders a WebSocket message handler method with optional pre- and post-execution
291290
const language = "javascript"
292291
const methodName = "handleMessage"
293292
const methodParams = ["self", "message"]
294-
const preExecutionCode = "# Pass the incoming message to all registered message handlers."
295-
const postExecutionCode = "# Passed the incoming message to all registered message handlers."
293+
const preExecutionCode = "// Pass the incoming message to all registered message handlers."
294+
const postExecutionCode = "// Passed the incoming message to all registered message handlers."
296295
const customMethodConfig = {
297296
javascript: {
298297
methodDocs: "// Method to handle message with callback",
299298
methodLogic: "if (cb) cb(message);"
300299
}
301300
};
302301
return (
303-
<HandleMessage language={language} methodName={methodName} methodParams={methodParams} preExecutionCode={preExecutionCode} postExecutionCode = {postExecutionCode} customMethodConfig={customMethodConfig} />
302+
<HandleMessage language={language} methodName={methodName} methodParams={methodParams} preExecutionCode={preExecutionCode} postExecutionCode={postExecutionCode} customMethodConfig={customMethodConfig} />
304303
)
305304
```
306305

@@ -385,10 +384,10 @@ import { Parser, fromFile } from "@asyncapi/parser";
385384

386385
const parser = new Parser();
387386
const asyncapi_v3_path = path.resolve(__dirname, "../__fixtures__/asyncapi-v3.yml");
388-
async () => {
389-
const parseResult = await fromFile(parser, asyncapi_v3_path).parse();
390-
parsedAsyncAPIDocument = parseResult.document;
391-
}
387+
388+
// Parse the AsyncAPI document (async operation)
389+
const parseResult = await fromFile(parser, asyncapi_v3_path).parse();
390+
parsedAsyncAPIDocument = parseResult.document;
392391

393392
const language = "java"
394393

@@ -543,12 +542,11 @@ import { Parser, fromFile } from "@asyncapi/parser";
543542

544543
const parser = new Parser();
545544
const asyncapi_v3_path = path.resolve(__dirname, "../__fixtures__/asyncapi-v3.yml");
546-
let parsedAsyncAPIDocument
545+
let parsedAsyncAPIDocument;
547546

548-
async () => {
549-
const parseResult = await fromFile(parser, asyncapi_v3_path).parse();
550-
parsedAsyncAPIDocument = parseResult.document;
551-
}
547+
// Parse the AsyncAPI document (async operation)
548+
const parseResult = await fromFile(parser, asyncapi_v3_path).parse();
549+
parsedAsyncAPIDocument = parseResult.document;
552550

553551
const channels = parsedAsyncAPIDocument.channels();
554552
const queryParamsObject = getQueryParams(channels);
@@ -674,10 +672,11 @@ const parser = new Parser();
674672
const asyncapi_v3_path = path.resolve(__dirname, '../__fixtures__/asyncapi-v3.yml');
675673
let parsedAsyncAPIDocument;
676674

677-
async () => {
675+
// Parse the AsyncAPI document (async operation)
676+
(async () => {
678677
const parseResult = await fromFile(parser, asyncapi_v3_path).parse();
679678
parsedAsyncAPIDocument = parseResult.document;
680-
}
679+
})();
681680

682681
const language = "javascript"
683682
const clientName = "AccountServiceAPI"

packages/components/src/components/FileHeaderInfo.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,12 @@ const commentConfig = {
3737
* const language = "javascript"
3838
* let parsedAsyncAPIDocument;
3939
*
40-
* async () => {
41-
* const parseResult = await fromFile(parser, asyncapi_websocket_query).parse();
42-
* parsedAsyncAPIDocument = parseResult.document;
43-
* }
40+
* // Parse the AsyncAPI document (async operation)
41+
* const parseResult = await fromFile(parser, asyncapi_websocket_query).parse();
42+
* const parsedAsyncAPIDocument = parseResult.document;
4443
*
4544
* return (
46-
* <FileHeaderInfo info={parsedAsyncAPIDocument.info()} server={parsedAsyncAPIDocument.servers().get("withPathname")} language={javascript} />
45+
* <FileHeaderInfo info={parsedAsyncAPIDocument.info()} server={parsedAsyncAPIDocument.servers().get("withPathname")} language={language} />
4746
* )
4847
*/
4948
export function FileHeaderInfo({ info, server, language }) {

packages/components/src/components/HandleMessage.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ else:
4343
* const language = "javascript"
4444
* const methodName = "handleMessage"
4545
* const methodParams = ["self", "message"]
46-
* const preExecutionCode = "# Pass the incoming message to all registered message handlers."
47-
* const postExecutionCode = "# Passed the incoming message to all registered message handlers."
46+
* const preExecutionCode = "// Pass the incoming message to all registered message handlers."
47+
* const postExecutionCode = "// Passed the incoming message to all registered message handlers."
4848
* const customMethodConfig = {
4949
* javascript: {
5050
* methodDocs: "// Method to handle message with callback",

packages/components/src/components/Models.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {
2020
*/
2121

2222
/**
23-
* @typedef {object} ModelinaGenerator
23+
* @typedef {PythonGenerator | JavaGenerator | TypeScriptGenerator | CSharpGenerator | RustGenerator | JavaScriptGenerator} ModelinaGenerator
2424
* Represents any Modelina generator instance.
2525
*/
2626

@@ -66,10 +66,10 @@ const formatHelpers = {
6666
*
6767
* const parser = new Parser();
6868
* const asyncapi_v3_path = path.resolve(__dirname, "../__fixtures__/asyncapi-v3.yml");
69-
* async () => {
70-
* const parseResult = await fromFile(parser, asyncapi_v3_path).parse();
71-
* parsedAsyncAPIDocument = parseResult.document;
72-
* }
69+
*
70+
* // Parse the AsyncAPI document (async operation)
71+
* const parseResult = await fromFile(parser, asyncapi_v3_path).parse();
72+
* const parsedAsyncAPIDocument = parseResult.document;
7373
*
7474
* const language = "java"
7575
*

packages/components/src/components/QueryParamsVariables.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,11 @@ function resolveQueryParamLogic(language, framework = '') {
120120
*
121121
* const parser = new Parser();
122122
* const asyncapi_v3_path = path.resolve(__dirname, "../__fixtures__/asyncapi-v3.yml");
123-
* let parsedAsyncAPIDocument
123+
* let parsedAsyncAPIDocument;
124124
*
125-
* async () => {
126-
* const parseResult = await fromFile(parser, asyncapi_v3_path).parse();
127-
* parsedAsyncAPIDocument = parseResult.document;
128-
* }
125+
* // Parse the AsyncAPI document (async operation)
126+
* const parseResult = await fromFile(parser, asyncapi_v3_path).parse();
127+
* const parsedAsyncAPIDocument = parseResult.document;
129128
*
130129
* const channels = parsedAsyncAPIDocument.channels();
131130
* const queryParamsObject = getQueryParams(channels);

packages/components/src/components/SendOperations.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { toSnakeCase } from '@asyncapi/generator-helpers';
1414

1515
/**
1616
* @callback SendOperationGenerator
17-
* @param {Object} operation
17+
* @param {Object} operation - An AsyncAPI operation object with an id() method.
1818
* @param {string} clientName
1919
* @returns {SendOperationMethods}
2020
*/
@@ -132,10 +132,11 @@ static ${methodName}(message, socket, schemas) {
132132
* const asyncapi_v3_path = path.resolve(__dirname, '../__fixtures__/asyncapi-v3.yml');
133133
* let parsedAsyncAPIDocument;
134134
*
135-
* async () => {
135+
* // Parse the AsyncAPI document (async operation)
136+
* (async () => {
136137
* const parseResult = await fromFile(parser, asyncapi_v3_path).parse();
137138
* parsedAsyncAPIDocument = parseResult.document;
138-
* }
139+
* })();
139140
*
140141
* const language = "javascript"
141142
* const clientName = "AccountServiceAPI"

0 commit comments

Comments
 (0)