From e69c5269d52f2ac10fe005f1d62ee07814b2ed3f Mon Sep 17 00:00:00 2001 From: Kernevez Date: Wed, 10 Jan 2024 04:20:14 +0100 Subject: [PATCH] Add tags on operation for template kotlin-spring (#17410) * Add tags on kotlin-spring * Fix review --- .../main/resources/kotlin-spring/apiInterface.mustache | 1 + .../src/main/kotlin/org/openapitools/api/PetApi.kt | 8 ++++++++ .../src/main/kotlin/org/openapitools/api/StoreApi.kt | 4 ++++ .../src/main/kotlin/org/openapitools/api/UserApi.kt | 8 ++++++++ 4 files changed, 21 insertions(+) diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/apiInterface.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/apiInterface.mustache index 6a8fd486625..97501bac954 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/apiInterface.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/apiInterface.mustache @@ -76,6 +76,7 @@ interface {{classname}} { {{#swagger2AnnotationLibrary}} @Operation( + tags = [{{#tags}}"{{{name}}}",{{/tags}}], summary = "{{{summary}}}", operationId = "{{{operationId}}}", description = """{{{unescapedNotes}}}""", diff --git a/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/api/PetApi.kt b/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/api/PetApi.kt index 32cb56da712..9d118bfe728 100644 --- a/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/api/PetApi.kt +++ b/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/api/PetApi.kt @@ -41,6 +41,7 @@ interface PetApi { fun getDelegate(): PetApiDelegate = object: PetApiDelegate {} @Operation( + tags = ["pet",], summary = "Add a new pet to the store", operationId = "addPet", description = """""", @@ -61,6 +62,7 @@ interface PetApi { } @Operation( + tags = ["pet",], summary = "Deletes a pet", operationId = "deletePet", description = """""", @@ -78,6 +80,7 @@ interface PetApi { } @Operation( + tags = ["pet",], summary = "Finds Pets by status", operationId = "findPetsByStatus", description = """Multiple status values can be provided with comma separated strings""", @@ -97,6 +100,7 @@ interface PetApi { } @Operation( + tags = ["pet",], summary = "Finds Pets by tags", operationId = "findPetsByTags", description = """Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.""", @@ -116,6 +120,7 @@ interface PetApi { } @Operation( + tags = ["pet",], summary = "Find pet by ID", operationId = "getPetById", description = """Returns a single pet""", @@ -136,6 +141,7 @@ interface PetApi { } @Operation( + tags = ["pet",], summary = "Update an existing pet", operationId = "updatePet", description = """""", @@ -158,6 +164,7 @@ interface PetApi { } @Operation( + tags = ["pet",], summary = "Updates a pet in the store with form data", operationId = "updatePetWithForm", description = """""", @@ -176,6 +183,7 @@ interface PetApi { } @Operation( + tags = ["pet",], summary = "uploads an image", operationId = "uploadFile", description = """""", diff --git a/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/api/StoreApi.kt b/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/api/StoreApi.kt index d50327b0047..9860548367e 100644 --- a/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/api/StoreApi.kt +++ b/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/api/StoreApi.kt @@ -40,6 +40,7 @@ interface StoreApi { fun getDelegate(): StoreApiDelegate = object: StoreApiDelegate {} @Operation( + tags = ["store",], summary = "Delete purchase order by ID", operationId = "deleteOrder", description = """For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors""", @@ -57,6 +58,7 @@ interface StoreApi { } @Operation( + tags = ["store",], summary = "Returns pet inventories by status", operationId = "getInventory", description = """Returns a map of status codes to quantities""", @@ -75,6 +77,7 @@ interface StoreApi { } @Operation( + tags = ["store",], summary = "Find purchase order by ID", operationId = "getOrderById", description = """For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions""", @@ -94,6 +97,7 @@ interface StoreApi { } @Operation( + tags = ["store",], summary = "Place an order for a pet", operationId = "placeOrder", description = """""", diff --git a/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/api/UserApi.kt b/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/api/UserApi.kt index 0f063256ac4..a4e957fe019 100644 --- a/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/api/UserApi.kt +++ b/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/api/UserApi.kt @@ -40,6 +40,7 @@ interface UserApi { fun getDelegate(): UserApiDelegate = object: UserApiDelegate {} @Operation( + tags = ["user",], summary = "Create user", operationId = "createUser", description = """This can only be done by the logged in user.""", @@ -58,6 +59,7 @@ interface UserApi { } @Operation( + tags = ["user",], summary = "Creates list of users with given input array", operationId = "createUsersWithArrayInput", description = """""", @@ -76,6 +78,7 @@ interface UserApi { } @Operation( + tags = ["user",], summary = "Creates list of users with given input array", operationId = "createUsersWithListInput", description = """""", @@ -94,6 +97,7 @@ interface UserApi { } @Operation( + tags = ["user",], summary = "Delete user", operationId = "deleteUser", description = """This can only be done by the logged in user.""", @@ -112,6 +116,7 @@ interface UserApi { } @Operation( + tags = ["user",], summary = "Get user by user name", operationId = "getUserByName", description = """""", @@ -131,6 +136,7 @@ interface UserApi { } @Operation( + tags = ["user",], summary = "Logs user into the system", operationId = "loginUser", description = """""", @@ -149,6 +155,7 @@ interface UserApi { } @Operation( + tags = ["user",], summary = "Logs out current logged in user session", operationId = "logoutUser", description = """""", @@ -166,6 +173,7 @@ interface UserApi { } @Operation( + tags = ["user",], summary = "Updated user", operationId = "updateUser", description = """This can only be done by the logged in user.""",