@goast/kotlin 0.2.1 → 0.2.3
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.
|
@@ -79,9 +79,9 @@ class DefaultKotlinSpringControllerGenerator extends file_generator_1.KotlinFile
|
|
|
79
79
|
getApiInterfaceEndpointMethodAnnnotations(ctx, endpoint) {
|
|
80
80
|
var _a, _b, _c;
|
|
81
81
|
const operation = ast_1.kt.annotation(ast_1.kt.refs.swagger.operation(), [
|
|
82
|
-
ast_1.kt.argument.named('summary', ast_1.kt.string((_a = endpoint.summary) === null || _a === void 0 ? void 0 : _a.trim())),
|
|
82
|
+
endpoint.summary ? ast_1.kt.argument.named('summary', ast_1.kt.string((_a = endpoint.summary) === null || _a === void 0 ? void 0 : _a.trim())) : null,
|
|
83
83
|
ast_1.kt.argument.named('operationId', ast_1.kt.string(endpoint.name)),
|
|
84
|
-
ast_1.kt.argument.named('description', ast_1.kt.string((_b = endpoint.description) === null || _b === void 0 ? void 0 : _b.trim())),
|
|
84
|
+
endpoint.description ? ast_1.kt.argument.named('description', ast_1.kt.string((_b = endpoint.description) === null || _b === void 0 ? void 0 : _b.trim())) : null,
|
|
85
85
|
ast_1.kt.argument.named('responses', ast_1.kt.collectionLiteral(endpoint.responses.map((response) => {
|
|
86
86
|
var _a, _b;
|
|
87
87
|
return ast_1.kt.call(ast_1.kt.refs.swagger.apiResponse(), [
|
|
@@ -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) {
|
|
@@ -76,9 +76,9 @@ export class DefaultKotlinSpringControllerGenerator extends KotlinFileGenerator
|
|
|
76
76
|
getApiInterfaceEndpointMethodAnnnotations(ctx, endpoint) {
|
|
77
77
|
var _a, _b, _c;
|
|
78
78
|
const operation = kt.annotation(kt.refs.swagger.operation(), [
|
|
79
|
-
kt.argument.named('summary', kt.string((_a = endpoint.summary) === null || _a === void 0 ? void 0 : _a.trim())),
|
|
79
|
+
endpoint.summary ? kt.argument.named('summary', kt.string((_a = endpoint.summary) === null || _a === void 0 ? void 0 : _a.trim())) : null,
|
|
80
80
|
kt.argument.named('operationId', kt.string(endpoint.name)),
|
|
81
|
-
kt.argument.named('description', kt.string((_b = endpoint.description) === null || _b === void 0 ? void 0 : _b.trim())),
|
|
81
|
+
endpoint.description ? kt.argument.named('description', kt.string((_b = endpoint.description) === null || _b === void 0 ? void 0 : _b.trim())) : null,
|
|
82
82
|
kt.argument.named('responses', kt.collectionLiteral(endpoint.responses.map((response) => {
|
|
83
83
|
var _a, _b;
|
|
84
84
|
return kt.call(kt.refs.swagger.apiResponse(), [
|
|
@@ -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) {
|