Skip to content

Commit 281f14c

Browse files
committed
standardize return types and component descriptions
1 parent 01356d1 commit 281f14c

23 files changed

+70
-62
lines changed

packages/components/docs/API.md

Lines changed: 45 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
⇒ <code>JSX.Element</code>
1515
</dt>
1616
<dd>
17-
<p>Component that renders WebSocket connection method for the specified programming language.</p>
17+
<p>Renders a WebSocket connection method for the specified programming language.</p>
1818
</dd>
1919
<dt>
2020
<a href="#DependencyProvider">DependencyProvider</a>
@@ -42,53 +42,53 @@
4242
⇒ <code>JSX.Element</code>
4343
</dt>
4444
<dd>
45-
<p>Generic Method rendering component.</p>
45+
<p>Renders a language-specific formatted method definition.</p>
4646
</dd>
4747
<dt>
4848
<a href="#Models">Models</a>
4949
⇒ <code>Array.&lt;File&gt;</code>
5050
</dt>
5151
<dd>
52-
<p>Generates and returns an array of model files based on the AsyncAPI document.</p>
52+
<p>Renders an array of model files based on the AsyncAPI document.</p>
5353
</dd>
5454
<dt>
5555
<a href="#OnClose">OnClose</a>
5656
⇒ <code>JSX.Element</code>
5757
</dt>
5858
<dd>
59-
<p>Component that renders WebSocket onClose event handler for the specified programming language.</p>
59+
<p>Renders a WebSocket onClose event handler for the specified programming language.</p>
6060
</dd>
6161
<dt>
6262
<a href="#OnError">OnError</a>
6363
⇒ <code>JSX.Element</code>
6464
</dt>
6565
<dd>
66-
<p>Component that renders WebSocket onError event handler for the specified programming language.</p>
66+
<p>Renders a WebSocket onError event handler for the specified programming language.</p>
6767
</dd>
6868
<dt>
6969
<a href="#OnMessage">OnMessage</a>
7070
⇒ <code>JSX.Element</code>
7171
</dt>
7272
<dd>
73-
<p>Component that renders WebSocket onMessage event handler for the specified programming language.</p>
73+
<p>Renders a WebSocket onMessage event handler for the specified programming language.</p>
7474
</dd>
7575
<dt>
7676
<a href="#OnOpen">OnOpen</a>
7777
⇒ <code>JSX.Element</code>
7878
</dt>
7979
<dd>
80-
<p>Component that renders WebSocket onOpen event handler for the specified programming language.</p>
80+
<p>Renders a WebSocket onOpen event handler for the specified programming language.</p>
8181
</dd>
8282
<dt>
8383
<a href="#QueryParamsVariables">QueryParamsVariables</a>
84-
⇒ <code>Array.&lt;React.ReactNode&gt;</code>
84+
⇒ <code>Array.&lt;JSX.Element&gt;</code>
8585
</dt>
8686
<dd>
87-
<p>Component for rendering query parameter variables code.</p>
87+
<p>Renders a query parameter variables code blocks.</p>
8888
</dd>
8989
<dt>
9090
<a href="#AvailableOperations">AvailableOperations</a>
91-
⇒ <code>React.ReactNode</code>
91+
⇒ <code>JSX.Element</code>
9292
</dt>
9393
<dd>
9494
<p>Renders a list of AsyncAPI operations with their headers and message examples.</p>
@@ -109,7 +109,7 @@
109109
</dd>
110110
<dt>
111111
<a href="#MessageExamples">MessageExamples</a>
112-
⇒ <code>React.ReactNode</code>
112+
⇒ <code>JSX.Element</code>
113113
</dt>
114114
<dd>
115115
<p>Renders Message Examples of a given AsyncAPI operation.</p>
@@ -163,10 +163,10 @@ provided AsyncAPI document, generator parameters, and target language.</p>
163163
</dd>
164164
<dt>
165165
<a href="#SendOperations">SendOperations</a>
166-
⇒ <code>Array.&lt;React.ReactNode&gt;</code>
166+
⇒ <code>Array.&lt;JSX.Element&gt;</code>
167167
</dt>
168168
<dd>
169-
<p>Component for rendering WebSocket send operation methods.
169+
<p>Renders WebSocket send operation methods.
170170
Generates both static and instance methods for sending messages through WebSocket connections.</p>
171171
</dd>
172172
</dl>
@@ -194,7 +194,7 @@ Renders a WebSocket close connection method with optional pre- and post-executio
194194

195195
### Returns
196196

197-
- **JSX.Element** - Rendered method block with appropriate formatting.
197+
- **JSX.Element** - A Text component that contains method block with appropriate formatting.
198198

199199

200200

