@goast/kotlin 0.2.0 → 0.2.2

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.
@@ -200,8 +200,10 @@ class DefaultKotlinOkHttp3Generator extends file_generator_1.KotlinFileGenerator
200
200
  : core_1.builderTemplate.indent `
201
201
  .apply {${core_1.builderTemplate.indent `
202
202
  ${(0, core_1.appendValueGroup)(queryParameters.map((param) => {
203
+ var _a;
203
204
  const paramName = (0, core_1.toCasing)(param.name, ctx.config.parameterNameCasing);
204
- const put = (0, core_1.builderTemplate) `put(${ast_1.kt.string(paramName)}, listOf(${paramName}.toString()))`;
205
+ const toString = ((_a = param.schema) === null || _a === void 0 ? void 0 : _a.kind) === 'array' ? '.joinToString()' : '.toString()';
206
+ const put = (0, core_1.builderTemplate) `put(${ast_1.kt.string(paramName)}, listOf(${paramName}${toString}))`;
205
207
  return param.required
206
208
  ? put
207
209
  : (0, core_1.builderTemplate) `if (${paramName} != null) {${core_1.builderTemplate.indent `
@@ -105,7 +105,7 @@ class DefaultKotlinSpringControllerGenerator extends file_generator_1.KotlinFile
105
105
  const result = ast_1.kt.parameter((0, core_1.toCasing)(parameter.name, ctx.config.parameterNameCasing), this.getParameterType(ctx, { endpoint, parameter }), {});
106
106
  if (ctx.config.addSwaggerAnnotations) {
107
107
  const annotation = ast_1.kt.annotation(ast_1.kt.refs.swagger.parameter(), [
108
- ast_1.kt.argument.named('description', ast_1.kt.string((_a = parameter.description) === null || _a === void 0 ? void 0 : _a.trim())),
108
+ parameter.description ? ast_1.kt.argument.named('description', ast_1.kt.string((_a = parameter.description) === null || _a === void 0 ? void 0 : _a.trim())) : null,
109
109
  ast_1.kt.argument.named('required', parameter.required),
110
110
  ]);
111
111
  if (((_b = parameter.schema) === null || _b === void 0 ? void 0 : _b.default) !== undefined) {
@@ -197,8 +197,10 @@ export class DefaultKotlinOkHttp3Generator extends KotlinFileGenerator {
197
197
  : s.indent `
198
198
  .apply {${s.indent `
199
199
  ${appendValueGroup(queryParameters.map((param) => {
200
+ var _a;
200
201
  const paramName = toCasing(param.name, ctx.config.parameterNameCasing);
201
- const put = s `put(${kt.string(paramName)}, listOf(${paramName}.toString()))`;
202
+ const toString = ((_a = param.schema) === null || _a === void 0 ? void 0 : _a.kind) === 'array' ? '.joinToString()' : '.toString()';
203
+ const put = s `put(${kt.string(paramName)}, listOf(${paramName}${toString}))`;
202
204
  return param.required
203
205
  ? put
204
206
  : s `if (${paramName} != null) {${s.indent `
@@ -102,7 +102,7 @@ export class DefaultKotlinSpringControllerGenerator extends KotlinFileGenerator
102
102
  const result = kt.parameter(toCasing(parameter.name, ctx.config.parameterNameCasing), this.getParameterType(ctx, { endpoint, parameter }), {});
103
103
  if (ctx.config.addSwaggerAnnotations) {
104
104
  const annotation = kt.annotation(kt.refs.swagger.parameter(), [
105
- kt.argument.named('description', kt.string((_a = parameter.description) === null || _a === void 0 ? void 0 : _a.trim())),
105
+ parameter.description ? kt.argument.named('description', kt.string((_a = parameter.description) === null || _a === void 0 ? void 0 : _a.trim())) : null,
106
106
  kt.argument.named('required', parameter.required),
107
107
  ]);
108
108
  if (((_b = parameter.schema) === null || _b === void 0 ? void 0 : _b.default) !== undefined) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@goast/kotlin",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "repository": "https://github.com/MaSch0212/goast.git",
5
5
  "author": {
6
6
  "name": "Marc Schmidt (MaSch0212)",
@@ -12,7 +12,7 @@
12
12
  "fs-extra": "^11.2.0",
13
13
  "node-fetch": "^2.7.0",
14
14
  "yaml": "^2.4.1",
15
- "@goast/core": "0.2.0",
15
+ "@goast/core": "0.2.1",
16
16
  "tslib": "2.6.2"
17
17
  },
18
18
  "module": "./esm/index.js",