@asyncapi/generator 1.9.16 → 1.9.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/react-render-engine.md +7 -7
- package/docs/template.md +1 -1
- package/package.json +3 -3
|
@@ -15,7 +15,7 @@ weight: 110
|
|
|
15
15
|
When writing React templates you decide whether to use CommonJS, ES5, or ES6 modules since everything is bundled together before the rendering process takes over. We use our own React renderer which can be found in the [Generator React SDK](https://github.com/asyncapi/generator-react-sdk).
|
|
16
16
|
There you can find information about how the renderer works or how we transpile your template files.
|
|
17
17
|
|
|
18
|
-
Your React template always
|
|
18
|
+
Your React template always requires `@asyncapi/generator-react-sdk` as a dependency. `@asyncapi/generator-react-sdk` is required to access the `File` component which is required as a root component for a file to be rendered. Furthermore, it provides some common components to make your development easier, like `Text` or `Indent`.
|
|
19
19
|
|
|
20
20
|
Let's consider a basic React template as the one below called `MyTemplate.js`:
|
|
21
21
|
|
|
@@ -33,7 +33,7 @@ export default function({ asyncapi, params, originalAsyncAPI }) {
|
|
|
33
33
|
|
|
34
34
|
The exported default function returns a `File` component as a root component which the generator uses to determine what file should be generated. In our case, we overwrite the default functionality of saving the file as `MyTemplate.js` but instead use the filename `asyncapi.md`. It is then specified that we should render `Some text that should render as is\n` within that file. Notice the `\n` character at the end, which is automatically added after the `Text` component.
|
|
35
35
|
|
|
36
|
-
For further information about components, props etc
|
|
36
|
+
For further information about components, props, etc, see the [Generator React SDK](https://github.com/asyncapi/generator-react-sdk)
|
|
37
37
|
|
|
38
38
|
### Common assumptions
|
|
39
39
|
|
|
@@ -41,15 +41,15 @@ For further information about components, props etc. see the [Generator React SD
|
|
|
41
41
|
- `File` is the root component
|
|
42
42
|
- The file is not in the list of `nonRenderableFiles` in the template configuration
|
|
43
43
|
1. New lines are automatically added after each `Text` component.
|
|
44
|
-
1. The props you have access to in rendering function
|
|
45
|
-
- `asyncapi`
|
|
46
|
-
- `originalAsyncAPI`
|
|
44
|
+
1. The props you have access to in the rendering function are:
|
|
45
|
+
- `asyncapi` which is a parsed spec file object. Read the [API](https://github.com/asyncapi/parser-js/blob/master/API.md#AsyncAPIDocument) of the Parser to understand what structure you have access to in this parameter.
|
|
46
|
+
- `originalAsyncAPI` which is an original spec file before it is parsed.
|
|
47
47
|
- `params` that contain the parameters provided when generating.
|
|
48
48
|
1. All the file templates are supported where the variables are provided after the default props as listed above.
|
|
49
49
|
|
|
50
50
|
### Debugging React template in VSCode
|
|
51
51
|
|
|
52
|
-
With React, it enables you to debug your templates. For Visual Studio Code, we have created a boilerplate [launch configuration](https://code.visualstudio.com/docs/editor/debugging#_launch-configurations) to enable
|
|
52
|
+
With React, it enables you to debug your templates. For Visual Studio Code, we have created a boilerplate [launch configuration](https://code.visualstudio.com/docs/editor/debugging#_launch-configurations) to enable debugging in your template. Add the following launch configuration:
|
|
53
53
|
|
|
54
54
|
```json
|
|
55
55
|
{
|
|
@@ -75,6 +75,6 @@ With React, it enables you to debug your templates. For Visual Studio Code, we h
|
|
|
75
75
|
}
|
|
76
76
|
```
|
|
77
77
|
|
|
78
|
-
Now replace `./asyncapi.yml` with your document of choice. Replace `./template` with the path to your React template. You can now debug your template by adding any breakpoints you want and
|
|
78
|
+
Now replace `./asyncapi.yml` with your document of choice. Replace `./template` with the path to your React template. You can now debug your template by adding any breakpoints you want and inspecting your code.
|
|
79
79
|
|
|
80
80
|
|
package/docs/template.md
CHANGED
|
@@ -53,7 +53,7 @@ AsyncAPI has a list of available templates to enhance your generation process. T
|
|
|
53
53
|
|
|
54
54
|
Template Name | Description | Source code
|
|
55
55
|
---|---|---
|
|
56
|
-
`@asyncapi/nodejs-template` | Generates Node.js service that uses Hermes package | [
|
|
56
|
+
`@asyncapi/nodejs-template` | Generates Node.js service that uses Hermes package | [Node.js template](https://github.com/asyncapi/nodejs-template)
|
|
57
57
|
`@asyncapi/nodejs-ws-template` | Generates Node.js service that supports WebSocket protocol only | [Node.js WebSocket template](https://github.com/asyncapi/nodejs-ws-template)
|
|
58
58
|
`@asyncapi/java-template` | Generates Java JMS application | [Java template](https://github.com/asyncapi/java-template)
|
|
59
59
|
`@asyncapi/java-spring-template` | Generates Java Spring service | [Java spring template](https://github.com/asyncapi/java-spring-template)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@asyncapi/generator",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.18",
|
|
4
4
|
"description": "The AsyncAPI generator. It can generate documentation, code, anything!",
|
|
5
5
|
"main": "./lib/generator.js",
|
|
6
6
|
"bin": {
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"@asyncapi/avro-schema-parser": "^1.1.0",
|
|
51
51
|
"@asyncapi/generator-react-sdk": "^0.2.23",
|
|
52
|
-
"@asyncapi/openapi-schema-parser": "^2.0.
|
|
53
|
-
"@asyncapi/parser": "^1.
|
|
52
|
+
"@asyncapi/openapi-schema-parser": "^2.0.3",
|
|
53
|
+
"@asyncapi/parser": "^1.18.0",
|
|
54
54
|
"@asyncapi/raml-dt-schema-parser": "^2.0.1",
|
|
55
55
|
"@npmcli/arborist": "^2.2.4",
|
|
56
56
|
"ajv": "^6.10.2",
|