Skip to content

Commit a9be50e

Browse files
committed
make jsdoc consistent across all components
1 parent a9ae2de commit a9be50e

File tree

11 files changed

+64
-56
lines changed

11 files changed

+64
-56
lines changed

packages/components/docs/API.md

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
</dd>
5252
<dt>
5353
<a href="#OnClose">OnClose</a>
54+
⇒ <code>JSX.Element</code>
5455
</dt>
5556
<dd>
5657
<p>Component that renders WebSocket onClose event handler for the specified programming language.</p>
@@ -117,7 +118,7 @@ Renders a WebSocket close connection method with optional pre- and post-executio
117118
| props.language | Language | Programming language used for method formatting. |
118119
| props.framework | string | Framework used, if any (e.g., &#x27;quarkus&#x27; for Java). |
119120
| props.methodName | string | Name of the method to generate. |
120-
| props.methodParams | Array.&lt;string&gt; | List of parameters for the method. |
121+
| props.methodParams | Array.<string> | List of parameters for the method. |
121122
| props.preExecutionCode | string | Code to insert before the main function logic. |
122123
| props.postExecutionCode | string | Code to insert after the main function logic. |
123124
| props.indent | number | Indentation level for the method block. |
@@ -158,7 +159,7 @@ Component that renders WebSocket connection method for the specified programming
158159
| Name | Type | Description |
159160
|------|------|-------------|
160161
| props | Object | Component properties. |
161-
| props.language | SupportedLanguage | The programming language for which to generate connection code. |
162+
| props.language | Language | The programming language for which to generate connection code. |
162163
| props.title | string | The title of the WebSocket server. |
163164

164165

@@ -190,7 +191,7 @@ Renders the top-of-file dependency statements for the selected programming langu
190191
| props.language | Language | The programming language for which to render dependency statements. |
191192
| props.framework | string | The framework (e.g., &#x27;quarkus&#x27; for Java). |
192193
| props.role | string | The role (e.g., &#x27;client&#x27;, &#x27;connector&#x27; for Java). |
193-
| props.additionalDependencies | Array.&lt;string&gt; | Optional additional dependencies to include. |
194+
| props.additionalDependencies | Array.<string> | Optional additional dependencies to include. |
194195

195196

196197

@@ -270,7 +271,7 @@ Renders a WebSocket message handler method with optional pre- and post-execution
270271
| props | Object | Component props. |
271272
| props.language | Language | Programming language used for method formatting. |
272273
| props.methodName | string | Name of the method to generate. |
273-
| props.methodParams | Array.&lt;string&gt; | List of parameters for the method. |
274+
| props.methodParams | Array.<string> | List of parameters for the method. |
274275
| props.preExecutionCode | string | Code to insert before the main function logic. |
275276
| props.postExecutionCode | string | Code to insert after the main function logic. |
276277
| props.customMethodConfig | Object | Optional overrides for default method configuration. |
@@ -316,15 +317,15 @@ Generic Method rendering component.
316317
| props | Object | Component props. |
317318
| props.language | Language | Programming language used for method formatting. |
318319
| props.methodName | string | Name of the method. |
319-
| props.methodParams | Array.&lt;string&gt; | Method parameters. |
320+
| props.methodParams | Array.<string> | Method parameters. |
320321
| props.methodDocs | string | Optional documentation string. |
321322
| props.methodLogic | string | Core method logic. |
322323
| props.preExecutionCode | string | Code before main logic. |
323324
| props.postExecutionCode | string | Code after main logic. |
324325
| props.indent | number | Indentation for the method block. |
325326
| props.newLines | number | Number of new lines after method. |
326327
| props.customMethodConfig | Object | Optional custom syntax configuration for the current language. |
327-
| props.methodConfig | Record.&lt;Language, ({methodDocs: string, methodLogic: string}&amp;#124;Record.&lt;string, {methodDocs: string, methodLogic: string}&gt;)&gt; | Language-level or framework-level configuration. |
328+
| props.methodConfig | Record.<Language, ({methodDocs: (string&#124;undefined), methodLogic: (string&#124;undefined)}&#124;Record.<string, {methodDocs: (string&#124;undefined), methodLogic: (string&#124;undefined)}>)> | Language-level or framework-level configuration. |
328329
| props.framework | string | Framework name for nested configurations (e.g., &#x27;quarkus&#x27; for Java). |
329330

330331

@@ -336,10 +337,10 @@ Generic Method rendering component.
336337
const language = "java"
337338
const methodName = "registerHandler"
338339
const methodParams = ["self", "handler"]
339-
const methodDocs = "# Process the input data."
340-
const methodLogic = "pass"
341-
const preExecutionCode = "# Before handler registration"
342-
const postExecutionCode = "# After handler registration"
340+
const methodDocs = "// Process the input data."
341+
const methodLogic = "// TODO: implement"
342+
const preExecutionCode = "// Before handler registration"
343+
const postExecutionCode = "// After handler registration"
343344
const customMethodConfig={ openingTag: "{", closingTag: "}", indentSize: 6 }
344345
const methodConfig = {"java" : {methodDocs : methodDocs, methodLogic: methodLogic }}
345346
const framework = "quarkus"
@@ -407,12 +408,17 @@ Component that renders WebSocket onClose event handler for the specified program
407408
| Name | Type | Description |
408409
|------|------|-------------|
409410
| props | Object | Component properties. |
410-
| props.language | SupportedLanguage | The programming language for which to generate onClose handler code. |
411+
| props.language | Language | The programming language for which to generate onClose handler code. |
411412
| props.framework | string | Optional framework variant (e.g., &#x27;quarkus&#x27; for java). |
412413
| props.title | string | The title of the WebSocket server. |
413414

414415

415416

417+
### Returns
418+
419+
- **JSX.Element** - A Text component containing the onClose handler code for the specified language.
420+
421+
416422

417423
### Example
418424

@@ -438,15 +444,15 @@ Component that renders WebSocket onError event handler for the specified program
438444
| Name | Type | Description |
439445
|------|------|-------------|
440446
| props | Object | Component properties. |
441-
| props.language | SupportedLanguage | The programming language for which to generate onError handler code. |
447+
| props.language | Language | The programming language for which to generate onError handler code. |
442448

443449

444450

445451

446452
### Example
447453

448454
```js
449-
const language = "java"
455+
const language = "javascript"
450456
return (
451457
<OnError language={language} />
452458
)
@@ -464,15 +470,15 @@ Component that renders WebSocket onMessage event handler for the specified progr
464470
| Name | Type | Description |
465471
|------|------|-------------|
466472
| props | Object | Component properties. |
467-
| props.language | SupportedLanguage | The programming language for which to generate onMessage handler code. |
473+
| props.language | Language | The programming language for which to generate onMessage handler code. |
468474

469475

470476

471477

472478
### Example
473479

474480
```js
475-
const language = "java"
481+
const language = "javascript"
476482
return (
477483
<OnMessage language={language} />
478484
)
@@ -490,7 +496,7 @@ Component that renders WebSocket onOpen event handler for the specified programm
490496
| Name | Type | Description |
491497
|------|------|-------------|
492498
| props | Object | Component properties. |
493-
| props.language | SupportedLanguage | The programming language for which to generate onOpen handler code. |
499+
| props.language | Language | The programming language for which to generate onOpen handler code. |
494500
| props.framework | string | Optional framework variant (e.g., &#x27;quarkus&#x27; for java). |
495501
| props.title | string | The title of the WebSocket server. |
496502

@@ -521,9 +527,9 @@ Component for rendering query parameter variables code.
521527
| Name | Type | Description |
522528
|------|------|-------------|
523529
| props | Object | Component props. |
524-
| props.language | SupportedLanguage | The target programming language. |
530+
| props.language | Language | The target programming language. |
525531
| props.framework | string | Optional framework for the language. |
526-
| props.queryParams | Array.&lt;Array.&lt;string&gt;&gt; | Array of query parameters, each represented as [paramName, paramType?]. |
532+
| props.queryParams | Array.<Array.<string>> | Array of query parameters, each represented as [paramName, paramType?]. |
527533

528534

529535

@@ -573,7 +579,7 @@ Renders a WebSocket error handler registration method with optional pre- and pos
573579
| props | Object | Component props. |
574580
| props.language | Language | Programming language used for method formatting. |
575581
| props.methodName | string | Name of the method to generate. |
576-
| props.methodParams | Array.&lt;string&gt; | List of parameters for the method. |
582+
| props.methodParams | Array.<string> | List of parameters for the method. |
577583
| props.preExecutionCode | string | Code to insert before the main function logic. |
578584
| props.postExecutionCode | string | Code to insert after the main function logic. |
579585
| props.customMethodConfig | Object | Optional overrides for default method configuration. |
@@ -615,7 +621,7 @@ Renders a WebSocket message handler registration method with optional pre- and p
615621
| props | Object | Component props. |
616622
| props.language | Language | Programming language used for method formatting. |
617623
| props.methodName | string | Name of the method to generate. |
618-
| props.methodParams | Array.&lt;string&gt; | List of parameters for the method. |
624+
| props.methodParams | Array.<string> | List of parameters for the method. |
619625
| props.preExecutionCode | string | Code to insert before the main function logic. |
620626
| props.postExecutionCode | string | Code to insert after the main function logic. |
621627

@@ -654,8 +660,8 @@ Generates both static and instance methods for sending messages through WebSocke
654660
| Name | Type | Description |
655661
|------|------|-------------|
656662
| props | Object | Component props. |
657-
| props.language | SupportedLanguage | The target programming language. |
658-
| props.sendOperations | Array.&lt;Object&gt; | Array of send operations from AsyncAPI document. |
663+
| props.language | Language | The target programming language. |
664+
| props.sendOperations | Array.<Object> | Array of send operations from AsyncAPI document. |
659665
| props.clientName | string | The name of the client class. |
660666

661667

packages/components/jsdoc2md-handlebars/api.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
| Name | Type | Description |
2929
|------|------|-------------|
3030
{{#each params}}
31-
| {{name}} | {{escapeType type.names.[0]}} | {{description}} |
31+
| {{name}} | {{{escapeType type.names.[0]}}} | {{description}} |
3232
{{/each}}
3333

3434
{{/if}}

packages/components/src/components/Connect.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ import { OnError } from './OnError';
55
import { OnClose } from './OnClose';
66

77
/**
8-
* @typedef {'python' | 'javascript' | 'dart'} SupportedLanguage
8+
* @typedef {'python' | 'javascript' | 'dart'} Language
99
* Supported programming languages for WebSocket connection method generation.
1010
*/
1111

1212
/**
1313
* Mapping of supported programming languages to their WebSocket connection method implementations.
1414
*
15-
* @type {Object.<SupportedLanguage, Function>}
15+
* @type {Object.<Language, Function>}
1616
*/
1717
const websocketConnectMethod = {
1818
javascript: (onOpenMethod, onMessageMethod, onErrorMethod, onCloseMethod) => {
@@ -95,7 +95,7 @@ Future<void> connect() async {
9595
* Component that renders WebSocket connection method for the specified programming language.
9696
*
9797
* @param {Object} props - Component properties.
98-
* @param {SupportedLanguage} props.language - The programming language for which to generate connection code.
98+
* @param {Language} props.language - The programming language for which to generate connection code.
9999
* @param {string} props.title - The title of the WebSocket server.
100100
*
101101
* @example

packages/components/src/components/MethodGenerator.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,18 +71,18 @@ const buildIndentedLogic = (logic, preExecutionCode, postExecutionCode, indentSi
7171
* @param {string} [props.postExecutionCode=''] - Code after main logic.
7272
* @param {number} [props.indent=2] - Indentation for the method block.
7373
* @param {number} [props.newLines=1] - Number of new lines after method.
74-
* @param {{ returnType: string, openingTag: string, closingTag: string, indentSize: number, parameterWrap: boolean }} [props.customMethodConfig] - Optional custom syntax configuration for the current language.
75-
* @param {Record<Language, { methodDocs: string, methodLogic: string } | Record<string, { methodDocs: string, methodLogic: string }>>} [props.methodConfig] - Language-level or framework-level configuration.
74+
* @param {{ returnType: string | undefined, openingTag: string | undefined, closingTag: string | undefined, indentSize: number | undefined, parameterWrap: boolean | undefined }} [props.customMethodConfig] - Optional custom syntax configuration for the current language.
75+
* @param {Record<Language, { methodDocs: string | undefined, methodLogic: string | undefined } | Record<string, { methodDocs: string | undefined, methodLogic: string | undefined }>>} [props.methodConfig] - Language-level or framework-level configuration.
7676
* @param {string} [props.framework] - Framework name for nested configurations (e.g., 'quarkus' for Java).
7777
*
7878
* @example
7979
* const language = "java"
8080
* const methodName = "registerHandler"
8181
* const methodParams = ["self", "handler"]
82-
* const methodDocs = "# Process the input data."
83-
* const methodLogic = "pass"
84-
* const preExecutionCode = "# Before handler registration"
85-
* const postExecutionCode = "# After handler registration"
82+
* const methodDocs = "// Process the input data."
83+
* const methodLogic = "// TODO: implement"
84+
* const preExecutionCode = "// Before handler registration"
85+
* const postExecutionCode = "// After handler registration"
8686
* const customMethodConfig={ openingTag: "{", closingTag: "}", indentSize: 6 }
8787
* const methodConfig = {"java" : {methodDocs : methodDocs, methodLogic: methodLogic }}
8888
* const framework = "quarkus"

packages/components/src/components/Models.js

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

2222
/**
23-
* @typedef {PythonGenerator | JavaGenerator | TypeScriptGenerator | CSharpGenerator | RustGenerator | JavaScriptGenerator} ModelinaGeneratorClass
24-
* Represents any Modelina generator instance.
23+
* @typedef {PythonGenerator | JavaGenerator | TypeScriptGenerator | CSharpGenerator | RustGenerator | JavaScriptGenerator} ModelinaGeneratorConstructor
24+
* Represents any Modelina generator constructor.
2525
*/
2626

2727
/**
2828
* Mapping of language strings to Modelina generator classes and file extensions.
29-
* @type {Record<string, { generator: ModelinaGeneratorClass, extension: string }>}
29+
* @type {Record<string, { generator: ModelinaGeneratorConstructor, extension: string }>}
3030
*/
3131
const generatorConfig = {
3232
python: { generator: PythonGenerator, extension: 'py' },

packages/components/src/components/OnClose.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import { Text } from '@asyncapi/generator-react-sdk';
22

33
/**
4-
* @typedef {'python' | 'javascript' | 'dart' | 'java' } SupportedLanguage
4+
* @typedef {'python' | 'javascript' | 'dart' | 'java' } Language
55
* Supported programming languages for WebSocket onClose handler generation.
66
*/
77

88
/**
99
* Mapping of supported programming languages to their WebSocket onClose event handler implementations.
1010
*
11-
* @type {Object.<SupportedLanguage, Function>}
11+
* @type {Object.<Language, Function>}
1212
*/
1313
const websocketOnCloseMethod = {
1414
javascript: (title) => {
@@ -61,10 +61,12 @@ const resolveCloseConfig = (language, framework = '') => {
6161
* Component that renders WebSocket onClose event handler for the specified programming language.
6262
*
6363
* @param {Object} props - Component properties.
64-
* @param {SupportedLanguage} props.language - The programming language for which to generate onClose handler code.
64+
* @param {Language} props.language - The programming language for which to generate onClose handler code.
6565
* @param {string} [props.framework=''] - Optional framework variant (e.g., 'quarkus' for java).
6666
* @param {string} props.title - The title of the WebSocket server.
6767
*
68+
* @returns {JSX.Element} A Text component containing the onClose handler code for the specified language.
69+
*
6870
* @example
6971
* const language = "java"
7072
* const framework = "quarkus"

packages/components/src/components/OnError.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import { Text } from '@asyncapi/generator-react-sdk';
22

33
/**
4-
* @typedef {'python' | 'javascript' | 'dart'} SupportedLanguage
4+
* @typedef {'python' | 'javascript' | 'dart'} Language
55
* Supported programming languages for WebSocket onError handler generation.
66
*/
77

88
/**
99
* Mapping of supported programming languages to their WebSocket onError event handler implementations.
1010
*
11-
* @type {Object.<SupportedLanguage, Function>}
11+
* @type {Object.<Language, Function>}
1212
*/
1313
const websocketOnErrorMethod = {
1414
javascript: () => {
@@ -52,10 +52,10 @@ const websocketOnErrorMethod = {
5252
* Component that renders WebSocket onError event handler for the specified programming language.
5353
*
5454
* @param {Object} props - Component properties.
55-
* @param {SupportedLanguage} props.language - The programming language for which to generate onError handler code.
55+
* @param {Language} props.language - The programming language for which to generate onError handler code.
5656
*
5757
* @example
58-
* const language = "java"
58+
* const language = "javascript"
5959
* return (
6060
* <OnError language={language} />
6161
* )

packages/components/src/components/OnMessage.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import { Text } from '@asyncapi/generator-react-sdk';
22

33
/**
4-
* @typedef {'python' | 'javascript' | 'dart'} SupportedLanguage
4+
* @typedef {'python' | 'javascript' | 'dart'} Language
55
* Supported programming languages for WebSocket onMessage handler generation.
66
*/
77

88
/**
99
* Mapping of supported programming languages to their WebSocket onMessage event handler implementations.
1010
*
11-
* @type {Object.<SupportedLanguage, Function>}
11+
* @type {Object.<Language, Function>}
1212
*/
1313
const websocketOnMessageMethod = {
1414
javascript: () => {
@@ -80,10 +80,10 @@ const websocketOnMessageMethod = {
8080
* Component that renders WebSocket onMessage event handler for the specified programming language.
8181
*
8282
* @param {Object} props - Component properties.
83-
* @param {SupportedLanguage} props.language - The programming language for which to generate onMessage handler code.
83+
* @param {Language} props.language - The programming language for which to generate onMessage handler code.
8484
*
8585
* @example
86-
* const language = "java"
86+
* const language = "javascript"
8787
* return (
8888
* <OnMessage language={language} />
8989
* )

packages/components/src/components/OnOpen.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import { Text } from '@asyncapi/generator-react-sdk';
22

33
/**
4-
* @typedef {'python' | 'javascript' | 'java'} SupportedLanguage
4+
* @typedef {'python' | 'javascript' | 'java'} Language
55
* Supported programming languages for WebSocket onOpen handler generation.
66
*/
77

88
/**
99
* Mapping of supported programming languages to their WebSocket onOpen event handler implementations.
1010
*
11-
* @type {Object.<SupportedLanguage, Function>}
11+
* @type {Object.<Language, Function>}
1212
*/
1313
const websocketOnOpenMethod = {
1414
javascript: (title) => {
@@ -53,7 +53,7 @@ const resolveOpenConfig = (language, framework = '') => {
5353
* Component that renders WebSocket onOpen event handler for the specified programming language.
5454
*
5555
* @param {Object} props - Component properties.
56-
* @param {SupportedLanguage} props.language - The programming language for which to generate onOpen handler code.
56+
* @param {Language} props.language - The programming language for which to generate onOpen handler code.
5757
* @param {string} [props.framework=''] - Optional framework variant (e.g., 'quarkus' for java).
5858
* @param {string} props.title - The title of the WebSocket server.
5959
*

0 commit comments

Comments
 (0)