@asyncapi/cli 1.2.35 → 1.3.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.
|
@@ -33,6 +33,12 @@ export default class Models extends Command {
|
|
|
33
33
|
* Go and Java specific package name to use for the generated models
|
|
34
34
|
*/
|
|
35
35
|
packageName: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
36
|
+
/**
|
|
37
|
+
* Java specific options
|
|
38
|
+
*/
|
|
39
|
+
javaIncludeComments: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
40
|
+
javaJackson: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
41
|
+
javaConstraints: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
36
42
|
/**
|
|
37
43
|
* C++ and C# and PHP specific namespace to use for the generated models
|
|
38
44
|
*/
|
|
@@ -27,7 +27,7 @@ class Models extends base_1.default {
|
|
|
27
27
|
run() {
|
|
28
28
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
29
29
|
const { args, flags } = yield this.parse(Models);
|
|
30
|
-
const { tsModelType, tsEnumType, tsIncludeComments, tsModuleSystem, tsExportType, tsJsonBinPack, tsMarshalling, tsExampleInstance, namespace, csharpAutoImplement, csharpArrayType, csharpNewtonsoft, csharpHashcode, csharpEqual, csharpSystemJson, packageName, output } = flags;
|
|
30
|
+
const { tsModelType, tsEnumType, tsIncludeComments, tsModuleSystem, tsExportType, tsJsonBinPack, tsMarshalling, tsExampleInstance, namespace, csharpAutoImplement, csharpArrayType, csharpNewtonsoft, csharpHashcode, csharpEqual, csharpSystemJson, packageName, javaIncludeComments, javaJackson, javaConstraints, output } = flags;
|
|
31
31
|
const { language, file } = args;
|
|
32
32
|
const inputFile = (yield (0, SpecificationFile_1.load)(file)) || (yield (0, SpecificationFile_1.load)());
|
|
33
33
|
if (inputFile.isAsyncAPI3()) {
|
|
@@ -151,7 +151,26 @@ class Models extends base_1.default {
|
|
|
151
151
|
if (packageName === undefined) {
|
|
152
152
|
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.');
|
|
153
153
|
}
|
|
154
|
-
|
|
154
|
+
presets.push({
|
|
155
|
+
preset: modelina_1.JAVA_COMMON_PRESET,
|
|
156
|
+
options
|
|
157
|
+
});
|
|
158
|
+
if (javaIncludeComments) {
|
|
159
|
+
presets.push(modelina_1.JAVA_DESCRIPTION_PRESET);
|
|
160
|
+
}
|
|
161
|
+
if (javaJackson) {
|
|
162
|
+
presets.push({
|
|
163
|
+
preset: modelina_1.JAVA_COMMON_PRESET,
|
|
164
|
+
options
|
|
165
|
+
}, modelina_1.JAVA_JACKSON_PRESET);
|
|
166
|
+
}
|
|
167
|
+
if (javaConstraints) {
|
|
168
|
+
presets.push({
|
|
169
|
+
preset: modelina_1.JAVA_COMMON_PRESET,
|
|
170
|
+
options
|
|
171
|
+
}, modelina_1.JAVA_CONSTRAINTS_PRESET);
|
|
172
|
+
}
|
|
173
|
+
fileGenerator = new modelina_1.JavaFileGenerator({ presets });
|
|
155
174
|
fileOptions = {
|
|
156
175
|
packageName
|
|
157
176
|
};
|
|
@@ -273,6 +292,22 @@ Models.flags = Object.assign({ help: core_1.Flags.help({ char: 'h' }), output: c
|
|
|
273
292
|
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`.',
|
|
274
293
|
required: false
|
|
275
294
|
}),
|
|
295
|
+
/**
|
|
296
|
+
* Java specific options
|
|
297
|
+
*/
|
|
298
|
+
javaIncludeComments: core_1.Flags.boolean({
|
|
299
|
+
description: 'Java specific, if enabled add comments while generating models.',
|
|
300
|
+
required: false,
|
|
301
|
+
default: false
|
|
302
|
+
}), javaJackson: core_1.Flags.boolean({
|
|
303
|
+
description: 'Java specific, generate the models with Jackson serialization support',
|
|
304
|
+
required: false,
|
|
305
|
+
default: false
|
|
306
|
+
}), javaConstraints: core_1.Flags.boolean({
|
|
307
|
+
description: 'Java specific, generate the models with constraints',
|
|
308
|
+
required: false,
|
|
309
|
+
default: false
|
|
310
|
+
}),
|
|
276
311
|
/**
|
|
277
312
|
* C++ and C# and PHP specific namespace to use for the generated models
|
|
278
313
|
*/
|
package/oclif.manifest.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.
|
|
2
|
+
"version": "1.3.0",
|
|
3
3
|
"commands": {
|
|
4
4
|
"bundle": {
|
|
5
5
|
"id": "bundle",
|
|
@@ -590,6 +590,27 @@
|
|
|
590
590
|
"required": false,
|
|
591
591
|
"multiple": false
|
|
592
592
|
},
|
|
593
|
+
"javaIncludeComments": {
|
|
594
|
+
"name": "javaIncludeComments",
|
|
595
|
+
"type": "boolean",
|
|
596
|
+
"description": "Java specific, if enabled add comments while generating models.",
|
|
597
|
+
"required": false,
|
|
598
|
+
"allowNo": false
|
|
599
|
+
},
|
|
600
|
+
"javaJackson": {
|
|
601
|
+
"name": "javaJackson",
|
|
602
|
+
"type": "boolean",
|
|
603
|
+
"description": "Java specific, generate the models with Jackson serialization support",
|
|
604
|
+
"required": false,
|
|
605
|
+
"allowNo": false
|
|
606
|
+
},
|
|
607
|
+
"javaConstraints": {
|
|
608
|
+
"name": "javaConstraints",
|
|
609
|
+
"type": "boolean",
|
|
610
|
+
"description": "Java specific, generate the models with constraints",
|
|
611
|
+
"required": false,
|
|
612
|
+
"allowNo": false
|
|
613
|
+
},
|
|
593
614
|
"namespace": {
|
|
594
615
|
"name": "namespace",
|
|
595
616
|
"type": "option",
|