Skip to content

Commit 39597ed

Browse files
committed
add semicolons to example block
1 parent bd31cc1 commit 39597ed

File tree

17 files changed

+119
-114
lines changed

17 files changed

+119
-114
lines changed

packages/components/docs/API.md

Lines changed: 58 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -134,13 +134,13 @@ Renders a WebSocket close connection method with optional pre- and post-executio
134134
### Example
135135

136136
```js
137-
const language = "java"
138-
const framework = "quarkus"
139-
const methodName = "terminateConnection"
140-
const methodParams = ["self"]
141-
const preExecutionCode = "// About to terminate connection"
142-
const postExecutionCode = "// Connection terminated"
143-
const indent = 2
137+
const language = "java";
138+
const framework = "quarkus";
139+
const methodName = "terminateConnection";
140+
const methodParams = ["self"];
141+
const preExecutionCode = "// About to terminate connection";
142+
const postExecutionCode = "// Connection terminated";
143+
const indent = 2;
144144

145145
return (
146146
<CloseConnection
@@ -176,8 +176,8 @@ Component that renders WebSocket connection method for the specified programming
176176
### Example
177177

178178
```js
179-
const language = "python"
180-
const title = "HoppscotchEchoWebSocketClient"
179+
const language = "python";
180+
const title = "HoppscotchEchoWebSocketClient";
181181

