Skip to content

Commit f47f65f

Browse files
committed
refine jsdoc comments
1 parent 62a49f9 commit f47f65f

File tree

6 files changed

+38
-48
lines changed

6 files changed

+38
-48
lines changed

packages/components/docs/API.md

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -246,15 +246,13 @@ import { Parser, fromFile } from "@asyncapi/parser";
246246
const parser = new Parser();
247247
const asyncapi_websocket_query = path.resolve(__dirname, "../../../helpers/test/__fixtures__/asyncapi-websocket-query.yml");
248248
const language = "javascript"
249-
let parsedAsyncAPIDocument;
250249

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

256254
return (
257-
<FileHeaderInfo info={parsedAsyncAPIDocument.info()} server={parsedAsyncAPIDocument.servers().get("withPathname")} language={javascript} />
255+
<FileHeaderInfo info={parsedAsyncAPIDocument.info()} server={parsedAsyncAPIDocument.servers().get("withPathname")} language={language} />
258256
)
259257
```
260258

@@ -291,16 +289,16 @@ Renders a WebSocket message handler method with optional pre- and post-execution
291289
const language = "javascript"
292290
const methodName = "handleMessage"
293291
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."
292+
const preExecutionCode = "// Pass the incoming message to all registered message handlers."
293+
const postExecutionCode = "// Passed the incoming message to all registered message handlers."
296294
const customMethodConfig = {
297295
javascript: {
298296
methodDocs: "// Method to handle message with callback",
299297
methodLogic: "if (cb) cb(message);"
300298
}
301299
};
302300
return (
303-
<HandleMessage language={language} methodName={methodName} methodParams={methodParams} preExecutionCode={preExecutionCode} postExecutionCode = {postExecutionCode} customMethodConfig={customMethodConfig} />
301+
<HandleMessage language={language} methodName={methodName} methodParams={methodParams} preExecutionCode={preExecutionCode} postExecutionCode={postExecutionCode} customMethodConfig={customMethodConfig} />
304302
)
305303
```
306304

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

386384
const parser = new Parser();
387385
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-
}
386+
387+
// Parse the AsyncAPI document (async operation)
388+
const parseResult = await fromFile(parser, asyncapi_v3_path).parse();
389+
const parsedAsyncAPIDocument = parseResult.document;
392390

393391
const language = "java"
394392

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

544542
const parser = new Parser();
545543
const asyncapi_v3_path = path.resolve(__dirname, "../__fixtures__/asyncapi-v3.yml");
546-
let parsedAsyncAPIDocument
544+
let parsedAsyncAPIDocument;
547545

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

553550
const channels = parsedAsyncAPIDocument.channels();
554551
const queryParamsObject = getQueryParams(channels);
@@ -672,12 +669,10 @@ import { Parser, fromFile } from "@asyncapi/parser";
672669

673670
const parser = new Parser();
674671
const asyncapi_v3_path = path.resolve(__dirname, '../__fixtures__/asyncapi-v3.yml');
675-
let parsedAsyncAPIDocument;
676672

677-
async () => {
678-
const parseResult = await fromFile(parser, asyncapi_v3_path).parse();
679-
parsedAsyncAPIDocument = parseResult.document;
680-
}
673+
// Parse the AsyncAPI document (async operation)
674+
const parseResult = await fromFile(parser, asyncapi_v3_path).parse();
675+
const parsedAsyncAPIDocument = parseResult.document;
681676

682677
const language = "javascript"
683678
const clientName = "AccountServiceAPI"

packages/components/src/components/FileHeaderInfo.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,13 @@ const commentConfig = {
3535
* const parser = new Parser();
3636
* const asyncapi_websocket_query = path.resolve(__dirname, "../../../helpers/test/__fixtures__/asyncapi-websocket-query.yml");
3737
* const language = "javascript"
38-
* let parsedAsyncAPIDocument;
3938
*
40-
* async () => {
41-
* const parseResult = await fromFile(parser, asyncapi_websocket_query).parse();
42-
* parsedAsyncAPIDocument = parseResult.document;
43-
* }
39+
* // Parse the AsyncAPI document (async operation)
40+
* const parseResult = await fromFile(parser, asyncapi_websocket_query).parse();
41+
* const parsedAsyncAPIDocument = parseResult.document;
4442
*
4543
* return (
46-
* <FileHeaderInfo info={parsedAsyncAPIDocument.info()} server={parsedAsyncAPIDocument.servers().get("withPathname")} language={javascript} />
44+
* <FileHeaderInfo info={parsedAsyncAPIDocument.info()} server={parsedAsyncAPIDocument.servers().get("withPathname")} language={language} />
4745
* )
4846
*/
4947
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: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ import {
1515
*/
1616

1717
/**
18-
* @typedef {'python' | 'java' | 'typescript' | 'rust' | 'csharp'} Language
18+
* @typedef {'python' | 'java' | 'typescript' | 'rust' | 'csharp' | 'js'} Language
1919
* Represents the available programming languages for model generation.
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 & 6 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
*/
@@ -130,12 +130,10 @@ static ${methodName}(message, socket, schemas) {
130130
*
131131
* const parser = new Parser();
132132
* const asyncapi_v3_path = path.resolve(__dirname, '../__fixtures__/asyncapi-v3.yml');
133-
* let parsedAsyncAPIDocument;
134133
*
135-
* async () => {
136-
* const parseResult = await fromFile(parser, asyncapi_v3_path).parse();
137-
* parsedAsyncAPIDocument = parseResult.document;
138-
* }
134+
* // Parse the AsyncAPI document (async operation)
135+
* const parseResult = await fromFile(parser, asyncapi_v3_path).parse();
136+
* const parsedAsyncAPIDocument = parseResult.document;
139137
*
140138
* const language = "javascript"
141139
* const clientName = "AccountServiceAPI"

0 commit comments

Comments
 (0)