Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ class {{classname}}Controller({{#serviceInterface}}@Autowired(required = true) v
{{#vendorExtensions.x-operation-extra-annotation}}
{{{.}}}
{{/vendorExtensions.x-operation-extra-annotation}}
{{#isDeprecated}}
@Deprecated(message="Operation is deprecated")
{{/isDeprecated}}
@RequestMapping(
method = [RequestMethod.{{httpMethod}}],
// "{{#lambdaEscapeInNormalString}}{{{path}}}{{/lambdaEscapeInNormalString}}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ interface {{classname}} {
{{#vendorExtensions.x-operation-extra-annotation}}
{{{.}}}
{{/vendorExtensions.x-operation-extra-annotation}}
{{#isDeprecated}}
@Deprecated(message="Operation is deprecated")
{{/isDeprecated}}
@RequestMapping(
method = [RequestMethod.{{httpMethod}}],
// "{{#lambdaEscapeInNormalString}}{{{path}}}{{/lambdaEscapeInNormalString}}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ interface {{classname}}Service {
{{/externalDocs}}
* @see {{classname}}#{{operationId}}
*/
{{#isDeprecated}}
@Deprecated(message="Operation is deprecated")
{{/isDeprecated}}
{{#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}}
{{/operation}}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4663,6 +4663,49 @@ public void testSealedResponseInterfacesVoidResponse() throws IOException {
Assert.assertTrue(petContent.contains(") : CreatePetResponse {") || petContent.contains(") : CreatePetResponse"),
"Pet should implement CreatePetResponse");
}

@Test
public void testDeprecatedAnnotationOnInterface() throws IOException {
File output = Files.createTempDirectory("test").toFile().getCanonicalFile();
output.deleteOnExit();
String outputPath = output.getAbsolutePath().replace('\\', '/');

KotlinSpringServerCodegen codegen = new KotlinSpringServerCodegen();
codegen.setOutputDir(output.getAbsolutePath());
codegen.additionalProperties().put(CodegenConstants.API_PACKAGE, "org.openapitools.api");
codegen.additionalProperties().put(KotlinSpringServerCodegen.INTERFACE_ONLY, true);

new DefaultGenerator().opts(new ClientOptInput()
.openAPI(TestUtils.parseSpec("src/test/resources/3_0/kotlin/support-deprecated-api.yaml"))
.config(codegen))
.generate();

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

@Test
public void testDeprecatedAnnotationOnController() throws IOException {
File output = Files.createTempDirectory("test").toFile().getCanonicalFile();
output.deleteOnExit();
String outputPath = output.getAbsolutePath().replace('\\', '/');

KotlinSpringServerCodegen codegen = new KotlinSpringServerCodegen();
codegen.setOutputDir(output.getAbsolutePath());
codegen.additionalProperties().put(CodegenConstants.API_PACKAGE, "org.openapitools.api");

new DefaultGenerator().opts(new ClientOptInput()
.openAPI(TestUtils.parseSpec("src/test/resources/3_0/kotlin/support-deprecated-api.yaml"))
.config(codegen))
.generate();

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


Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
openapi: "3.0.0"
info:
title: Verify @Deprecated annotation
version: "1.0"

paths:

/ping:
get:
deprecated: true
operationId: ping
responses:
200:
description: OK
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ interface PetApi {
}


@Deprecated(message="Operation is deprecated")
@RequestMapping(
method = [RequestMethod.GET],
// "/pet/findByTags"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ class PetApiController() {
ApiResponse(responseCode = "400", description = "Invalid tag value") ],
security = [ SecurityRequirement(name = "petstore_auth", scopes = [ "read:pets" ]) ]
)
@Deprecated(message="Operation is deprecated")
@RequestMapping(
method = [RequestMethod.GET],
// "/pet/findByTags"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ interface PetApi {
}


@Deprecated(message="Operation is deprecated")
@RequestMapping(
method = [RequestMethod.GET],
// "/pet/findByTags"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) {
}


@Deprecated(message="Operation is deprecated")
@RequestMapping(
method = [RequestMethod.GET],
// "/pet/findByTags"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ interface PetApiService {
* @deprecated
* @see PetApi#findPetsByTags
*/
@Deprecated(message="Operation is deprecated")
fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>): List<Pet>

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) {
}


@Deprecated(message="Operation is deprecated")
@RequestMapping(
method = [RequestMethod.GET],
// "/pet/findByTags"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ interface PetApiService {
* @deprecated
* @see PetApi#findPetsByTags
*/
@Deprecated(message="Operation is deprecated")
fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>): List<Pet>

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) {
}


@Deprecated(message="Operation is deprecated")
@RequestMapping(
method = [RequestMethod.GET],
// "/pet/findByTags"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ interface PetApiService {
* @deprecated
* @see PetApi#findPetsByTags
*/
@Deprecated(message="Operation is deprecated")
fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>): List<Pet>

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ interface PetApi {
],
security = [ SecurityRequirement(name = "petstore_auth", scopes = [ "read:pets" ]) ]
)
@Deprecated(message="Operation is deprecated")
@RequestMapping(
method = [RequestMethod.GET],
// "/pet/findByTags"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ interface PetApi {
],
security = [ SecurityRequirement(name = "petstore_auth", scopes = [ "read:pets" ]) ]
)
@Deprecated(message="Operation is deprecated")
@RequestMapping(
method = [RequestMethod.GET],
// "/pet/findByTags"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) {
ApiResponse(responseCode = "400", description = "Invalid tag value") ],
security = [ SecurityRequirement(name = "petstore_auth", scopes = [ "write:pets", "read:pets" ]) ]
)
@Deprecated(message="Operation is deprecated")
@RequestMapping(
method = [RequestMethod.GET],
// "/pet/findByTags"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ interface PetApiService {
* @deprecated
* @see PetApi#findPetsByTags
*/
@Deprecated(message="Operation is deprecated")
fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>): List<Pet>

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ interface PetApi {
}

@ResponseStatus(HttpStatus.OK)
@Deprecated(message="Operation is deprecated")
@RequestMapping(
method = [RequestMethod.GET],
// "/pet/findByTags"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ interface PetApiService {
* @deprecated
* @see PetApi#findPetsByTags
*/
@Deprecated(message="Operation is deprecated")
fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>): List<Pet>

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) {
}

@ResponseStatus(HttpStatus.OK)
@Deprecated(message="Operation is deprecated")
@RequestMapping(
method = [RequestMethod.GET],
// "/pet/findByTags"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ interface PetApiService {
* @deprecated
* @see PetApi#findPetsByTags
*/
@Deprecated(message="Operation is deprecated")
fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>): List<Pet>

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) {
ApiResponse(responseCode = "400", description = "Invalid tag value") ],
security = [ SecurityRequirement(name = "petstore_auth", scopes = [ "read:pets" ]) ]
)
@Deprecated(message="Operation is deprecated")
@RequestMapping(
method = [RequestMethod.GET],
// "/pet/findByTags"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ interface PetApiService {
* @deprecated
* @see PetApi#findPetsByTags
*/
@Deprecated(message="Operation is deprecated")
suspend fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>): List<Pet>

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) {
ApiResponse(responseCode = "400", description = "Invalid tag value") ],
security = [ SecurityRequirement(name = "petstore_auth", scopes = [ "read:pets" ]) ]
)
@Deprecated(message="Operation is deprecated")
@RequestMapping(
method = [RequestMethod.GET],
// "/pet/findByTags"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ interface PetApiService {
* @deprecated
* @see PetApi#findPetsByTags
*/
@Deprecated(message="Operation is deprecated")
fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>): Flow<Pet>

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ interface PetApi {
],
security = [ SecurityRequirement(name = "petstore_auth", scopes = [ "read:pets" ]) ]
)
@Deprecated(message="Operation is deprecated")
@RequestMapping(
method = [RequestMethod.GET],
// "/pet/findByTags"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) {
authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])])
@ApiResponses(
value = [ApiResponse(code = 200, message = "successful operation", response = Pet::class, responseContainer = "List"),ApiResponse(code = 400, message = "Invalid tag value")])
@Deprecated(message="Operation is deprecated")
@RequestMapping(
method = [RequestMethod.GET],
// "/pet/findByTags"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ interface PetApiService {
* @deprecated
* @see PetApi#findPetsByTags
*/
@Deprecated(message="Operation is deprecated")
fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>): List<Pet>

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) {
ApiResponse(responseCode = "400", description = "Invalid tag value") ],
security = [ SecurityRequirement(name = "petstore_auth", scopes = [ "write:pets", "read:pets" ]) ]
)
@Deprecated(message="Operation is deprecated")
@RequestMapping(
method = [RequestMethod.GET],
// "/pet/findByTags"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ interface PetApiService {
* @deprecated
* @see PetApi#findPetsByTags
*/
@Deprecated(message="Operation is deprecated")
fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>): List<Pet>

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) {
authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])])
@ApiResponses(
value = [ApiResponse(code = 200, message = "successful operation", response = Pet::class, responseContainer = "List"),ApiResponse(code = 400, message = "Invalid tag value")])
@Deprecated(message="Operation is deprecated")
@RequestMapping(
method = [RequestMethod.GET],
// "/pet/findByTags"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ interface PetApiService {
* @deprecated
* @see PetApi#findPetsByTags
*/
@Deprecated(message="Operation is deprecated")
fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>): List<Pet>

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) {
}


@Deprecated(message="Operation is deprecated")
@RequestMapping(
method = [RequestMethod.GET],
// "/pet/findByTags"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ interface PetApiService {
* @deprecated
* @see PetApi#findPetsByTags
*/
@Deprecated(message="Operation is deprecated")
fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>): List<Pet>

/**
Expand Down
Loading