@asyncapi/generator 1.14.3 → 1.15.1
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.
|
@@ -8,7 +8,7 @@ The `generator` property from `package.json` file must contain a JSON object tha
|
|
|
8
8
|
|Name|Type|Description|
|
|
9
9
|
|---|---|---|
|
|
10
10
|
|`renderer`| String | Its value can be either `react` or `nunjucks` (default).
|
|
11
|
-
|`apiVersion`| String | Determines which **major** version of the [Parser-API](https://github.com/asyncapi/parser-api) the template uses. For example, `v2` for `v2.x.x`. If not specified, the Generator assumes the template is not compatible with the Parser-API so it will use the [Parser-JS v1 API](https://github.com/asyncapi/parser-js/tree/v1.18.1#api-documentation). For templates that need to support AsyncAPI specification v3 make sure to use `
|
|
11
|
+
|`apiVersion`| String | Determines which **major** version of the [Parser-API](https://github.com/asyncapi/parser-api) the template uses. For example, `v2` for `v2.x.x`. If not specified, the Generator assumes the template is not compatible with the Parser-API so it will use the [Parser-JS v1 API](https://github.com/asyncapi/parser-js/tree/v1.18.1#api-documentation). For templates that need to support AsyncAPI specification v3 make sure to use `v3` [Parser-API](https://github.com/asyncapi/parser-api). If the template uses a version of the Parser-API that is not supported by the Generator, the Generator will throw an error.
|
|
12
12
|
|`supportedProtocols`| [String] | A list with all the protocols this template supports.
|
|
13
13
|
|`parameters`| Object[String, Object] | An object with all the parameters that can be passed when generating the template. When using the command line, it's done by indicating `--param name=value` or `-p name=value`.
|
|
14
14
|
|`parameters[param].description`| String | A user-friendly description about the parameter.
|
|
@@ -28,7 +28,7 @@ The `generator` property from `package.json` file must contain a JSON object tha
|
|
|
28
28
|
"generator":
|
|
29
29
|
{
|
|
30
30
|
"renderer": "react",
|
|
31
|
-
"apiVersion": "
|
|
31
|
+
"apiVersion": "v3",
|
|
32
32
|
"supportedProtocols": ["amqp", "mqtt"],
|
|
33
33
|
"parameters": {
|
|
34
34
|
"server": {
|
package/lib/generator.js
CHANGED
|
@@ -168,7 +168,7 @@ class Generator {
|
|
|
168
168
|
*/
|
|
169
169
|
async generate(asyncapiDocument, parseOptions = {}) {
|
|
170
170
|
this.validateAsyncAPIDocument(asyncapiDocument);
|
|
171
|
-
this.setupOutput();
|
|
171
|
+
await this.setupOutput();
|
|
172
172
|
this.setLogLevel();
|
|
173
173
|
|
|
174
174
|
await this.installAndSetupTemplate();
|
|
@@ -200,13 +200,15 @@ class Generator {
|
|
|
200
200
|
*
|
|
201
201
|
* @example
|
|
202
202
|
* const generator = new Generator();
|
|
203
|
-
* generator.setupOutput();
|
|
204
|
-
*
|
|
203
|
+
* await generator.setupOutput();
|
|
204
|
+
*
|
|
205
|
+
* @async
|
|
206
|
+
*
|
|
205
207
|
* @throws {Error} If 'output' is set to 'string' without providing 'entrypoint'.
|
|
206
208
|
*/
|
|
207
|
-
setupOutput() {
|
|
209
|
+
async setupOutput() {
|
|
208
210
|
if (this.output === 'fs') {
|
|
209
|
-
this.setupFSOutput();
|
|
211
|
+
await this.setupFSOutput();
|
|
210
212
|
} else if (this.output === 'string' && this.entrypoint === undefined) {
|
|
211
213
|
throw new Error('Parameter entrypoint is required when using output = "string"');
|
|
212
214
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@asyncapi/generator",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.15.1",
|
|
4
4
|
"description": "The AsyncAPI generator. It can generate documentation, code, anything!",
|
|
5
5
|
"main": "./lib/generator.js",
|
|
6
6
|
"bin": {
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"@asyncapi/generator-react-sdk": "^1.0.2",
|
|
52
52
|
"@asyncapi/parser": "^2.1.2",
|
|
53
53
|
"@npmcli/arborist": "^2.2.4",
|
|
54
|
-
"@smoya/multi-parser": "^
|
|
54
|
+
"@smoya/multi-parser": "^5.0.0",
|
|
55
55
|
"ajv": "^8.12.0",
|
|
56
56
|
"chokidar": "^3.4.0",
|
|
57
57
|
"commander": "^6.1.0",
|
|
@@ -62,7 +62,6 @@
|
|
|
62
62
|
"js-yaml": "^3.13.1",
|
|
63
63
|
"levenshtein-edit-distance": "^2.0.5",
|
|
64
64
|
"loglevel": "^1.6.8",
|
|
65
|
-
"markdown-it": "^12.3.2",
|
|
66
65
|
"minimatch": "^3.0.4",
|
|
67
66
|
"node-fetch": "^2.6.0",
|
|
68
67
|
"nunjucks": "^3.2.0",
|