Skip to content

Commit 43b7af4

Browse files
committed
add missing imports to examples
1 parent 281f14c commit 43b7af4

File tree

13 files changed

+40
-30
lines changed

13 files changed

+40
-30
lines changed

packages/components/docs/API.md

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
⇒ <code>Array.&lt;JSX.Element&gt;</code>
8585
</dt>
8686
<dd>
87-
<p>Renders a query parameter variables code blocks.</p>
87+
<p>Renders query parameter variables code blocks.</p>
8888
</dd>
8989
<dt>
9090
<a href="#AvailableOperations">AvailableOperations</a>
@@ -145,7 +145,7 @@ provided AsyncAPI document, generator parameters, and target language.</p>
145145
⇒ <code>JSX.Element</code>
146146
</dt>
147147
<dd>
148-
<p>Renders a usage example snippet for a generated client in a given language.</p>
148+
<p>Renders a usage example snippet for a generated WebSocket client in a given language.</p>
149149
</dd>
150150
<dt>
151151
<a href="#RegisterErrorHandler">RegisterErrorHandler</a>
@@ -204,7 +204,7 @@ Renders a WebSocket close connection method with optional pre- and post-executio
204204
const language = "java";
205205
const framework = "quarkus";
206206
const methodName = "terminateConnection";
207-
const methodParams = ["self"];
207+
const methodParams = ["String reason"];
208208
const preExecutionCode = "// About to terminate connection";
209209
const postExecutionCode = "// Connection terminated";
210210
const indent = 2;
@@ -314,8 +314,8 @@ Renders a file header with metadata information such as title, version, protocol
314314
| Name | Type | Description |
315315
|------|------|-------------|
316316
| props | <code>Object</code> | Component props. |
317-
| props.info | <code>object</code> | Info object from the AsyncAPI document. |
318-
| props.server | <code>object</code> | Server object from the AsyncAPI document. |
317+
| props.info | <code>Object</code> | Info object from the AsyncAPI document. |
318+
| props.server | <code>Object</code> | Server object from the AsyncAPI document. |
319319
| props.language | <code>Language</code> | Programming language used for comment formatting. |
320320

321321

@@ -386,7 +386,7 @@ Renders a WebSocket message handler method with optional pre- and post-execution
386386
```js
387387
const language = "javascript";
388388
const methodName = "handleMessage";
389-
const methodParams = ["self", "message"];
389+
const methodParams = ["message","cb"];
390390
const preExecutionCode = "// Pass the incoming message to all registered message handlers.";
391391
const postExecutionCode = "// Passed the incoming message to all registered message handlers.";
392392
const customMethodConfig = {
@@ -445,7 +445,7 @@ Renders a language-specific formatted method definition.
445445
```js
446446
const language = "java";
447447
const methodName = "registerHandler";
448-
const methodParams = ["self", "handler"];
448+
const methodParams = ["Handler handler"];
449449
const methodDocs = "// Process the input data.";
450450
const methodLogic = "// TODO: implement";
451451
const preExecutionCode = "// Before handler registration";
@@ -485,8 +485,8 @@ Renders an array of model files based on the AsyncAPI document.
485485
| params.asyncapi | <code>AsyncAPIDocumentInterface</code> | Parsed AsyncAPI document object. |
486486
| params.language | <code>Language</code> | Target programming language for the generated models. |
487487
| params.format | <code>Format</code> | Naming format for generated files. |
488-
| params.presets | <code>object</code> | Custom presets for the generator instance. |
489-
| params.constraints | <code>object</code> | Custom constraints for the generator instance. |
488+
| params.presets | <code>Object</code> | Custom presets for the generator instance. |
489+
| params.constraints | <code>Object</code> | Custom constraints for the generator instance. |
490490

491491

492492

