Skip to content

Commit 23f1e29

Browse files
committed
add @returns descriptions to generator components
1 parent 6c6cc6e commit 23f1e29

File tree

7 files changed

+43
-0
lines changed

7 files changed

+43
-0
lines changed

packages/components/docs/API.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
</dd>
1212
<dt>
1313
<a href="#Connect">Connect</a>
14+
⇒ <code>JSX.Element</code>
1415
</dt>
1516
<dd>
1617
<p>Component that renders WebSocket connection method for the specified programming language.</p>
@@ -38,6 +39,7 @@
3839
</dd>
3940
<dt>
4041
<a href="#MethodGenerator">MethodGenerator</a>
42+
⇒ <code>JSX.Element</code>
4143
</dt>
4244
<dd>
4345
<p>Generic Method rendering component.</p>
@@ -58,18 +60,21 @@
5860
</dd>
5961
<dt>
6062
<a href="#OnError">OnError</a>
63+
⇒ <code>JSX.Element</code>
6164
</dt>
6265
<dd>
6366
<p>Component that renders WebSocket onError event handler for the specified programming language.</p>
6467
</dd>
6568
<dt>
6669
<a href="#OnMessage">OnMessage</a>
70+
⇒ <code>JSX.Element</code>
6771
</dt>
6872
<dd>
6973
<p>Component that renders WebSocket onMessage event handler for the specified programming language.</p>
7074
</dd>
7175
<dt>
7276
<a href="#OnOpen">OnOpen</a>
77+
⇒ <code>JSX.Element</code>
7378
</dt>
7479
<dd>
7580
<p>Component that renders WebSocket onOpen event handler for the specified programming language.</p>
@@ -97,6 +102,7 @@
97102
</dd>
98103
<dt>
99104
<a href="#SendOperations">SendOperations</a>
105+
⇒ <code>Array.&lt;React.ReactNode&gt;</code>
100106
</dt>
101107
<dd>
102108
<p>Component for rendering WebSocket send operation methods.
@@ -172,6 +178,11 @@ Component that renders WebSocket connection method for the specified programming
172178

173179

174180

181+
### Returns
182+
183+
- **JSX.Element** - A Text component containing the generated WebSocket connection code for the specified language.
184+
185+
175186

176187
### Example
177188

@@ -360,6 +371,11 @@ Generic Method rendering component.
360371

361372

362373

374+
### Returns
375+
376+
- **JSX.Element** - Rendered method block with appropriate formatting.
377+
378+
363379

364380
### Example
365381

@@ -375,6 +391,7 @@ const customMethodConfig={ openingTag: "{", closingTag: "}", indentSize: 6 };
375391
const methodConfig = {"java" : {methodDocs : methodDocs, methodLogic: methodLogic }};
376392
const framework = "quarkus";
377393

394+
378395
return (
379396
<MethodGenerator
380397
language={language}
@@ -499,6 +516,11 @@ Component that renders WebSocket onError event handler for the specified program
499516

500517

501518

519+
### Returns
520+
521+
- **JSX.Element** - A Text component containing the onError handler code for the specified language.
522+
523+
502524

503525
### Example
504526

@@ -525,6 +547,11 @@ Component that renders WebSocket onMessage event handler for the specified progr
525547

526548

527549

550+
### Returns
551+
552+
- **JSX.Element** - A Text component containing the onMessage handler code for the specified language.
553+
554+
528555

529556
### Example
530557

@@ -553,6 +580,11 @@ Component that renders WebSocket onOpen event handler for the specified programm
553580

554581

555582

583+
### Returns
584+
585+
- **JSX.Element** - A Text component containing the onOpen handler code for the specified language.
586+
587+
556588

557589
### Example
558590

@@ -742,6 +774,11 @@ Generates both static and instance methods for sending messages through WebSocke
742774

743775

744776

777+
### Returns
778+
779+
- **Array.&lt;React.ReactNode&gt;** - Array of Text components for static and non-static WebSocket send operation methods, or null if no send operations are provided.
780+
781+
745782

746783
### Example
747784

packages/components/src/components/Connect.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ Future<void> connect() async {
9797
* @param {Object} props - Component properties.
9898
* @param {Language} props.language - The programming language for which to generate connection code.
9999
* @param {string} props.title - The title of the WebSocket server.
100+
* @return {JSX.Element} A Text component containing the generated WebSocket connection code for the specified language.
100101
*
101102
* @example
102103
* const language = "python";

packages/components/src/components/MethodGenerator.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ const buildIndentedLogic = (logic, preExecutionCode, postExecutionCode, indentSi
7474
* @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.
7575
* @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).
77+
* @returns {JSX.Element} Rendered method block with appropriate formatting.
7778
*
7879
* @example
7980
* const language = "java";

packages/components/src/components/OnError.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ const websocketOnErrorMethod = {
5353
*
5454
* @param {Object} props - Component properties.
5555
* @param {Language} props.language - The programming language for which to generate onError handler code.
56+
* @returns {JSX.Element} A Text component containing the onError handler code for the specified language.
5657
*
5758
* @example
5859
* const language = "javascript";

packages/components/src/components/OnMessage.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ const websocketOnMessageMethod = {
8181
*
8282
* @param {Object} props - Component properties.
8383
* @param {Language} props.language - The programming language for which to generate onMessage handler code.
84+
* @returns {JSX.Element} A Text component containing the onMessage handler code for the specified language.
8485
*
8586
* @example
8687
* const language = "javascript";

packages/components/src/components/OnOpen.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ const resolveOpenConfig = (language, framework = '') => {
5656
* @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.
59+
* @returns {JSX.Element} A Text component containing the onOpen handler code for the specified language.
5960
*
6061
* @example
6162
* const language = "java";

packages/components/src/components/SendOperations.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ static ${methodName}(message, socket, schemas) {
123123
* @param {Language} props.language - The target programming language.
124124
* @param {Array<Object>} props.sendOperations - Array of send operations from AsyncAPI document.
125125
* @param {string} props.clientName - The name of the client class.
126+
* @returns {React.ReactNode[]|null} Array of Text components for static and non-static WebSocket send operation methods, or null if no send operations are provided.
126127
*
127128
* @example
128129
* import path from "path";

0 commit comments

Comments
 (0)