@asyncapi/cli 0.37.2 → 0.38.0
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.
|
@@ -24,6 +24,7 @@ export default class Models extends Command {
|
|
|
24
24
|
tsModelType: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
25
25
|
tsEnumType: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
26
26
|
tsModuleSystem: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
27
|
+
tsIncludeComments: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
27
28
|
tsExportType: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
28
29
|
tsJsonBinPack: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
29
30
|
/**
|
|
@@ -24,7 +24,7 @@ class Models extends base_1.default {
|
|
|
24
24
|
run() {
|
|
25
25
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
26
26
|
const { args, flags } = yield this.parse(Models);
|
|
27
|
-
const { tsModelType, tsEnumType, tsModuleSystem, tsExportType, tsJsonBinPack, namespace, csharpAutoImplement, csharpArrayType, packageName, output } = flags;
|
|
27
|
+
const { tsModelType, tsEnumType, tsIncludeComments, tsModuleSystem, tsExportType, tsJsonBinPack, namespace, csharpAutoImplement, csharpArrayType, packageName, output } = flags;
|
|
28
28
|
const { language, file } = args;
|
|
29
29
|
const inputFile = (yield (0, SpecificationFile_1.load)(file)) || (yield (0, SpecificationFile_1.load)());
|
|
30
30
|
const { document, status } = yield (0, parser_1.parse)(this, inputFile, flags);
|
|
@@ -47,20 +47,24 @@ class Models extends base_1.default {
|
|
|
47
47
|
});
|
|
48
48
|
let fileGenerator;
|
|
49
49
|
let fileOptions = {};
|
|
50
|
+
const presets = [];
|
|
50
51
|
switch (language) {
|
|
51
52
|
case Languages.typescript:
|
|
53
|
+
if (tsIncludeComments) {
|
|
54
|
+
presets.push(modelina_1.TS_DESCRIPTION_PRESET);
|
|
55
|
+
}
|
|
56
|
+
if (tsJsonBinPack) {
|
|
57
|
+
presets.push({
|
|
58
|
+
preset: modelina_1.TS_COMMON_PRESET,
|
|
59
|
+
options: {
|
|
60
|
+
marshalling: true
|
|
61
|
+
}
|
|
62
|
+
}, modelina_1.TS_JSONBINPACK_PRESET);
|
|
63
|
+
}
|
|
52
64
|
fileGenerator = new modelina_1.TypeScriptFileGenerator({
|
|
53
65
|
modelType: tsModelType,
|
|
54
66
|
enumType: tsEnumType,
|
|
55
|
-
presets
|
|
56
|
-
{
|
|
57
|
-
preset: modelina_1.TS_COMMON_PRESET,
|
|
58
|
-
options: {
|
|
59
|
-
marshalling: true
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
modelina_1.TS_JSONBINPACK_PRESET
|
|
63
|
-
] : []
|
|
67
|
+
presets
|
|
64
68
|
});
|
|
65
69
|
fileOptions = {
|
|
66
70
|
moduleSystem: tsModuleSystem,
|
|
@@ -188,6 +192,10 @@ Models.flags = Object.assign({ help: core_1.Flags.help({ char: 'h' }), output: c
|
|
|
188
192
|
description: 'TypeScript specific, define the module system to be used.',
|
|
189
193
|
required: false,
|
|
190
194
|
default: 'ESM',
|
|
195
|
+
}), tsIncludeComments: core_1.Flags.boolean({
|
|
196
|
+
description: 'TypeScript specific, if enabled add comments while generating models.',
|
|
197
|
+
required: false,
|
|
198
|
+
default: false,
|
|
191
199
|
}), tsExportType: core_1.Flags.string({
|
|
192
200
|
type: 'option',
|
|
193
201
|
options: ['default', 'named'],
|
package/oclif.manifest.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.
|
|
2
|
+
"version": "0.38.0",
|
|
3
3
|
"commands": {
|
|
4
4
|
"bundle": {
|
|
5
5
|
"id": "bundle",
|
|
@@ -559,6 +559,13 @@
|
|
|
559
559
|
],
|
|
560
560
|
"default": "ESM"
|
|
561
561
|
},
|
|
562
|
+
"tsIncludeComments": {
|
|
563
|
+
"name": "tsIncludeComments",
|
|
564
|
+
"type": "boolean",
|
|
565
|
+
"description": "TypeScript specific, if enabled add comments while generating models.",
|
|
566
|
+
"required": false,
|
|
567
|
+
"allowNo": false
|
|
568
|
+
},
|
|
562
569
|
"tsExportType": {
|
|
563
570
|
"name": "tsExportType",
|
|
564
571
|
"type": "option",
|