@@ -670,7 +670,7 @@ return (
670670

671671
<a name="QueryParamsVariables"></a>
672672
## **QueryParamsVariables()**
673-
Renders a query parameter variables code blocks.
673+
Renders query parameter variables code blocks.
674674

675675

676676
### Parameters
@@ -737,7 +737,7 @@ Renders a list of AsyncAPI operations with their headers and message examples.
737737
| Name | Type | Description |
738738
|------|------|-------------|
739739
| props | <code>Object</code> | Component Props |
740-
| props.operations | <code>Array.&lt;object&gt;</code> | Array of AsyncAPI Operation objects. |
740+
| props.operations | <code>Array.&lt;Object&gt;</code> | Array of AsyncAPI Operation objects. |
741741

742742

743743

@@ -752,6 +752,7 @@ Renders a list of AsyncAPI operations with their headers and message examples.
752752
```js
753753
import path from "path";
754754
import { Parser, fromFile } from "@asyncapi/parser";
755+
import { AvailableOperations } from "@asyncapi/generator-components";
755756

756757
async function renderAvailableOperations(){
757758
const parser = new Parser();
@@ -843,7 +844,7 @@ Renders Message Examples of a given AsyncAPI operation.
843844
| Name | Type | Description |
844845
|------|------|-------------|
845846
| props | <code>Object</code> | Component Props |
846-
| props.operation | <code>object</code> | An AsyncAPI Operation object. |
847+
| props.operation | <code>Object</code> | An AsyncAPI Operation object. |
847848

848849

849850

@@ -858,6 +859,7 @@ Renders Message Examples of a given AsyncAPI operation.
858859
```js
859860
import path from "path";
860861
import { Parser, fromFile } from "@asyncapi/parser";
862+
import { MessageExamples } from "@asyncapi/generator-components";
861863

862864
async function renderMessageExamples(){
863865
const parser = new Parser();
@@ -890,7 +892,7 @@ Renders a header section for a single AsyncAPI operation.
890892
| Name | Type | Description |
891893
|------|------|-------------|
892894
| props | <code>Object</code> | Component properties. |
893-
| props.operation | <code>object</code> | An AsyncAPI Operation object. |
895+
| props.operation | <code>Object</code> | An AsyncAPI Operation object. |
894896

895897

896898

@@ -905,6 +907,7 @@ Renders a header section for a single AsyncAPI operation.
905907
```js
906908
import path from "path";
907909
import { Parser, fromFile } from "@asyncapi/parser";
910+
import { OperationHeader } from "@asyncapi/generator-components";
908911

909912
async function renderOperationHeader(){
910913
const parser = new Parser();
@@ -938,7 +941,7 @@ Displays the API description, version, and server URL.
938941
| Name | Type | Description |
939942
|------|------|-------------|
940943
| props | <code>Object</code> | Component props |
941-
| props.info | <code>object</code> | Info object from the AsyncAPI document. |
944+
| props.info | <code>Object</code> | Info object from the AsyncAPI document. |
942945
| props.title | <code>string</code> | Title from the AsyncAPI document. |
943946
| props.serverUrl | <code>string</code> | ServerUrl from a specific server from the AsyncAPI document. |
944947

@@ -956,6 +959,7 @@ Displays the API description, version, and server URL.
956959
import path from "path";
957960
import { Parser, fromFile } from "@asyncapi/parser";
958961
import { getServer, getServerUrl } from '@asyncapi/generator-helpers';
962+
import { Overview } from "@asyncapi/generator-components";
959963

960964
async function renderOverview(){
961965
const parser = new Parser();
@@ -999,7 +1003,7 @@ provided AsyncAPI document, generator parameters, and target language.
9991003
|------|------|-------------|
10001004
| props | <code>Object</code> | Component props |
10011005
| props.asyncapi | <code>AsyncAPIDocumentInterface</code> | Parsed AsyncAPI document instance. |
1002-
| props.params | <code>object</code> | Generator parameters used to customize output |
1006+
| props.params | <code>Object</code> | Generator parameters used to customize output |
10031007
| props.language | <code>Language</code> | Target language used to render language-specific sections. |
10041008

10051009

@@ -1016,6 +1020,7 @@ provided AsyncAPI document, generator parameters, and target language.
10161020
import path from "path";
10171021
import { Parser, fromFile } from "@asyncapi/parser";
10181022
import { buildParams } from '@asyncapi/generator-helpers';
1023+
import { Readme } from "@asyncapi/generator-components";
10191024

10201025
async function renderReadme(){
10211026
const parser = new Parser();
@@ -1044,7 +1049,7 @@ renderReadme().catch(console.error);
10441049

10451050
<a name="Usage"></a>
10461051
## **Usage()**
1047-
Renders a usage example snippet for a generated client in a given language.
1052+
Renders a usage example snippet for a generated WebSocket client in a given language.
10481053

10491054

10501055
### Parameters

packages/components/src/components/CloseConnection.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ print('WebSocket connection closed.');`
7474
* const language = "java";
7575
* const framework = "quarkus";
7676
* const methodName = "terminateConnection";
77-
* const methodParams = ["self"];
77+
* const methodParams = ["String reason"];
7878
* const preExecutionCode = "// About to terminate connection";
7979
* const postExecutionCode = "// Connection terminated";
8080
* const indent = 2;

packages/components/src/components/FileHeaderInfo.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ const commentConfig = {
2323
* Renders a file header with metadata information such as title, version, protocol, host, and path.
2424
*
2525
* @param {Object} props - Component props.
26-
* @param {object} props.info - Info object from the AsyncAPI document.
27-
* @param {object} props.server - Server object from the AsyncAPI document.
26+
* @param {Object} props.info - Info object from the AsyncAPI document.
27+
* @param {Object} props.server - Server object from the AsyncAPI document.
2828
* @param {Language} props.language - Programming language used for comment formatting.
2929
* @returns {JSX.Element} A Text component that contains file header.
3030
*

packages/components/src/components/HandleMessage.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ else:
4242
* @example
4343
* const language = "javascript";
4444
* const methodName = "handleMessage";
45-
* const methodParams = ["self", "message"];
45+
* const methodParams = ["message","cb"];
4646
* const preExecutionCode = "// Pass the incoming message to all registered message handlers.";
4747
* const postExecutionCode = "// Passed the incoming message to all registered message handlers.";
4848
* const customMethodConfig = {

packages/components/src/components/MethodGenerator.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ const buildIndentedLogic = (logic, preExecutionCode, postExecutionCode, indentSi
7979
* @example
8080
* const language = "java";
8181
* const methodName = "registerHandler";
82-
* const methodParams = ["self", "handler"];
82+
* const methodParams = ["Handler handler"];
8383
* const methodDocs = "// Process the input data.";
8484
* const methodLogic = "// TODO: implement";
8585
* const preExecutionCode = "// Before handler registration";

packages/components/src/components/Models.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ const formatHelpers = {
5555
* @param {AsyncAPIDocumentInterface} params.asyncapi - Parsed AsyncAPI document object.
5656
* @param {Language} [params.language='python'] - Target programming language for the generated models.
5757
* @param {Format} [params.format='toPascalCase'] - Naming format for generated files.
58-
* @param {object} [params.presets={}] - Custom presets for the generator instance.
59-
* @param {object} [params.constraints={}] - Custom constraints for the generator instance.
58+
* @param {Object} [params.presets={}] - Custom presets for the generator instance.
59+
* @param {Object} [params.constraints={}] - Custom constraints for the generator instance.
6060
*
6161
* @returns {Array<File>} Array of File components with generated model content.
6262
*

packages/components/src/components/QueryParamsVariables.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ function resolveQueryParamLogic(language, framework = '') {
106106
}
107107

108108
/**
109-
* Renders a query parameter variables code blocks.
109+
* Renders query parameter variables code blocks.
110110
*
111111
* @param {Object} props - Component props.
112112
* @param {Language} props.language - The target programming language.

packages/components/src/components/readme/AvailableOperations.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@ import { MessageExamples } from './MessageExamples';
55
/**
66
* Renders a list of AsyncAPI operations with their headers and message examples.
77
* @param {Object} props - Component Props
8-
* @param {Array.<object>} props.operations - Array of AsyncAPI Operation objects.
8+
* @param {Array.<Object>} props.operations - Array of AsyncAPI Operation objects.
99
* @returns {JSX.Element | null} A Component containing rendered operations, or null if no operations are provided
1010
*
1111
* @example
1212
* import path from "path";
1313
* import { Parser, fromFile } from "@asyncapi/parser";
14+
* import { AvailableOperations } from "@asyncapi/generator-components";
1415
*
1516
* async function renderAvailableOperations(){
1617
* const parser = new Parser();

packages/components/src/components/readme/MessageExamples.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,13 @@ client.${opId}(${JSON.stringify(payload, null, 2)})
3939
* Renders Message Examples of a given AsyncAPI operation.
4040
*
4141
* @param {Object} props - Component Props
42-
* @param {object} props.operation - An AsyncAPI Operation object.
42+
* @param {Object} props.operation - An AsyncAPI Operation object.
4343
* @returns {JSX.Element|null} A Text component that contains message examples, or null when no examples exist.
4444
*
4545
* @example
4646
* import path from "path";
4747
* import { Parser, fromFile } from "@asyncapi/parser";
48+
* import { MessageExamples } from "@asyncapi/generator-components";
4849
*
4950
* async function renderMessageExamples(){
5051
* const parser = new Parser();

packages/components/src/components/readme/OperationHeader.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@ import { Text } from '@asyncapi/generator-react-sdk';
33
/**
44
* Renders a header section for a single AsyncAPI operation.
55
* @param {Object} props - Component properties.
6-
* @param {object} props.operation - An AsyncAPI Operation object.
6+
* @param {Object} props.operation - An AsyncAPI Operation object.
77
* @returns {JSX.Element} A Text component that contains formatted operation header.
88
*
99
* @example
1010
* import path from "path";
1111
* import { Parser, fromFile } from "@asyncapi/parser";
12+
* import { OperationHeader } from "@asyncapi/generator-components";
1213
*
1314
* async function renderOperationHeader(){
1415
* const parser = new Parser();

0 commit comments

Comments
 (0)