@@ -226,7 +226,7 @@ return (
226226

227227
<a name="Connect"></a>
228228
## **Connect()**
229-
Component that renders WebSocket connection method for the specified programming language.
229+
Renders a WebSocket connection method for the specified programming language.
230230

231231

232232
### Parameters
@@ -280,7 +280,7 @@ Renders the top-of-file dependency statements for the selected programming langu
280280

281281
### Returns
282282

283-
- **JSX.Element** - Rendered list of import/require statements.
283+
- **JSX.Element** - A Text component that contains list of import/require statements.
284284

285285

286286

@@ -322,7 +322,7 @@ Renders a file header with metadata information such as title, version, protocol
322322

323323
### Returns
324324

325-
- **JSX.Element** - Rendered file header.
325+
- **JSX.Element** - A Text component that contains file header.
326326

327327

328328

@@ -377,7 +377,7 @@ Renders a WebSocket message handler method with optional pre- and post-execution
377377

378378
### Returns
379379

380-
- **JSX.Element** - Rendered method block with appropriate formatting.
380+
- **JSX.Element** - A Text component that contains method block with appropriate formatting.
381381

382382

383383

@@ -411,7 +411,7 @@ return (
411411

412412
<a name="MethodGenerator"></a>
413413
## **MethodGenerator()**
414-
Generic Method rendering component.
414+
Renders a language-specific formatted method definition.
415415

416416

417417
### Parameters
@@ -436,7 +436,7 @@ Generic Method rendering component.
436436

437437
### Returns
438438

439-
- **JSX.Element** - Rendered method block with appropriate formatting.
439+
- **JSX.Element** - A Text component that contains method block with appropriate formatting.
440440

441441

442442

@@ -474,7 +474,7 @@ return (
474474

475475
<a name="Models"></a>
476476
## **Models()**
477-
Generates and returns an array of model files based on the AsyncAPI document.
477+
Renders an array of model files based on the AsyncAPI document.
478478

479479

480480
### Parameters
@@ -520,14 +520,15 @@ async function renderModel() {
520520
/>
521521
)
522522
}
523+
523524
renderModel().catch(console.error);
524525
```
525526

526527

527528

528529
<a name="OnClose"></a>
529530
## **OnClose()**
530-
Component that renders WebSocket onClose event handler for the specified programming language.
531+
Renders a WebSocket onClose event handler for the specified programming language.
531532

532533

533534
### Parameters
@@ -567,7 +568,7 @@ return (
567568

568569
<a name="OnError"></a>
569570
## **OnError()**
570-
Component that renders WebSocket onError event handler for the specified programming language.
571+
Renders a WebSocket onError event handler for the specified programming language.
571572

572573

573574
### Parameters
@@ -598,7 +599,7 @@ return (
598599

599600
<a name="OnMessage"></a>
600601
## **OnMessage()**
601-
Component that renders WebSocket onMessage event handler for the specified programming language.
602+
Renders a WebSocket onMessage event handler for the specified programming language.
602603

603604

604605
### Parameters
@@ -629,7 +630,7 @@ return (
629630

630631
<a name="OnOpen"></a>
631632
## **OnOpen()**
632-
Component that renders WebSocket onOpen event handler for the specified programming language.
633+
Renders a WebSocket onOpen event handler for the specified programming language.
633634

634635

635636
### Parameters
@@ -669,7 +670,7 @@ return (
669670

670671
<a name="QueryParamsVariables"></a>
671672
## **QueryParamsVariables()**
672-
Component for rendering query parameter variables code.
673+
Renders a query parameter variables code blocks.
673674

674675

675676
### Parameters
@@ -685,7 +686,7 @@ Component for rendering query parameter variables code.
685686

686687
### Returns
687688

688-
- **Array.&lt;React.ReactNode&gt;** - Array of Text components for each query parameter, or null if queryParams is invalid.
689+
- **Array.&lt;JSX.Element&gt;** - Array of Text components for each query parameter, or null if queryParams is invalid.
689690

690691

691692

@@ -697,7 +698,6 @@ import { Parser, fromFile } from "@asyncapi/parser";
697698
import { getQueryParams } from "@asyncapi/generator-helpers";
698699
import { QueryParamsVariables } from "@asyncapi/generator-components";
699700

700-
701701
async function renderQueryParamsVariable(){
702702
const parser = new Parser();
703703
const asyncapi_v3_path = path.resolve(__dirname, "../__fixtures__/asyncapi-v3.yml");
@@ -721,6 +721,7 @@ async function renderQueryParamsVariable(){
721721
/>
722722
)
723723
}
724+
724725
renderQueryParamsVariable().catch(console.error);
725726
```
726727

@@ -742,7 +743,7 @@ Renders a list of AsyncAPI operations with their headers and message examples.
742743

743744
### Returns
744745

745-
- **React.ReactNode** - A Component containing rendered operations, or null if no operations are provided
746+
- **JSX.Element** - A Component containing rendered operations, or null if no operations are provided
746747

747748

748749

@@ -764,6 +765,7 @@ async function renderAvailableOperations(){
764765
<AvailableOperations operations={parsedAsyncAPIDocument.operations().all()} />
765766
)
766767
}
768+
767769
renderAvailableOperations().catch(console.error);
768770
```
769771

@@ -785,7 +787,7 @@ Renders a list of core WebSocket client methods for a given target language.
785787

786788
### Returns
787789

788-
- **JSX.Element** - A Text Component that contains a list of core client methods.
790+
- **JSX.Element** - A Text component that contains a list of core client methods.
789791

790792

791793

@@ -816,7 +818,7 @@ Renders the Installation Command for a given language.
816818

817819
### Returns
818820

819-
- **JSX.Element** - A Text Component that contains Installation Command.
821+
- **JSX.Element** - A Text component that contains Installation Command.
820822

821823

822824

@@ -847,7 +849,7 @@ Renders Message Examples of a given AsyncAPI operation.
847849

848850
### Returns
849851

850-
- **React.ReactNode** - A Text Component that contains message examples, or null when no examples exist.
852+
- **JSX.Element** - A Text component that contains message examples, or null when no examples exist.
851853

852854

853855

@@ -872,6 +874,7 @@ async function renderMessageExamples(){
872874
)
873875
});
874876
}
877+
875878
renderMessageExamples().catch(console.error);
876879
```
877880

@@ -893,7 +896,7 @@ Renders a header section for a single AsyncAPI operation.
893896

894897
### Returns
895898

896-
- **JSX.Element** - A Text Component that contains formatted operation header.
899+
- **JSX.Element** - A Text component that contains formatted operation header.
897900

898901

899902

@@ -918,6 +921,7 @@ async function renderOperationHeader(){
918921
)
919922
});
920923
}
924+
921925
renderOperationHeader().catch(console.error);
922926
```
923927

@@ -942,7 +946,7 @@ Displays the API description, version, and server URL.
942946

943947
### Returns
944948

945-
- **JSX.Element** - A Text Component that contains the Overview of a Websocket client.
949+
- **JSX.Element** - A Text component that contains the Overview of a Websocket client.
946950

947951

948952

@@ -974,6 +978,7 @@ async function renderOverview(){
974978
/>
975979
)
976980
}
981+
977982
renderOverview().catch(console.error);
978983
```
979984

