@asyncapi/cli 1.2.34 → 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.
@@ -9,7 +9,7 @@
9
9
  "version": "0.1.0",
10
10
  "license": "Apache-2.0",
11
11
  "dependencies": {
12
- "@asyncapi/glee": "^0.33.5"
12
+ "@asyncapi/glee": "^0.34.0"
13
13
  },
14
14
  "devDependencies": {
15
15
  "@types/node": "^20.5.9"
@@ -280,9 +280,9 @@
280
280
  "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="
281
281
  },
282
282
  "node_modules/@asyncapi/glee": {
283
- "version": "0.33.5",
284
- "resolved": "https://registry.npmjs.org/@asyncapi/glee/-/glee-0.33.5.tgz",
285
- "integrity": "sha512-R06cO4m1vGR2tZO0C0Ypl0qGbM8w658a9fWmoZxslonFuuOGIt275dccV0Dt4IrRz/W3IpacTgEsanlIhqaSCA==",
283
+ "version": "0.34.0",
284
+ "resolved": "https://registry.npmjs.org/@asyncapi/glee/-/glee-0.34.0.tgz",
285
+ "integrity": "sha512-s3Z8IXGFqAZlvI/Nh9+xdr6v7dqchNBouO3jpK/+KL6Evowo4BWS/AEI+rtgKvFv1icySRy/gBvcswFE4rMRUQ==",
286
286
  "dependencies": {
287
287
  "@asyncapi/generator": "^1.16.0",
288
288
  "@asyncapi/html-template": "^2.0.0",
@@ -12660,9 +12660,9 @@
12660
12660
  }
12661
12661
  },
12662
12662
  "@asyncapi/glee": {
12663
- "version": "0.33.5",
12664
- "resolved": "https://registry.npmjs.org/@asyncapi/glee/-/glee-0.33.5.tgz",
12665
- "integrity": "sha512-R06cO4m1vGR2tZO0C0Ypl0qGbM8w658a9fWmoZxslonFuuOGIt275dccV0Dt4IrRz/W3IpacTgEsanlIhqaSCA==",
12663
+ "version": "0.34.0",
12664
+ "resolved": "https://registry.npmjs.org/@asyncapi/glee/-/glee-0.34.0.tgz",
12665
+ "integrity": "sha512-s3Z8IXGFqAZlvI/Nh9+xdr6v7dqchNBouO3jpK/+KL6Evowo4BWS/AEI+rtgKvFv1icySRy/gBvcswFE4rMRUQ==",
12666
12666
  "requires": {
12667
12667
  "@asyncapi/generator": "^1.16.0",
12668
12668
  "@asyncapi/html-template": "^2.0.0",
@@ -24,7 +24,7 @@
24
24
  },
25
25
  "homepage": "https://github.com/asyncapi/glee-hello-world#readme",
26
26
  "dependencies": {
27
- "@asyncapi/glee": "^0.33.5"
27
+ "@asyncapi/glee": "^0.34.0"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@types/node": "^20.5.9"
@@ -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
- fileGenerator = new modelina_1.JavaFileGenerator();
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
  */
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.2.34",
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",
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": "1.2.34",
4
+ "version": "1.3.0",
5
5
  "author": "@asyncapi",
6
6
  "bin": {
7
7
  "asyncapi": "./bin/run"