Skip to content

Commit 78868fa

Browse files
committed
Add required message attribute for Kotlin code
1 parent 0b0e893 commit 78868fa

4 files changed

Lines changed: 7 additions & 4 deletions

File tree

modules/openapi-generator/src/main/resources/kotlin-spring/api.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class {{classname}}Controller({{#serviceInterface}}@Autowired(required = true) v
8888
{{{.}}}
8989
{{/vendorExtensions.x-operation-extra-annotation}}
9090
{{#isDeprecated}}
91-
@Deprecated
91+
@Deprecated(message="Operation is deprecated")
9292
{{/isDeprecated}}
9393
@RequestMapping(
9494
method = [RequestMethod.{{httpMethod}}],

modules/openapi-generator/src/main/resources/kotlin-spring/apiInterface.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ interface {{classname}} {
103103
{{{.}}}
104104
{{/vendorExtensions.x-operation-extra-annotation}}
105105
{{#isDeprecated}}
106-
@Deprecated
106+
@Deprecated(message="Operation is deprecated")
107107
{{/isDeprecated}}
108108
@RequestMapping(
109109
method = [RequestMethod.{{httpMethod}}],

modules/openapi-generator/src/main/resources/kotlin-spring/service.mustache

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ interface {{classname}}Service {
3030
{{/externalDocs}}
3131
* @see {{classname}}#{{operationId}}
3232
*/
33+
{{#isDeprecated}}
34+
@Deprecated(message="Operation is deprecated")
35+
{{/isDeprecated}}
3336
{{#reactive}}{{^isArray}}suspend {{/isArray}}{{#isArray}}{{^useFlowForArrayReturnType}}suspend {{/useFlowForArrayReturnType}}{{/isArray}}{{/reactive}}fun {{operationId}}({{#allParams}}{{{paramName}}}: {{^isBodyParam}}{{>optionalDataType}}{{/isBodyParam}}{{#isBodyParam}}{{^reactive}}{{>optionalDataType}}{{/reactive}}{{#reactive}}{{^isArray}}{{>optionalDataType}}{{/isArray}}{{#isArray}}Flow<{{{baseType}}}>{{/isArray}}{{/reactive}}{{/isBodyParam}}{{^-last}}, {{/-last}}{{/allParams}}): {{>returnTypes}}
3437
{{/operation}}
3538
}

modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4682,7 +4682,7 @@ public void testDeprecatedAnnotationOnInterface() throws IOException {
46824682

46834683
assertFileContains(
46844684
Paths.get(outputPath + "/src/main/kotlin/org/openapitools/api/PingApi.kt"),
4685-
"@Deprecated @RequestMapping("
4685+
"@Deprecated(message=\"Operation is deprecated\") @RequestMapping("
46864686
);
46874687
}
46884688

@@ -4703,7 +4703,7 @@ public void testDeprecatedAnnotationOnController() throws IOException {
47034703

47044704
assertFileContains(
47054705
Paths.get(outputPath + "/src/main/kotlin/org/openapitools/api/PingApiController.kt"),
4706-
"@Deprecated @RequestMapping("
4706+
"@Deprecated(message=\"Operation is deprecated\") @RequestMapping("
47074707
);
47084708
}
47094709
}

0 commit comments

Comments
 (0)