@asyncapi/cli 1.18.0 → 2.0.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.
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
import Command from '../../core/base';
|
|
2
2
|
export default class Models extends Command {
|
|
3
3
|
static description: string;
|
|
4
|
-
static args:
|
|
5
|
-
language: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
6
|
-
file: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
7
|
-
};
|
|
4
|
+
static readonly args: any;
|
|
8
5
|
static flags: {
|
|
9
6
|
'log-diagnostics': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
10
7
|
'diagnostics-format': import("@oclif/core/lib/interfaces").OptionFlag<import("@stoplight/spectral-cli/dist/services/config").OutputFormat, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
11
8
|
'fail-severity': import("@oclif/core/lib/interfaces").OptionFlag<"error" | "warn" | "info" | "hint", import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
12
|
-
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
13
9
|
'no-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
14
|
-
|
|
10
|
+
javaIncludeComments: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
javaJackson: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
12
|
+
javaConstraints: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
13
|
+
csharpAutoImplement: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
14
|
+
csharpNewtonsoft: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
15
|
+
csharpArrayType: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
16
|
+
csharpHashcode: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
17
|
+
csharpEqual: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
18
|
+
csharpSystemJson: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
15
19
|
tsModelType: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
16
20
|
tsEnumType: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
17
21
|
tsModuleSystem: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
@@ -21,17 +25,10 @@ export default class Models extends Command {
|
|
|
21
25
|
tsMarshalling: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
22
26
|
tsExampleInstance: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
23
27
|
tsRawPropertyNames: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
28
|
+
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
29
|
+
output: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
24
30
|
packageName: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
25
|
-
javaIncludeComments: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
26
|
-
javaJackson: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
27
|
-
javaConstraints: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
28
31
|
namespace: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
29
|
-
csharpAutoImplement: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
30
|
-
csharpNewtonsoft: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
31
|
-
csharpArrayType: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
32
|
-
csharpHashcode: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
33
|
-
csharpEqual: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
34
|
-
csharpSystemJson: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
35
32
|
};
|
|
36
33
|
run(): Promise<void>;
|
|
37
34
|
private parseArgs;
|
|
@@ -1,38 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
const modelina_1 = require("@asyncapi/modelina");
|
|
5
|
-
const core_1 = require("@oclif/core");
|
|
6
|
-
const multi_parser_1 = require("@smoya/multi-parser");
|
|
7
4
|
const base_1 = tslib_1.__importDefault(require("../../core/base"));
|
|
8
5
|
const SpecificationFile_1 = require("../../core/models/SpecificationFile");
|
|
9
6
|
const parser_1 = require("../../core/parser");
|
|
10
7
|
const prompts_1 = require("@clack/prompts");
|
|
11
8
|
const picocolors_1 = require("picocolors");
|
|
9
|
+
const modelina_cli_1 = require("@asyncapi/modelina-cli");
|
|
12
10
|
const models_flags_1 = require("../../core/flags/generate/models.flags");
|
|
13
|
-
var Languages;
|
|
14
|
-
(function (Languages) {
|
|
15
|
-
Languages["typescript"] = "typescript";
|
|
16
|
-
Languages["csharp"] = "csharp";
|
|
17
|
-
Languages["golang"] = "golang";
|
|
18
|
-
Languages["java"] = "java";
|
|
19
|
-
Languages["javascript"] = "javascript";
|
|
20
|
-
Languages["dart"] = "dart";
|
|
21
|
-
Languages["python"] = "python";
|
|
22
|
-
Languages["rust"] = "rust";
|
|
23
|
-
Languages["kotlin"] = "kotlin";
|
|
24
|
-
Languages["php"] = "php";
|
|
25
|
-
Languages["cplusplus"] = "cplusplus";
|
|
26
|
-
})(Languages || (Languages = {}));
|
|
27
|
-
const possibleLanguageValues = Object.values(Languages).join(', ');
|
|
28
11
|
class Models extends base_1.default {
|
|
29
|
-
/* eslint-disable sonarjs/cognitive-complexity */
|
|
30
12
|
run() {
|
|
31
13
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
32
14
|
const { args, flags } = yield this.parse(Models);
|
|
33
|
-
const { tsModelType, tsEnumType, tsIncludeComments, tsModuleSystem, tsExportType, tsJsonBinPack, tsMarshalling, tsExampleInstance, tsRawPropertyNames, namespace, csharpAutoImplement, csharpArrayType, csharpNewtonsoft, csharpHashcode, csharpEqual, csharpSystemJson, packageName, javaIncludeComments, javaJackson, javaConstraints } = flags;
|
|
34
15
|
let { language, file } = args;
|
|
35
|
-
let output = flags
|
|
16
|
+
let { output } = flags;
|
|
36
17
|
const interactive = !flags['no-interactive'];
|
|
37
18
|
if (!interactive) {
|
|
38
19
|
(0, prompts_1.intro)((0, picocolors_1.inverse)('AsyncAPI Generate Models'));
|
|
@@ -51,11 +32,7 @@ class Models extends base_1.default {
|
|
|
51
32
|
this.log(`Input is not a correct AsyncAPI document so it cannot be processed.${(0, parser_1.formatOutput)(severityErrors, 'stylish', 'error')}`);
|
|
52
33
|
return;
|
|
53
34
|
}
|
|
54
|
-
|
|
55
|
-
// This call converts the parsed document object using @asyncapi/parser@v3.x (Parser-API v2) to a document compatible with the Parser-API version in use in @asyncapi/parser@v2.x (v1)
|
|
56
|
-
// This is needed until https://github.com/asyncapi/modelina/issues/1493 gets fixed.
|
|
57
|
-
const convertedDoc = (0, multi_parser_1.ConvertDocumentParserAPIVersion)(document.json(), 1);
|
|
58
|
-
modelina_1.Logger.setLogger({
|
|
35
|
+
const logger = {
|
|
59
36
|
info: (message) => {
|
|
60
37
|
this.log(message);
|
|
61
38
|
},
|
|
@@ -68,169 +45,22 @@ class Models extends base_1.default {
|
|
|
68
45
|
error: (message) => {
|
|
69
46
|
this.error(message);
|
|
70
47
|
},
|
|
71
|
-
});
|
|
72
|
-
let fileGenerator;
|
|
73
|
-
let fileOptions = {};
|
|
74
|
-
const presets = [];
|
|
75
|
-
const options = {
|
|
76
|
-
marshalling: tsMarshalling,
|
|
77
|
-
example: tsExampleInstance,
|
|
78
48
|
};
|
|
79
|
-
switch (language) {
|
|
80
|
-
case Languages.typescript:
|
|
81
|
-
presets.push({
|
|
82
|
-
preset: modelina_1.TS_COMMON_PRESET,
|
|
83
|
-
options
|
|
84
|
-
});
|
|
85
|
-
if (tsIncludeComments) {
|
|
86
|
-
presets.push(modelina_1.TS_DESCRIPTION_PRESET);
|
|
87
|
-
}
|
|
88
|
-
if (tsJsonBinPack) {
|
|
89
|
-
presets.push({
|
|
90
|
-
preset: modelina_1.TS_COMMON_PRESET,
|
|
91
|
-
options
|
|
92
|
-
}, modelina_1.TS_JSONBINPACK_PRESET);
|
|
93
|
-
}
|
|
94
|
-
fileGenerator = new modelina_1.TypeScriptFileGenerator({
|
|
95
|
-
modelType: tsModelType,
|
|
96
|
-
enumType: tsEnumType,
|
|
97
|
-
rawPropertyNames: tsRawPropertyNames,
|
|
98
|
-
presets
|
|
99
|
-
});
|
|
100
|
-
fileOptions = {
|
|
101
|
-
moduleSystem: tsModuleSystem,
|
|
102
|
-
exportType: tsExportType
|
|
103
|
-
};
|
|
104
|
-
break;
|
|
105
|
-
case Languages.python:
|
|
106
|
-
fileGenerator = new modelina_1.PythonFileGenerator();
|
|
107
|
-
break;
|
|
108
|
-
case Languages.rust:
|
|
109
|
-
fileGenerator = new modelina_1.RustFileGenerator();
|
|
110
|
-
break;
|
|
111
|
-
case Languages.csharp:
|
|
112
|
-
if (namespace === undefined) {
|
|
113
|
-
throw new Error('In order to generate models to C#, we need to know which namespace they are under. Add `--namespace=NAMESPACE` to set the desired namespace.');
|
|
114
|
-
}
|
|
115
|
-
if (csharpAutoImplement) {
|
|
116
|
-
presets.push({
|
|
117
|
-
preset: modelina_1.CSHARP_DEFAULT_PRESET,
|
|
118
|
-
options: {
|
|
119
|
-
autoImplementedProperties: true
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
if (csharpNewtonsoft) {
|
|
124
|
-
presets.push(modelina_1.CSHARP_NEWTONSOFT_SERIALIZER_PRESET);
|
|
125
|
-
}
|
|
126
|
-
if (csharpSystemJson) {
|
|
127
|
-
presets.push(modelina_1.CSHARP_JSON_SERIALIZER_PRESET);
|
|
128
|
-
}
|
|
129
|
-
if (csharpHashcode || csharpEqual) {
|
|
130
|
-
presets.push({
|
|
131
|
-
preset: modelina_1.CSHARP_COMMON_PRESET,
|
|
132
|
-
options: {
|
|
133
|
-
hashCode: csharpHashcode,
|
|
134
|
-
equals: csharpEqual
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
fileGenerator = new modelina_1.CSharpFileGenerator({
|
|
139
|
-
presets,
|
|
140
|
-
collectionType: csharpArrayType
|
|
141
|
-
});
|
|
142
|
-
fileOptions = {
|
|
143
|
-
namespace
|
|
144
|
-
};
|
|
145
|
-
break;
|
|
146
|
-
case Languages.cplusplus:
|
|
147
|
-
if (namespace === undefined) {
|
|
148
|
-
throw new Error('In order to generate models to C++, we need to know which namespace they are under. Add `--namespace=NAMESPACE` to set the desired namespace.');
|
|
149
|
-
}
|
|
150
|
-
fileGenerator = new modelina_1.CplusplusFileGenerator({
|
|
151
|
-
namespace
|
|
152
|
-
});
|
|
153
|
-
break;
|
|
154
|
-
case Languages.golang:
|
|
155
|
-
if (packageName === undefined) {
|
|
156
|
-
throw new Error('In order to generate models to Go, we need to know which package they are under. Add `--packageName=PACKAGENAME` to set the desired package name.');
|
|
157
|
-
}
|
|
158
|
-
fileGenerator = new modelina_1.GoFileGenerator();
|
|
159
|
-
fileOptions = {
|
|
160
|
-
packageName
|
|
161
|
-
};
|
|
162
|
-
break;
|
|
163
|
-
case Languages.java:
|
|
164
|
-
if (packageName === undefined) {
|
|
165
|
-
throw new Error('In order to generate models to Java, we need to know which package they are under. Add `--packageName=PACKAGENAME` to set the desired package name.');
|
|
166
|
-
}
|
|
167
|
-
presets.push({
|
|
168
|
-
preset: modelina_1.JAVA_COMMON_PRESET,
|
|
169
|
-
options
|
|
170
|
-
});
|
|
171
|
-
if (javaIncludeComments) {
|
|
172
|
-
presets.push(modelina_1.JAVA_DESCRIPTION_PRESET);
|
|
173
|
-
}
|
|
174
|
-
if (javaJackson) {
|
|
175
|
-
presets.push(modelina_1.JAVA_JACKSON_PRESET);
|
|
176
|
-
}
|
|
177
|
-
if (javaConstraints) {
|
|
178
|
-
presets.push(modelina_1.JAVA_CONSTRAINTS_PRESET);
|
|
179
|
-
}
|
|
180
|
-
fileGenerator = new modelina_1.JavaFileGenerator({ presets });
|
|
181
|
-
fileOptions = {
|
|
182
|
-
packageName
|
|
183
|
-
};
|
|
184
|
-
break;
|
|
185
|
-
case Languages.javascript:
|
|
186
|
-
fileGenerator = new modelina_1.JavaScriptFileGenerator();
|
|
187
|
-
break;
|
|
188
|
-
case Languages.dart:
|
|
189
|
-
if (packageName === undefined) {
|
|
190
|
-
throw new Error('In order to generate models to Dart, we need to know which package they are under. Add `--packageName=PACKAGENAME` to set the desired package name.');
|
|
191
|
-
}
|
|
192
|
-
fileGenerator = new modelina_1.DartFileGenerator();
|
|
193
|
-
fileOptions = {
|
|
194
|
-
packageName
|
|
195
|
-
};
|
|
196
|
-
break;
|
|
197
|
-
case Languages.kotlin:
|
|
198
|
-
if (packageName === undefined) {
|
|
199
|
-
throw new Error('In order to generate models to Kotlin, we need to know which package they are under. Add `--packageName=PACKAGENAME` to set the desired package name.');
|
|
200
|
-
}
|
|
201
|
-
fileGenerator = new modelina_1.KotlinFileGenerator();
|
|
202
|
-
fileOptions = {
|
|
203
|
-
packageName
|
|
204
|
-
};
|
|
205
|
-
break;
|
|
206
|
-
case Languages.php:
|
|
207
|
-
if (namespace === undefined) {
|
|
208
|
-
throw new Error('In order to generate models to PHP, we need to know which namespace they are under. Add `--namespace=NAMESPACE` to set the desired namespace.');
|
|
209
|
-
}
|
|
210
|
-
fileGenerator = new modelina_1.PhpFileGenerator();
|
|
211
|
-
fileOptions = {
|
|
212
|
-
namespace
|
|
213
|
-
};
|
|
214
|
-
break;
|
|
215
|
-
default:
|
|
216
|
-
throw new Error(`Could not determine generator for language ${language}, are you using one of the following values ${possibleLanguageValues}?`);
|
|
217
|
-
}
|
|
218
49
|
const s = (0, prompts_1.spinner)();
|
|
219
50
|
s.start('Generating models...');
|
|
51
|
+
const generatedModels = yield (0, modelina_cli_1.generateModels)(Object.assign(Object.assign({}, flags), { output }), document, logger, language);
|
|
220
52
|
if (output !== 'stdout') {
|
|
221
|
-
const
|
|
222
|
-
|
|
223
|
-
s.stop((0, picocolors_1.green)(`Successfully generated the following models: ${generatedModels.join(', ')}`));
|
|
53
|
+
const generatedModelStrings = generatedModels.map((model) => { return model.modelName; });
|
|
54
|
+
s.stop((0, picocolors_1.green)(`Successfully generated the following models: ${generatedModelStrings.join(', ')}`));
|
|
224
55
|
return;
|
|
225
56
|
}
|
|
226
|
-
const
|
|
227
|
-
const generatedModels = models.map((model) => {
|
|
57
|
+
const generatedModelStrings = generatedModels.map((model) => {
|
|
228
58
|
return `
|
|
229
|
-
|
|
230
|
-
|
|
59
|
+
## Model name: ${model.modelName}
|
|
60
|
+
${model.result}
|
|
231
61
|
`;
|
|
232
62
|
});
|
|
233
|
-
s.stop((0, picocolors_1.green)(`Successfully generated the following models: ${
|
|
63
|
+
s.stop((0, picocolors_1.green)(`Successfully generated the following models: ${generatedModelStrings.join('\n')}`));
|
|
234
64
|
});
|
|
235
65
|
}
|
|
236
66
|
parseArgs(args, output) {
|
|
@@ -241,7 +71,7 @@ class Models extends base_1.default {
|
|
|
241
71
|
if (!language) {
|
|
242
72
|
language = yield (0, prompts_1.select)({
|
|
243
73
|
message: 'Select the language you want to generate models for',
|
|
244
|
-
options: Object.keys(Languages).map((key) => ({ value: key, label: key, hint: Languages[key] })),
|
|
74
|
+
options: Object.keys(modelina_cli_1.Languages).map((key) => ({ value: key, label: key, hint: modelina_cli_1.Languages[key] })),
|
|
245
75
|
});
|
|
246
76
|
askForOutput = true;
|
|
247
77
|
}
|
|
@@ -272,14 +102,11 @@ class Models extends base_1.default {
|
|
|
272
102
|
(0, prompts_1.cancel)(operationCancelled);
|
|
273
103
|
this.exit();
|
|
274
104
|
}
|
|
275
|
-
return { language, file, output: output
|
|
105
|
+
return { language, file, output: output !== null && output !== void 0 ? output : 'stdout' };
|
|
276
106
|
});
|
|
277
107
|
}
|
|
278
108
|
}
|
|
279
109
|
exports.default = Models;
|
|
280
110
|
Models.description = 'Generates typed models';
|
|
281
|
-
Models.args =
|
|
282
|
-
language: core_1.Args.string({ description: 'The language you want the typed models generated for.', options: Object.keys(Languages), required: true }),
|
|
283
|
-
file: core_1.Args.string({ description: 'Path or URL to the AsyncAPI document, or context-name', required: true }),
|
|
284
|
-
};
|
|
111
|
+
Models.args = modelina_cli_1.ModelinaArgs;
|
|
285
112
|
Models.flags = (0, models_flags_1.modelsFlags)();
|
|
@@ -2,12 +2,16 @@ export declare const modelsFlags: () => {
|
|
|
2
2
|
'log-diagnostics': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
3
3
|
'diagnostics-format': import("@oclif/core/lib/interfaces").OptionFlag<import("@stoplight/spectral-cli/dist/services/config").OutputFormat, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
4
4
|
'fail-severity': import("@oclif/core/lib/interfaces").OptionFlag<"error" | "warn" | "info" | "hint", import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
5
|
-
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
6
5
|
'no-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
javaIncludeComments: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
7
|
+
javaJackson: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
8
|
+
javaConstraints: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
9
|
+
csharpAutoImplement: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
csharpNewtonsoft: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
csharpArrayType: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
12
|
+
csharpHashcode: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
13
|
+
csharpEqual: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
14
|
+
csharpSystemJson: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
11
15
|
tsModelType: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
12
16
|
tsEnumType: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
13
17
|
tsModuleSystem: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
@@ -17,27 +21,8 @@ export declare const modelsFlags: () => {
|
|
|
17
21
|
tsMarshalling: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
18
22
|
tsExampleInstance: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
19
23
|
tsRawPropertyNames: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
*/
|
|
24
|
+
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
25
|
+
output: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
23
26
|
packageName: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
24
|
-
/**
|
|
25
|
-
* Java specific options
|
|
26
|
-
*/
|
|
27
|
-
javaIncludeComments: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
28
|
-
javaJackson: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
29
|
-
javaConstraints: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
30
|
-
/**
|
|
31
|
-
* C++ and C# and PHP specific namespace to use for the generated models
|
|
32
|
-
*/
|
|
33
27
|
namespace: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
34
|
-
/**
|
|
35
|
-
* C# specific options
|
|
36
|
-
*/
|
|
37
|
-
csharpAutoImplement: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
38
|
-
csharpNewtonsoft: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
39
|
-
csharpArrayType: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
40
|
-
csharpHashcode: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
41
|
-
csharpEqual: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
42
|
-
csharpSystemJson: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
43
28
|
};
|
|
@@ -3,123 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.modelsFlags = void 0;
|
|
4
4
|
const core_1 = require("@oclif/core");
|
|
5
5
|
const parser_1 = require("../../parser");
|
|
6
|
+
const modelina_cli_1 = require("@asyncapi/modelina-cli");
|
|
6
7
|
const modelsFlags = () => {
|
|
7
|
-
return Object.assign(
|
|
8
|
+
return Object.assign(Object.assign(Object.assign({}, modelina_cli_1.ModelinaFlags), { 'no-interactive': core_1.Flags.boolean({
|
|
8
9
|
description: 'Disable interactive mode and run with the provided flags.',
|
|
9
10
|
required: false,
|
|
10
11
|
default: false,
|
|
11
|
-
}),
|
|
12
|
-
char: 'o',
|
|
13
|
-
description: 'The output directory where the models should be written to. Omitting this flag will write the models to `stdout`.',
|
|
14
|
-
required: false
|
|
15
|
-
}),
|
|
16
|
-
/**
|
|
17
|
-
* TypeScript specific options
|
|
18
|
-
*/
|
|
19
|
-
tsModelType: core_1.Flags.string({
|
|
20
|
-
type: 'option',
|
|
21
|
-
options: ['class', 'interface'],
|
|
22
|
-
description: 'TypeScript specific, define which type of model needs to be generated.',
|
|
23
|
-
required: false,
|
|
24
|
-
default: 'class',
|
|
25
|
-
}), tsEnumType: core_1.Flags.string({
|
|
26
|
-
type: 'option',
|
|
27
|
-
options: ['enum', 'union'],
|
|
28
|
-
description: 'TypeScript specific, define which type of enums needs to be generated.',
|
|
29
|
-
required: false,
|
|
30
|
-
default: 'enum',
|
|
31
|
-
}), tsModuleSystem: core_1.Flags.string({
|
|
32
|
-
type: 'option',
|
|
33
|
-
options: ['ESM', 'CJS'],
|
|
34
|
-
description: 'TypeScript specific, define the module system to be used.',
|
|
35
|
-
required: false,
|
|
36
|
-
default: 'ESM',
|
|
37
|
-
}), tsIncludeComments: core_1.Flags.boolean({
|
|
38
|
-
description: 'TypeScript specific, if enabled add comments while generating models.',
|
|
39
|
-
required: false,
|
|
40
|
-
default: false,
|
|
41
|
-
}), tsExportType: core_1.Flags.string({
|
|
42
|
-
type: 'option',
|
|
43
|
-
options: ['default', 'named'],
|
|
44
|
-
description: 'TypeScript specific, define which type of export needs to be generated.',
|
|
45
|
-
required: false,
|
|
46
|
-
default: 'default',
|
|
47
|
-
}), tsJsonBinPack: core_1.Flags.boolean({
|
|
48
|
-
description: 'TypeScript specific, define basic support for serializing to and from binary with jsonbinpack.',
|
|
49
|
-
required: false,
|
|
50
|
-
default: false,
|
|
51
|
-
}), tsMarshalling: core_1.Flags.boolean({
|
|
52
|
-
description: 'TypeScript specific, generate the models with marshalling functions.',
|
|
53
|
-
required: false,
|
|
54
|
-
default: false,
|
|
55
|
-
}), tsExampleInstance: core_1.Flags.boolean({
|
|
56
|
-
description: 'Typescript specific, generate example of the model',
|
|
57
|
-
required: false,
|
|
58
|
-
default: false,
|
|
59
|
-
}), tsRawPropertyNames: core_1.Flags.boolean({
|
|
60
|
-
description: 'Typescript specific, generate the models using raw property names.',
|
|
61
|
-
required: false,
|
|
62
|
-
default: false,
|
|
63
|
-
}),
|
|
64
|
-
/**
|
|
65
|
-
* Go and Java specific package name to use for the generated models
|
|
66
|
-
*/
|
|
67
|
-
packageName: core_1.Flags.string({
|
|
68
|
-
description: 'Go, Java and Kotlin specific, define the package to use for the generated models. This is required when language is `go`, `java` or `kotlin`.',
|
|
69
|
-
required: false
|
|
70
|
-
}),
|
|
71
|
-
/**
|
|
72
|
-
* Java specific options
|
|
73
|
-
*/
|
|
74
|
-
javaIncludeComments: core_1.Flags.boolean({
|
|
75
|
-
description: 'Java specific, if enabled add comments while generating models.',
|
|
76
|
-
required: false,
|
|
77
|
-
default: false
|
|
78
|
-
}), javaJackson: core_1.Flags.boolean({
|
|
79
|
-
description: 'Java specific, generate the models with Jackson serialization support',
|
|
80
|
-
required: false,
|
|
81
|
-
default: false
|
|
82
|
-
}), javaConstraints: core_1.Flags.boolean({
|
|
83
|
-
description: 'Java specific, generate the models with constraints',
|
|
84
|
-
required: false,
|
|
85
|
-
default: false
|
|
86
|
-
}),
|
|
87
|
-
/**
|
|
88
|
-
* C++ and C# and PHP specific namespace to use for the generated models
|
|
89
|
-
*/
|
|
90
|
-
namespace: core_1.Flags.string({
|
|
91
|
-
description: 'C#, C++ and PHP specific, define the namespace to use for the generated models. This is required when language is `csharp`,`c++` or `php`.',
|
|
92
|
-
required: false
|
|
93
|
-
}),
|
|
94
|
-
/**
|
|
95
|
-
* C# specific options
|
|
96
|
-
*/
|
|
97
|
-
csharpAutoImplement: core_1.Flags.boolean({
|
|
98
|
-
description: 'C# specific, define whether to generate auto-implemented properties or not.',
|
|
99
|
-
required: false,
|
|
100
|
-
default: false
|
|
101
|
-
}), csharpNewtonsoft: core_1.Flags.boolean({
|
|
102
|
-
description: 'C# specific, generate the models with newtonsoft serialization support',
|
|
103
|
-
required: false,
|
|
104
|
-
default: false
|
|
105
|
-
}), csharpArrayType: core_1.Flags.string({
|
|
106
|
-
type: 'option',
|
|
107
|
-
description: 'C# specific, define which type of array needs to be generated.',
|
|
108
|
-
options: ['Array', 'List'],
|
|
109
|
-
required: false,
|
|
110
|
-
default: 'Array'
|
|
111
|
-
}), csharpHashcode: core_1.Flags.boolean({
|
|
112
|
-
description: 'C# specific, generate the models with the GetHashCode method overwritten',
|
|
113
|
-
required: false,
|
|
114
|
-
default: false
|
|
115
|
-
}), csharpEqual: core_1.Flags.boolean({
|
|
116
|
-
description: 'C# specific, generate the models with the Equal method overwritten',
|
|
117
|
-
required: false,
|
|
118
|
-
default: false
|
|
119
|
-
}), csharpSystemJson: core_1.Flags.boolean({
|
|
120
|
-
description: 'C# specific, generate the models with System.Text.Json serialization support',
|
|
121
|
-
required: false,
|
|
122
|
-
default: false
|
|
123
|
-
}) }, (0, parser_1.validationFlags)({ logDiagnostics: false }));
|
|
12
|
+
}) }), (0, parser_1.validationFlags)({ logDiagnostics: false }));
|
|
124
13
|
};
|
|
125
14
|
exports.modelsFlags = modelsFlags;
|
package/oclif.manifest.json
CHANGED
|
@@ -680,7 +680,8 @@
|
|
|
680
680
|
"rust",
|
|
681
681
|
"kotlin",
|
|
682
682
|
"php",
|
|
683
|
-
"cplusplus"
|
|
683
|
+
"cplusplus",
|
|
684
|
+
"scala"
|
|
684
685
|
],
|
|
685
686
|
"required": true
|
|
686
687
|
},
|
|
@@ -699,13 +700,6 @@
|
|
|
699
700
|
"allowNo": false,
|
|
700
701
|
"type": "boolean"
|
|
701
702
|
},
|
|
702
|
-
"no-interactive": {
|
|
703
|
-
"description": "Disable interactive mode and run with the provided flags.",
|
|
704
|
-
"name": "no-interactive",
|
|
705
|
-
"required": false,
|
|
706
|
-
"allowNo": false,
|
|
707
|
-
"type": "boolean"
|
|
708
|
-
},
|
|
709
703
|
"output": {
|
|
710
704
|
"char": "o",
|
|
711
705
|
"description": "The output directory where the models should be written to. Omitting this flag will write the models to `stdout`.",
|
|
@@ -715,6 +709,22 @@
|
|
|
715
709
|
"multiple": false,
|
|
716
710
|
"type": "option"
|
|
717
711
|
},
|
|
712
|
+
"packageName": {
|
|
713
|
+
"description": "Go, Java and Kotlin specific, define the package to use for the generated models. This is required when language is `go`, `java` or `kotlin`.",
|
|
714
|
+
"name": "packageName",
|
|
715
|
+
"required": false,
|
|
716
|
+
"hasDynamicHelp": false,
|
|
717
|
+
"multiple": false,
|
|
718
|
+
"type": "option"
|
|
719
|
+
},
|
|
720
|
+
"namespace": {
|
|
721
|
+
"description": "C#, C++ and PHP specific, define the namespace to use for the generated models. This is required when language is `csharp`,`c++` or `php`.",
|
|
722
|
+
"name": "namespace",
|
|
723
|
+
"required": false,
|
|
724
|
+
"hasDynamicHelp": false,
|
|
725
|
+
"multiple": false,
|
|
726
|
+
"type": "option"
|
|
727
|
+
},
|
|
718
728
|
"tsModelType": {
|
|
719
729
|
"description": "TypeScript specific, define which type of model needs to be generated.",
|
|
720
730
|
"name": "tsModelType",
|
|
@@ -789,7 +799,7 @@
|
|
|
789
799
|
"type": "boolean"
|
|
790
800
|
},
|
|
791
801
|
"tsExampleInstance": {
|
|
792
|
-
"description": "Typescript specific, generate example of the model",
|
|
802
|
+
"description": "Typescript specific, generate example of the model.",
|
|
793
803
|
"name": "tsExampleInstance",
|
|
794
804
|
"required": false,
|
|
795
805
|
"allowNo": false,
|
|
@@ -802,43 +812,6 @@
|
|
|
802
812
|
"allowNo": false,
|
|
803
813
|
"type": "boolean"
|
|
804
814
|
},
|
|
805
|
-
"packageName": {
|
|
806
|
-
"description": "Go, Java and Kotlin specific, define the package to use for the generated models. This is required when language is `go`, `java` or `kotlin`.",
|
|
807
|
-
"name": "packageName",
|
|
808
|
-
"required": false,
|
|
809
|
-
"hasDynamicHelp": false,
|
|
810
|
-
"multiple": false,
|
|
811
|
-
"type": "option"
|
|
812
|
-
},
|
|
813
|
-
"javaIncludeComments": {
|
|
814
|
-
"description": "Java specific, if enabled add comments while generating models.",
|
|
815
|
-
"name": "javaIncludeComments",
|
|
816
|
-
"required": false,
|
|
817
|
-
"allowNo": false,
|
|
818
|
-
"type": "boolean"
|
|
819
|
-
},
|
|
820
|
-
"javaJackson": {
|
|
821
|
-
"description": "Java specific, generate the models with Jackson serialization support",
|
|
822
|
-
"name": "javaJackson",
|
|
823
|
-
"required": false,
|
|
824
|
-
"allowNo": false,
|
|
825
|
-
"type": "boolean"
|
|
826
|
-
},
|
|
827
|
-
"javaConstraints": {
|
|
828
|
-
"description": "Java specific, generate the models with constraints",
|
|
829
|
-
"name": "javaConstraints",
|
|
830
|
-
"required": false,
|
|
831
|
-
"allowNo": false,
|
|
832
|
-
"type": "boolean"
|
|
833
|
-
},
|
|
834
|
-
"namespace": {
|
|
835
|
-
"description": "C#, C++ and PHP specific, define the namespace to use for the generated models. This is required when language is `csharp`,`c++` or `php`.",
|
|
836
|
-
"name": "namespace",
|
|
837
|
-
"required": false,
|
|
838
|
-
"hasDynamicHelp": false,
|
|
839
|
-
"multiple": false,
|
|
840
|
-
"type": "option"
|
|
841
|
-
},
|
|
842
815
|
"csharpAutoImplement": {
|
|
843
816
|
"description": "C# specific, define whether to generate auto-implemented properties or not.",
|
|
844
817
|
"name": "csharpAutoImplement",
|
|
@@ -887,6 +860,34 @@
|
|
|
887
860
|
"allowNo": false,
|
|
888
861
|
"type": "boolean"
|
|
889
862
|
},
|
|
863
|
+
"javaIncludeComments": {
|
|
864
|
+
"description": "Java specific, if enabled add comments while generating models.",
|
|
865
|
+
"name": "javaIncludeComments",
|
|
866
|
+
"required": false,
|
|
867
|
+
"allowNo": false,
|
|
868
|
+
"type": "boolean"
|
|
869
|
+
},
|
|
870
|
+
"javaJackson": {
|
|
871
|
+
"description": "Java specific, generate the models with Jackson serialization support",
|
|
872
|
+
"name": "javaJackson",
|
|
873
|
+
"required": false,
|
|
874
|
+
"allowNo": false,
|
|
875
|
+
"type": "boolean"
|
|
876
|
+
},
|
|
877
|
+
"javaConstraints": {
|
|
878
|
+
"description": "Java specific, generate the models with constraints",
|
|
879
|
+
"name": "javaConstraints",
|
|
880
|
+
"required": false,
|
|
881
|
+
"allowNo": false,
|
|
882
|
+
"type": "boolean"
|
|
883
|
+
},
|
|
884
|
+
"no-interactive": {
|
|
885
|
+
"description": "Disable interactive mode and run with the provided flags.",
|
|
886
|
+
"name": "no-interactive",
|
|
887
|
+
"required": false,
|
|
888
|
+
"allowNo": false,
|
|
889
|
+
"type": "boolean"
|
|
890
|
+
},
|
|
890
891
|
"log-diagnostics": {
|
|
891
892
|
"description": "log validation diagnostics or not",
|
|
892
893
|
"name": "log-diagnostics",
|
|
@@ -1476,5 +1477,5 @@
|
|
|
1476
1477
|
]
|
|
1477
1478
|
}
|
|
1478
1479
|
},
|
|
1479
|
-
"version": "
|
|
1480
|
+
"version": "2.0.1"
|
|
1480
1481
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@asyncapi/cli",
|
|
3
3
|
"description": "All in one CLI for all AsyncAPI tools",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "2.0.1",
|
|
5
5
|
"author": "@asyncapi",
|
|
6
6
|
"bin": {
|
|
7
7
|
"asyncapi": "./bin/run_bin"
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"@asyncapi/converter": "^1.4.19",
|
|
14
14
|
"@asyncapi/diff": "^0.4.1",
|
|
15
15
|
"@asyncapi/generator": "^1.17.25",
|
|
16
|
-
"@asyncapi/modelina": "^
|
|
16
|
+
"@asyncapi/modelina-cli": "^4.0.0-next.48",
|
|
17
17
|
"@asyncapi/openapi-schema-parser": "^3.0.22",
|
|
18
18
|
"@asyncapi/optimizer": "^1.0.2",
|
|
19
19
|
"@asyncapi/parser": "^3.0.16",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"@oclif/core": "^3",
|
|
25
25
|
"@oclif/errors": "^1.3.6",
|
|
26
26
|
"@oclif/plugin-not-found": "^2.3.22",
|
|
27
|
-
"@smoya/asyncapi-adoption-metrics": "^2.4.
|
|
27
|
+
"@smoya/asyncapi-adoption-metrics": "^2.4.8",
|
|
28
28
|
"@smoya/multi-parser": "^5.0.8",
|
|
29
29
|
"@stoplight/spectral-cli": "6.9.0",
|
|
30
30
|
"ajv": "^8.12.0",
|