@@ -1031,6 +1036,7 @@ async function renderReadme(){
10311036
/>
10321037
)
10331038
}
1039+
10341040
renderReadme().catch(console.error);
10351041
```
10361042

@@ -1097,7 +1103,7 @@ Renders a WebSocket error handler registration method with optional pre- and pos
10971103

10981104
### Returns
10991105

1100-
- **JSX.Element** - Rendered method block with appropriate formatting.
1106+
- **JSX.Element** - A Text component that contains method block with appropriate formatting.
11011107

11021108

11031109

@@ -1145,7 +1151,7 @@ Renders a WebSocket message handler registration method with optional pre- and p
11451151

11461152
### Returns
11471153

1148-
- **JSX.Element** - Rendered method block with appropriate formatting.
1154+
- **JSX.Element** - A Text component that contains method block with appropriate formatting.
11491155

11501156

11511157

@@ -1173,7 +1179,7 @@ return (
11731179

11741180
<a name="SendOperations"></a>
11751181
## **SendOperations()**
1176-
Component for rendering WebSocket send operation methods.
1182+
Renders WebSocket send operation methods.
11771183
Generates both static and instance methods for sending messages through WebSocket connections.
11781184

11791185

@@ -1190,7 +1196,7 @@ Generates both static and instance methods for sending messages through WebSocke
11901196

11911197
### Returns
11921198

1193-
- **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.
1199+
- **Array.&lt;JSX.Element&gt;** - Array of Text components for static and non-static WebSocket send operation methods, or null if no send operations are provided.
11941200

11951201

11961202

@@ -1221,6 +1227,7 @@ async function renderSendOperations(){
12211227
/>
12221228
)
12231229
}
1230+
12241231
renderSendOperations().catch(console.error);
12251232
```
12261233

packages/components/src/components/CloseConnection.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ print('WebSocket connection closed.');`
6868
* @param {string} props.preExecutionCode - Code to insert before the main function logic.
6969
* @param {string} props.postExecutionCode - Code to insert after the main function logic.
7070
* @param {number} props.indent=2 - Indentation level for the method block.
71-
* @returns {JSX.Element} Rendered method block with appropriate formatting.
71+
* @returns {JSX.Element} A Text component that contains method block with appropriate formatting.
7272
*
7373
* @example
7474
* const language = "java";

packages/components/src/components/Connect.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ Future<void> connect() async {
9292
};
9393

9494
/**
95-
* Component that renders WebSocket connection method for the specified programming language.
95+
* Renders a WebSocket connection method for the specified programming language.
9696
*
9797
* @param {Object} props - Component properties.
9898
* @param {Language} props.language - The programming language for which to generate connection code.

0 commit comments

Comments
 (0)