182182
return(
183183
<Connect
@@ -215,10 +215,10 @@ Renders the top-of-file dependency statements for the selected programming langu
215215
### Example
216216

217217
```js
218-
const language = "java"
219-
const framework = "quarkus"
220-
const role = "client"
221-
const additionalDependencies = ["import java.util.concurrent.CompletableFuture;", "import java.time.Duration;"]
218+
const language = "java";
219+
const framework = "quarkus";
220+
const role = "client";
221+
const additionalDependencies = ["import java.util.concurrent.CompletableFuture;", "import java.time.Duration;"];
222222

223223
return (
224224
<DependencyProvider
@@ -259,11 +259,12 @@ Renders a file header with metadata information such as title, version, protocol
259259
```js
260260
import path from "path";
261261
import { Parser, fromFile } from "@asyncapi/parser";
262+
import { FileHeaderInfo } from "@asyncapi/generator-components";
262263

263264
async function renderFileHeader() {
264265
const parser = new Parser();
265266
const asyncapi_websocket_query = path.resolve(__dirname, "../../../helpers/test/__fixtures__/asyncapi-websocket-query.yml");
266-
const language = "javascript"
267+
const language = "javascript";
267268

268269
// Parse the AsyncAPI document
269270
const parseResult = await fromFile(parser, asyncapi_websocket_query).parse();
@@ -309,11 +310,11 @@ Renders a WebSocket message handler method with optional pre- and post-execution
309310
### Example
310311

311312
```js
312-
const language = "javascript"
313-
const methodName = "handleMessage"
314-
const methodParams = ["self", "message"]
315-
const preExecutionCode = "// Pass the incoming message to all registered message handlers."
316-
const postExecutionCode = "// Passed the incoming message to all registered message handlers."
313+
const language = "javascript";
314+
const methodName = "handleMessage";
315+
const methodParams = ["self", "message"];
316+
const preExecutionCode = "// Pass the incoming message to all registered message handlers.";
317+
const postExecutionCode = "// Passed the incoming message to all registered message handlers.";
317318
const customMethodConfig = {
318319
javascript: {
319320
methodDocs: "// Method to handle message with callback",
@@ -363,16 +364,16 @@ Generic Method rendering component.
363364
### Example
364365

365366
```js
366-
const language = "java"
367-
const methodName = "registerHandler"
368-
const methodParams = ["self", "handler"]
369-
const methodDocs = "// Process the input data."
370-
const methodLogic = "// TODO: implement"
371-
const preExecutionCode = "// Before handler registration"
372-
const postExecutionCode = "// After handler registration"
373-
const customMethodConfig={ openingTag: "{", closingTag: "}", indentSize: 6 }
374-
const methodConfig = {"java" : {methodDocs : methodDocs, methodLogic: methodLogic }}
375-
const framework = "quarkus"
367+
const language = "java";
368+
const methodName = "registerHandler";
369+
const methodParams = ["self", "handler"];
370+
const methodDocs = "// Process the input data.";
371+
const methodLogic = "// TODO: implement";
372+
const preExecutionCode = "// Before handler registration";
373+
const postExecutionCode = "// After handler registration";
374+
const customMethodConfig={ openingTag: "{", closingTag: "}", indentSize: 6 };
375+
const methodConfig = {"java" : {methodDocs : methodDocs, methodLogic: methodLogic }};
376+
const framework = "quarkus";
376377

377378
return (
378379
<MethodGenerator
@@ -421,7 +422,7 @@ Generates and returns an array of model files based on the AsyncAPI document.
421422
```js
422423
import path from "path";
423424
import { Parser, fromFile } from "@asyncapi/parser";
424-
425+
import { Models } from "@asyncapi/generator-components";
425426

426427
async function renderModel() {
427428
const parser = new Parser();
@@ -431,7 +432,7 @@ async function renderModel() {
431432
const parseResult = await fromFile(parser, asyncapi_v3_path).parse();
432433
const parsedAsyncAPIDocument = parseResult.document;
433434

434-
const language = "java"
435+
const language = "java";
435436

436437
return (
437438
<Models
@@ -469,9 +470,9 @@ Component that renders WebSocket onClose event handler for the specified program
469470
### Example
470471

471472
```js
472-
const language = "java"
473-
const framework = "quarkus"
474-
const title = "HoppscotchEchoWebSocketClient"
473+
const language = "java";
474+
const framework = "quarkus";
475+
const title = "HoppscotchEchoWebSocketClient";
475476

476477
return (
477478
<OnClose
@@ -502,7 +503,7 @@ Component that renders WebSocket onError event handler for the specified program
502503
### Example
503504

504505
```js
505-
const language = "javascript"
506+
const language = "javascript";
506507
return (
507508
<OnError language={language} />
508509
)
@@ -528,7 +529,7 @@ Component that renders WebSocket onMessage event handler for the specified progr
528529
### Example
529530

530531
```js
531-
const language = "javascript"
532+
const language = "javascript";
532533
return (
533534
<OnMessage language={language} />
534535
)
@@ -556,9 +557,9 @@ Component that renders WebSocket onOpen event handler for the specified programm
556557
### Example
557558

558559
```js
559-
const language = "java"
560-
const framework = "quarkus"
561-
const title = "HoppscotchEchoWebSocketClient"
560+
const language = "java";
561+
const framework = "quarkus";
562+
const title = "HoppscotchEchoWebSocketClient";
562563

563564
return (
564565
<OnOpen
@@ -596,9 +597,10 @@ Component for rendering query parameter variables code.
596597
### Example
597598

598599
```js
599-
import path from "path"
600+
import path from "path";
600601
import { Parser, fromFile } from "@asyncapi/parser";
601602
import { getQueryParams } from "@asyncapi/generator-helpers";
603+
import { QueryParamsVariables } from "@asyncapi/generator-components";
602604

603605

604606
async function renderQueryParamsVariable(){
@@ -613,8 +615,8 @@ async function renderQueryParamsVariable(){
613615
const queryParamsObject = getQueryParams(channels);
614616
const queryParamsArray = queryParamsObject ? Array.from(queryParamsObject.entries()) : [];
615617

616-
const language = "java"
617-
const framework = "quarkus"
618+
const language = "java";
619+
const framework = "quarkus";
618620

619621
return (
620622
<QueryParamsVariables
@@ -656,11 +658,11 @@ Renders a WebSocket error handler registration method with optional pre- and pos
656658
### Example
657659

658660
```js
659-
const language = "python"
660-
const methodName = "registerErrorHandler"
661-
const methodParams = ["self", "handler"]
662-
const preExecutionCode = "# Pre-register operations"
663-
const postExecutionCode = "# Post-register operations"
661+
const language = "python";
662+
const methodName = "registerErrorHandler";
663+
const methodParams = ["self", "handler"];
664+
const preExecutionCode = "# Pre-register operations";
665+
const postExecutionCode = "# Post-register operations";
664666
const customMethodConfig = { returnType: "int", openingTag: "{", closingTag: "}", indentSize: 2};
665667

666668
return (
@@ -704,11 +706,11 @@ Renders a WebSocket message handler registration method with optional pre- and p
704706
### Example
705707

706708
```js
707-
const language = "python"
708-
const methodName = "registerMessageHandler"
709-
const methodParams = ["self", "handler"]
710-
const preExecutionCode = "# Pre-register operations"
711-
const postExecutionCode = "# Post-register operations"
709+
const language = "python";
710+
const methodName = "registerMessageHandler";
711+
const methodParams = ["self", "handler"];
712+
const preExecutionCode = "# Pre-register operations";
713+
const postExecutionCode = "# Post-register operations";
712714

713715
return (
714716
<RegisterMessageHandler
@@ -746,6 +748,7 @@ Generates both static and instance methods for sending messages through WebSocke
746748
```js
747749
import path from "path";
748750
import { Parser, fromFile } from "@asyncapi/parser";
751+
import { SendOperations } from "@asyncapi/generator-components";
749752

750753
async function renderSendOperations(){
751754
const parser = new Parser();
@@ -755,9 +758,9 @@ async function renderSendOperations(){
755758
const parseResult = await fromFile(parser, asyncapi_v3_path).parse();
756759
const parsedAsyncAPIDocument = parseResult.document;
757760

758-
const language = "javascript"
759-
const clientName = "AccountServiceAPI"
760-
const sendOperations = parsedAsyncAPIDocument.operations().filterBySend()
761+
const language = "javascript";
762+
const clientName = "AccountServiceAPI";
763+
const sendOperations = parsedAsyncAPIDocument.operations().filterBySend();
761764

762765
return (
763766
<SendOperations

packages/components/jsdoc2md-handlebars/api.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<dt>
77
<a href="#{{name}}">{{name}}</a>
88
{{#if returns.length}}
9-
⇒ <code>{{returns.[0].type.names.[0]}}</code>
9+
⇒ <code>{{{escapeType returns.[0].type.names.[0]}}}</code>
1010
{{/if}}
1111
</dt>
1212
<dd>

packages/components/src/components/CloseConnection.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,13 @@ print('WebSocket connection closed.');`
7171
* @returns {JSX.Element} Rendered method block with appropriate formatting.
7272
*
7373
* @example
74-
* const language = "java"
75-
* const framework = "quarkus"
76-
* const methodName = "terminateConnection"
77-
* const methodParams = ["self"]
78-
* const preExecutionCode = "// About to terminate connection"
79-
* const postExecutionCode = "// Connection terminated"
80-
* const indent = 2
74+
* const language = "java";
75+
* const framework = "quarkus";
76+
* const methodName = "terminateConnection";
77+
* const methodParams = ["self"];
78+
* const preExecutionCode = "// About to terminate connection";
79+
* const postExecutionCode = "// Connection terminated";
80+
* const indent = 2;
8181
*
8282
* return (
8383
* <CloseConnection

packages/components/src/components/Connect.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ Future<void> connect() async {
9999
* @param {string} props.title - The title of the WebSocket server.
100100
*
101101
* @example
102-
* const language = "python"
103-
* const title = "HoppscotchEchoWebSocketClient"
102+
* const language = "python";
103+
* const title = "HoppscotchEchoWebSocketClient";
104104
*
105105
* return(
106106
* <Connect

packages/components/src/components/DependencyProvider.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,10 @@ function resolveDependencies(language, framework = '', role = '') {
105105
* @returns {JSX.Element} Rendered list of import/require statements.
106106
*
107107
* @example
108-
* const language = "java"
109-
* const framework = "quarkus"
110-
* const role = "client"
111-
* const additionalDependencies = ["import java.util.concurrent.CompletableFuture;", "import java.time.Duration;"]
108+
* const language = "java";
109+
* const framework = "quarkus";
110+
* const role = "client";
111+
* const additionalDependencies = ["import java.util.concurrent.CompletableFuture;", "import java.time.Duration;"];
112112
*
113113
* return (
114114
* <DependencyProvider

packages/components/src/components/FileHeaderInfo.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,12 @@ const commentConfig = {
3131
* @example
3232
* import path from "path";
3333
* import { Parser, fromFile } from "@asyncapi/parser";
34+
* import { FileHeaderInfo } from "@asyncapi/generator-components";
3435
*
3536
* async function renderFileHeader() {
3637
* const parser = new Parser();
3738
* const asyncapi_websocket_query = path.resolve(__dirname, "../../../helpers/test/__fixtures__/asyncapi-websocket-query.yml");
38-
* const language = "javascript"
39+
* const language = "javascript";
3940
*
4041
* // Parse the AsyncAPI document
4142
* const parseResult = await fromFile(parser, asyncapi_websocket_query).parse();

packages/components/src/components/HandleMessage.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ else:
4040
* @returns {JSX.Element} Rendered method block with appropriate formatting.
4141
*
4242
* @example
43-
* const language = "javascript"
44-
* const methodName = "handleMessage"
45-
* 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."
43+
* const language = "javascript";
44+
* const methodName = "handleMessage";
45+
* 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.";
4848
* const customMethodConfig = {
4949
* javascript: {
5050
* methodDocs: "// Method to handle message with callback",

packages/components/src/components/MethodGenerator.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,16 @@ const buildIndentedLogic = (logic, preExecutionCode, postExecutionCode, indentSi
7676
* @param {string} [props.framework] - Framework name for nested configurations (e.g., 'quarkus' for Java).
7777
*
7878
* @example
79-
* const language = "java"
80-
* const methodName = "registerHandler"
81-
* const methodParams = ["self", "handler"]
82-
* const methodDocs = "// Process the input data."
83-
* const methodLogic = "// TODO: implement"
84-
* const preExecutionCode = "// Before handler registration"
85-
* const postExecutionCode = "// After handler registration"
86-
* const customMethodConfig={ openingTag: "{", closingTag: "}", indentSize: 6 }
87-
* const methodConfig = {"java" : {methodDocs : methodDocs, methodLogic: methodLogic }}
88-
* const framework = "quarkus"
79+
* const language = "java";
80+
* const methodName = "registerHandler";
81+
* const methodParams = ["self", "handler"];
82+
* const methodDocs = "// Process the input data.";
83+
* const methodLogic = "// TODO: implement";
84+
* const preExecutionCode = "// Before handler registration";
85+
* const postExecutionCode = "// After handler registration";
86+
* const customMethodConfig={ openingTag: "{", closingTag: "}", indentSize: 6 };
87+
* const methodConfig = {"java" : {methodDocs : methodDocs, methodLogic: methodLogic }};
88+
* const framework = "quarkus";
8989
*
9090
* return (
9191
* <MethodGenerator

packages/components/src/components/Models.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,7 @@ const formatHelpers = {
6363
* @example
6464
* import path from "path";
6565
* import { Parser, fromFile } from "@asyncapi/parser";
66-
*
67-
66+
* import { Models } from "@asyncapi/generator-components";
6867
*
6968
* async function renderModel() {
7069
* const parser = new Parser();
@@ -74,7 +73,7 @@ const formatHelpers = {
7473
* const parseResult = await fromFile(parser, asyncapi_v3_path).parse();
7574
* const parsedAsyncAPIDocument = parseResult.document;
7675
*
77-
* const language = "java"
76+
* const language = "java";
7877
*
7978
* return (
8079
* <Models

packages/components/src/components/OnClose.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { Text } from '@asyncapi/generator-react-sdk';
88
/**
99
* Mapping of supported programming languages to their WebSocket onClose event handler implementations.
1010
*
11-
* @type {Object.<Language, Function>}
11+
* @type {Object.<Language, Function|Object.<string, Function>>}
1212
*/
1313
const websocketOnCloseMethod = {
1414
javascript: (title) => {
@@ -68,9 +68,9 @@ const resolveCloseConfig = (language, framework = '') => {
6868
* @returns {JSX.Element} A Text component containing the onClose handler code for the specified language.
6969
*
7070
* @example
71-
* const language = "java"
72-
* const framework = "quarkus"
73-
* const title = "HoppscotchEchoWebSocketClient"
71+
* const language = "java";
72+
* const framework = "quarkus";
73+
* const title = "HoppscotchEchoWebSocketClient";
7474
*
7575
* return (
7676
* <OnClose

0 commit comments

Comments
 (0)