From 9b91807c6255b990d8ea85ee55f2dbd61e704615 Mon Sep 17 00:00:00 2001 From: Nico Korthout <nico.korthout@camunda.com> Date: Mon, 9 Jan 2023 16:06:42 +0100 Subject: [PATCH 1/2] [Kotlin-Spring] Support multiline descriptions This commit adds support for multiline descriptions for operations in the Kotlin-Spring generator, for both regular API generation (i.e. Controller), as well as interface-only API generation. Multiline descriptions allow us to use rich text representations, e.g. with Markdown. Note that Markdown-formatted descriptions are rendered nicely in Swagger-UI. I imagine that most openapi consumers will be able (or will want to) support Markdown (at some point). The solution for Kotlin-Spring is rather simple, using Raw Strings to contain the `unescapedNotes`. See: https://kotlinlang.org/docs/strings.html#raw-strings Note that specific unescaped strings could cause problems. For example, the string containing three double quotes `"""` would result in compile errors for the generated code. I think this is acceptable. Note that an improvement is possible to use `.trimMargin()` in combination with the pipe symbol `|`, to allow specific margin prefixing. Note that the description is used in escaped form in the JavaDoc. This could be resolved by prefixing every line of the unescapedNotes with a star `*`. For now, I've chosen to implement this the simplest way I could think off. Signed-off-by: Nico Korthout <nico.korthout@camunda.com> --- .../main/resources/kotlin-spring/api.mustache | 2 +- .../kotlin-spring/apiInterface.mustache | 2 +- .../spring/KotlinSpringServerCodegenTest.java | 44 +++++++++++++++++++ ...e4111-multiline-operation-description.yaml | 22 ++++++++++ 4 files changed, 68 insertions(+), 2 deletions(-) create mode 100644 modules/openapi-generator/src/test/resources/3_0/kotlin/issue4111-multiline-operation-description.yaml diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/api.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/api.mustache index a3f5c2f9afe..3369278f313 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/api.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/api.mustache @@ -58,7 +58,7 @@ class {{classname}}Controller({{#serviceInterface}}@Autowired(required = true) v @Operation( summary = "{{{summary}}}", operationId = "{{{operationId}}}", - description = "{{{notes}}}", + description = """{{{unescapedNotes}}}""", responses = [{{#responses}} ApiResponse(responseCode = "{{{code}}}", description = "{{{message}}}"{{#baseType}}, content = [Content(schema = Schema(implementation = {{{baseType}}}::class))]{{/baseType}}){{^-last}},{{/-last}}{{/responses}} ]{{#hasAuthMethods}}, security = [ {{#authMethods}}SecurityRequirement(name = "{{name}}"{{#isOAuth}}, scopes = [ {{#scopes}}"{{scope}}"{{^-last}}, {{/-last}}{{/scopes}} ]{{/isOAuth}}){{^-last}},{{/-last}}{{/authMethods}} ]{{/hasAuthMethods}} 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 98b73961d4d..558ef8b5fea 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/apiInterface.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/apiInterface.mustache @@ -66,7 +66,7 @@ interface {{classname}} { @Operation( summary = "{{{summary}}}", operationId = "{{{operationId}}}", - description = "{{{notes}}}", + description = """{{{unescapedNotes}}}""", responses = [{{#responses}} ApiResponse(responseCode = "{{{code}}}", description = "{{{message}}}"{{#baseType}}, content = [Content(schema = Schema(implementation = {{{baseType}}}::class))]{{/baseType}}){{^-last}},{{/-last}}{{/responses}} ]{{#hasAuthMethods}}, diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java index e414e80e45e..c894c899c2b 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java @@ -414,4 +414,48 @@ public class KotlinSpringServerCodegenTest { "import jakarta.validation.Valid" ); } + + @Test(description = "multi-line descriptions should be supported for operations") + public void multiLineOperationDescription() throws IOException { + testMultiLineOperationDescription(false); + } + + @Test(description = "multi-line descriptions should be supported for operations (interface-only)") + public void multiLineOperationDescriptionInterfaceOnly() throws IOException { + testMultiLineOperationDescription(true); + } + + private static void testMultiLineOperationDescription(final boolean isInterfaceOnly) 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(KotlinSpringServerCodegen.INTERFACE_ONLY, + isInterfaceOnly); + + new DefaultGenerator().opts(new ClientOptInput() + .openAPI(TestUtils.parseSpec("src/test/resources/3_0/kotlin/issue4111-multiline-operation-description.yaml")) + .config(codegen)) + .generate(); + + final String pingApiFileName; + if (isInterfaceOnly) { + pingApiFileName = "PingApi.kt"; + } else { + pingApiFileName = "PingApiController.kt"; + } + assertFileContains( + Paths.get( + outputPath + "/src/main/kotlin/org/openapitools/api/" + pingApiFileName), + "description = \"\"\"# Multi-line descriptions\n" + + "\n" + + "This is an example of a multi-line description.\n" + + "\n" + + "It:\n" + + "- has multiple lines\n" + + "- uses Markdown (CommonMark) for rich text representation\"\"\"" + ); + } } diff --git a/modules/openapi-generator/src/test/resources/3_0/kotlin/issue4111-multiline-operation-description.yaml b/modules/openapi-generator/src/test/resources/3_0/kotlin/issue4111-multiline-operation-description.yaml new file mode 100644 index 00000000000..97e168f170d --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/kotlin/issue4111-multiline-operation-description.yaml @@ -0,0 +1,22 @@ +openapi: "3.0.1" +info: + title: test + version: "1.0" + +paths: + + /ping: + get: + summary: Multi-line descriptions + description: |- + # Multi-line descriptions + + This is an example of a multi-line description. + + It: + - has multiple lines + - uses Markdown (CommonMark) for rich text representation + operationId: ping + responses: + 200: + description: OK -- GitLab From 16dfa95966fccdc9b11f2c3b201691c3efdb1883 Mon Sep 17 00:00:00 2001 From: Nico Korthout <nico.korthout@camunda.com> Date: Tue, 7 Feb 2023 17:27:57 +0100 Subject: [PATCH 2/2] [Kotlin-Spring] Update samples Signed-off-by: Nico Korthout <nico.korthout@camunda.com> --- .../main/kotlin/org/openapitools/api/PetApi.kt | 16 ++++++++-------- .../main/kotlin/org/openapitools/api/StoreApi.kt | 8 ++++---- .../main/kotlin/org/openapitools/api/UserApi.kt | 16 ++++++++-------- .../org/openapitools/api/PetApiController.kt | 16 ++++++++-------- .../org/openapitools/api/StoreApiController.kt | 8 ++++---- .../org/openapitools/api/UserApiController.kt | 16 ++++++++-------- .../org/openapitools/api/PetApiController.kt | 16 ++++++++-------- .../org/openapitools/api/StoreApiController.kt | 8 ++++---- .../org/openapitools/api/UserApiController.kt | 16 ++++++++-------- .../org/openapitools/api/PetApiController.kt | 16 ++++++++-------- .../org/openapitools/api/StoreApiController.kt | 8 ++++---- .../org/openapitools/api/UserApiController.kt | 16 ++++++++-------- 12 files changed, 80 insertions(+), 80 deletions(-) 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 94d24abaf04..48ad9162d9f 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 @@ -36,7 +36,7 @@ interface PetApi { @Operation( summary = "Add a new pet to the store", operationId = "addPet", - description = "", + description = """""", responses = [ ApiResponse(responseCode = "200", description = "successful operation", content = [Content(schema = Schema(implementation = Pet::class))]), ApiResponse(responseCode = "405", description = "Invalid input") @@ -56,7 +56,7 @@ interface PetApi { @Operation( summary = "Deletes a pet", operationId = "deletePet", - description = "", + description = """""", responses = [ ApiResponse(responseCode = "400", description = "Invalid pet value") ], @@ -73,7 +73,7 @@ interface PetApi { @Operation( summary = "Finds Pets by status", operationId = "findPetsByStatus", - description = "Multiple status values can be provided with comma separated strings", + description = """Multiple status values can be provided with comma separated strings""", responses = [ ApiResponse(responseCode = "200", description = "successful operation", content = [Content(schema = Schema(implementation = Pet::class))]), ApiResponse(responseCode = "400", description = "Invalid status value") @@ -92,7 +92,7 @@ interface PetApi { @Operation( summary = "Finds Pets by tags", operationId = "findPetsByTags", - description = "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", + description = """Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.""", responses = [ ApiResponse(responseCode = "200", description = "successful operation", content = [Content(schema = Schema(implementation = Pet::class))]), ApiResponse(responseCode = "400", description = "Invalid tag value") @@ -111,7 +111,7 @@ interface PetApi { @Operation( summary = "Find pet by ID", operationId = "getPetById", - description = "Returns a single pet", + description = """Returns a single pet""", responses = [ ApiResponse(responseCode = "200", description = "successful operation", content = [Content(schema = Schema(implementation = Pet::class))]), ApiResponse(responseCode = "400", description = "Invalid ID supplied"), @@ -131,7 +131,7 @@ interface PetApi { @Operation( summary = "Update an existing pet", operationId = "updatePet", - description = "", + description = """""", responses = [ ApiResponse(responseCode = "200", description = "successful operation", content = [Content(schema = Schema(implementation = Pet::class))]), ApiResponse(responseCode = "400", description = "Invalid ID supplied"), @@ -153,7 +153,7 @@ interface PetApi { @Operation( summary = "Updates a pet in the store with form data", operationId = "updatePetWithForm", - description = "", + description = """""", responses = [ ApiResponse(responseCode = "405", description = "Invalid input") ], @@ -171,7 +171,7 @@ interface PetApi { @Operation( summary = "uploads an image", operationId = "uploadFile", - description = "", + description = """""", responses = [ ApiResponse(responseCode = "200", description = "successful operation", content = [Content(schema = Schema(implementation = ModelApiResponse::class))]) ], 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 f9d7eb2a53f..36e14ef35cb 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 @@ -35,7 +35,7 @@ interface StoreApi { @Operation( 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", + description = """For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors""", responses = [ ApiResponse(responseCode = "400", description = "Invalid ID supplied"), ApiResponse(responseCode = "404", description = "Order not found") @@ -52,7 +52,7 @@ interface StoreApi { @Operation( summary = "Returns pet inventories by status", operationId = "getInventory", - description = "Returns a map of status codes to quantities", + description = """Returns a map of status codes to quantities""", responses = [ ApiResponse(responseCode = "200", description = "successful operation", content = [Content(schema = Schema(implementation = kotlin.collections.Map::class))]) ], @@ -70,7 +70,7 @@ interface StoreApi { @Operation( 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", + description = """For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions""", responses = [ ApiResponse(responseCode = "200", description = "successful operation", content = [Content(schema = Schema(implementation = Order::class))]), ApiResponse(responseCode = "400", description = "Invalid ID supplied"), @@ -89,7 +89,7 @@ interface StoreApi { @Operation( summary = "Place an order for a pet", operationId = "placeOrder", - description = "", + description = """""", responses = [ ApiResponse(responseCode = "200", description = "successful operation", content = [Content(schema = Schema(implementation = Order::class))]), ApiResponse(responseCode = "400", description = "Invalid Order") 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 a3e3e41ab64..e8c8785730a 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 @@ -35,7 +35,7 @@ interface UserApi { @Operation( summary = "Create user", operationId = "createUser", - description = "This can only be done by the logged in user.", + description = """This can only be done by the logged in user.""", responses = [ ApiResponse(responseCode = "200", description = "successful operation") ], @@ -53,7 +53,7 @@ interface UserApi { @Operation( summary = "Creates list of users with given input array", operationId = "createUsersWithArrayInput", - description = "", + description = """""", responses = [ ApiResponse(responseCode = "200", description = "successful operation") ], @@ -71,7 +71,7 @@ interface UserApi { @Operation( summary = "Creates list of users with given input array", operationId = "createUsersWithListInput", - description = "", + description = """""", responses = [ ApiResponse(responseCode = "200", description = "successful operation") ], @@ -89,7 +89,7 @@ interface UserApi { @Operation( summary = "Delete user", operationId = "deleteUser", - description = "This can only be done by the logged in user.", + description = """This can only be done by the logged in user.""", responses = [ ApiResponse(responseCode = "400", description = "Invalid username supplied"), ApiResponse(responseCode = "404", description = "User not found") @@ -107,7 +107,7 @@ interface UserApi { @Operation( summary = "Get user by user name", operationId = "getUserByName", - description = "", + description = """""", responses = [ ApiResponse(responseCode = "200", description = "successful operation", content = [Content(schema = Schema(implementation = User::class))]), ApiResponse(responseCode = "400", description = "Invalid username supplied"), @@ -126,7 +126,7 @@ interface UserApi { @Operation( summary = "Logs user into the system", operationId = "loginUser", - description = "", + description = """""", responses = [ ApiResponse(responseCode = "200", description = "successful operation", content = [Content(schema = Schema(implementation = kotlin.String::class))]), ApiResponse(responseCode = "400", description = "Invalid username/password supplied") @@ -144,7 +144,7 @@ interface UserApi { @Operation( summary = "Logs out current logged in user session", operationId = "logoutUser", - description = "", + description = """""", responses = [ ApiResponse(responseCode = "200", description = "successful operation") ], @@ -161,7 +161,7 @@ interface UserApi { @Operation( summary = "Updated user", operationId = "updateUser", - description = "This can only be done by the logged in user.", + description = """This can only be done by the logged in user.""", responses = [ ApiResponse(responseCode = "400", description = "Invalid user supplied"), ApiResponse(responseCode = "404", description = "User not found") diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/PetApiController.kt b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/PetApiController.kt index b3182cd88f3..6d7b6e53d77 100644 --- a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/PetApiController.kt +++ b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/PetApiController.kt @@ -30,7 +30,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { @Operation( summary = "Add a new pet to the store", operationId = "addPet", - description = "", + description = """""", responses = [ ApiResponse(responseCode = "405", description = "Invalid input") ], security = [ SecurityRequirement(name = "petstore_auth", scopes = [ "write:pets", "read:pets" ]) ] @@ -47,7 +47,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { @Operation( summary = "Deletes a pet", operationId = "deletePet", - description = "", + description = """""", responses = [ ApiResponse(responseCode = "400", description = "Invalid pet value") ], security = [ SecurityRequirement(name = "petstore_auth", scopes = [ "write:pets", "read:pets" ]) ] @@ -63,7 +63,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { @Operation( summary = "Finds Pets by status", operationId = "findPetsByStatus", - description = "Multiple status values can be provided with comma separated strings", + description = """Multiple status values can be provided with comma separated strings""", responses = [ ApiResponse(responseCode = "200", description = "successful operation", content = [Content(schema = Schema(implementation = Pet::class))]), ApiResponse(responseCode = "400", description = "Invalid status value") ], @@ -81,7 +81,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { @Operation( summary = "Finds Pets by tags", operationId = "findPetsByTags", - description = "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", + description = """Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.""", responses = [ ApiResponse(responseCode = "200", description = "successful operation", content = [Content(schema = Schema(implementation = Pet::class))]), ApiResponse(responseCode = "400", description = "Invalid tag value") ], @@ -99,7 +99,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { @Operation( summary = "Find pet by ID", operationId = "getPetById", - description = "Returns a single pet", + description = """Returns a single pet""", responses = [ ApiResponse(responseCode = "200", description = "successful operation", content = [Content(schema = Schema(implementation = Pet::class))]), ApiResponse(responseCode = "400", description = "Invalid ID supplied"), @@ -118,7 +118,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { @Operation( summary = "Update an existing pet", operationId = "updatePet", - description = "", + description = """""", responses = [ ApiResponse(responseCode = "400", description = "Invalid ID supplied"), ApiResponse(responseCode = "404", description = "Pet not found"), @@ -137,7 +137,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { @Operation( summary = "Updates a pet in the store with form data", operationId = "updatePetWithForm", - description = "", + description = """""", responses = [ ApiResponse(responseCode = "405", description = "Invalid input") ], security = [ SecurityRequirement(name = "petstore_auth", scopes = [ "write:pets", "read:pets" ]) ] @@ -154,7 +154,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { @Operation( summary = "uploads an image", operationId = "uploadFile", - description = "", + description = """""", responses = [ ApiResponse(responseCode = "200", description = "successful operation", content = [Content(schema = Schema(implementation = ModelApiResponse::class))]) ], security = [ SecurityRequirement(name = "petstore_auth", scopes = [ "write:pets", "read:pets" ]) ] diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/StoreApiController.kt b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/StoreApiController.kt index 86236a97bef..b0946d1bbf6 100644 --- a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/StoreApiController.kt +++ b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/StoreApiController.kt @@ -29,7 +29,7 @@ class StoreApiController(@Autowired(required = true) val service: StoreApiServic @Operation( 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", + description = """For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors""", responses = [ ApiResponse(responseCode = "400", description = "Invalid ID supplied"), ApiResponse(responseCode = "404", description = "Order not found") ] @@ -45,7 +45,7 @@ class StoreApiController(@Autowired(required = true) val service: StoreApiServic @Operation( summary = "Returns pet inventories by status", operationId = "getInventory", - description = "Returns a map of status codes to quantities", + description = """Returns a map of status codes to quantities""", responses = [ ApiResponse(responseCode = "200", description = "successful operation", content = [Content(schema = Schema(implementation = kotlin.collections.Map::class))]) ], security = [ SecurityRequirement(name = "api_key") ] @@ -62,7 +62,7 @@ class StoreApiController(@Autowired(required = true) val service: StoreApiServic @Operation( 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", + description = """For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions""", responses = [ ApiResponse(responseCode = "200", description = "successful operation", content = [Content(schema = Schema(implementation = Order::class))]), ApiResponse(responseCode = "400", description = "Invalid ID supplied"), @@ -80,7 +80,7 @@ class StoreApiController(@Autowired(required = true) val service: StoreApiServic @Operation( summary = "Place an order for a pet", operationId = "placeOrder", - description = "", + description = """""", responses = [ ApiResponse(responseCode = "200", description = "successful operation", content = [Content(schema = Schema(implementation = Order::class))]), ApiResponse(responseCode = "400", description = "Invalid Order") ] diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/UserApiController.kt b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/UserApiController.kt index 5f6f44c3b78..f0aad1cbbe1 100644 --- a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/UserApiController.kt +++ b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/UserApiController.kt @@ -29,7 +29,7 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) @Operation( summary = "Create user", operationId = "createUser", - description = "This can only be done by the logged in user.", + description = """This can only be done by the logged in user.""", responses = [ ApiResponse(responseCode = "200", description = "successful operation") ] ) @@ -44,7 +44,7 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) @Operation( summary = "Creates list of users with given input array", operationId = "createUsersWithArrayInput", - description = "", + description = """""", responses = [ ApiResponse(responseCode = "200", description = "successful operation") ] ) @@ -59,7 +59,7 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) @Operation( summary = "Creates list of users with given input array", operationId = "createUsersWithListInput", - description = "", + description = """""", responses = [ ApiResponse(responseCode = "200", description = "successful operation") ] ) @@ -74,7 +74,7 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) @Operation( summary = "Delete user", operationId = "deleteUser", - description = "This can only be done by the logged in user.", + description = """This can only be done by the logged in user.""", responses = [ ApiResponse(responseCode = "400", description = "Invalid username supplied"), ApiResponse(responseCode = "404", description = "User not found") ] @@ -90,7 +90,7 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) @Operation( summary = "Get user by user name", operationId = "getUserByName", - description = "", + description = """""", responses = [ ApiResponse(responseCode = "200", description = "successful operation", content = [Content(schema = Schema(implementation = User::class))]), ApiResponse(responseCode = "400", description = "Invalid username supplied"), @@ -108,7 +108,7 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) @Operation( summary = "Logs user into the system", operationId = "loginUser", - description = "", + description = """""", responses = [ ApiResponse(responseCode = "200", description = "successful operation", content = [Content(schema = Schema(implementation = kotlin.String::class))]), ApiResponse(responseCode = "400", description = "Invalid username/password supplied") ] @@ -125,7 +125,7 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) @Operation( summary = "Logs out current logged in user session", operationId = "logoutUser", - description = "", + description = """""", responses = [ ApiResponse(responseCode = "200", description = "successful operation") ] ) @@ -140,7 +140,7 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) @Operation( summary = "Updated user", operationId = "updateUser", - description = "This can only be done by the logged in user.", + description = """This can only be done by the logged in user.""", responses = [ ApiResponse(responseCode = "400", description = "Invalid user supplied"), ApiResponse(responseCode = "404", description = "User not found") ] diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApiController.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApiController.kt index 25d58e24f62..867ba7a9341 100644 --- a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApiController.kt +++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApiController.kt @@ -31,7 +31,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { @Operation( summary = "Add a new pet to the store", operationId = "addPet", - description = "", + description = """""", responses = [ ApiResponse(responseCode = "405", description = "Invalid input") ], security = [ SecurityRequirement(name = "petstore_auth", scopes = [ "write:pets", "read:pets" ]) ] @@ -48,7 +48,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { @Operation( summary = "Deletes a pet", operationId = "deletePet", - description = "", + description = """""", responses = [ ApiResponse(responseCode = "400", description = "Invalid pet value") ], security = [ SecurityRequirement(name = "petstore_auth", scopes = [ "write:pets", "read:pets" ]) ] @@ -64,7 +64,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { @Operation( summary = "Finds Pets by status", operationId = "findPetsByStatus", - description = "Multiple status values can be provided with comma separated strings", + description = """Multiple status values can be provided with comma separated strings""", responses = [ ApiResponse(responseCode = "200", description = "successful operation", content = [Content(schema = Schema(implementation = Pet::class))]), ApiResponse(responseCode = "400", description = "Invalid status value") ], @@ -82,7 +82,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { @Operation( summary = "Finds Pets by tags", operationId = "findPetsByTags", - description = "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", + description = """Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.""", responses = [ ApiResponse(responseCode = "200", description = "successful operation", content = [Content(schema = Schema(implementation = Pet::class))]), ApiResponse(responseCode = "400", description = "Invalid tag value") ], @@ -100,7 +100,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { @Operation( summary = "Find pet by ID", operationId = "getPetById", - description = "Returns a single pet", + description = """Returns a single pet""", responses = [ ApiResponse(responseCode = "200", description = "successful operation", content = [Content(schema = Schema(implementation = Pet::class))]), ApiResponse(responseCode = "400", description = "Invalid ID supplied"), @@ -119,7 +119,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { @Operation( summary = "Update an existing pet", operationId = "updatePet", - description = "", + description = """""", responses = [ ApiResponse(responseCode = "400", description = "Invalid ID supplied"), ApiResponse(responseCode = "404", description = "Pet not found"), @@ -138,7 +138,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { @Operation( summary = "Updates a pet in the store with form data", operationId = "updatePetWithForm", - description = "", + description = """""", responses = [ ApiResponse(responseCode = "405", description = "Invalid input") ], security = [ SecurityRequirement(name = "petstore_auth", scopes = [ "write:pets", "read:pets" ]) ] @@ -155,7 +155,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { @Operation( summary = "uploads an image", operationId = "uploadFile", - description = "", + description = """""", responses = [ ApiResponse(responseCode = "200", description = "successful operation", content = [Content(schema = Schema(implementation = ModelApiResponse::class))]) ], security = [ SecurityRequirement(name = "petstore_auth", scopes = [ "write:pets", "read:pets" ]) ] diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/StoreApiController.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/StoreApiController.kt index dd2fd67ac2d..299c0cc6ed2 100644 --- a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/StoreApiController.kt +++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/StoreApiController.kt @@ -30,7 +30,7 @@ class StoreApiController(@Autowired(required = true) val service: StoreApiServic @Operation( 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", + description = """For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors""", responses = [ ApiResponse(responseCode = "400", description = "Invalid ID supplied"), ApiResponse(responseCode = "404", description = "Order not found") ] @@ -46,7 +46,7 @@ class StoreApiController(@Autowired(required = true) val service: StoreApiServic @Operation( summary = "Returns pet inventories by status", operationId = "getInventory", - description = "Returns a map of status codes to quantities", + description = """Returns a map of status codes to quantities""", responses = [ ApiResponse(responseCode = "200", description = "successful operation", content = [Content(schema = Schema(implementation = kotlin.collections.Map::class))]) ], security = [ SecurityRequirement(name = "api_key") ] @@ -63,7 +63,7 @@ class StoreApiController(@Autowired(required = true) val service: StoreApiServic @Operation( 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", + description = """For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions""", responses = [ ApiResponse(responseCode = "200", description = "successful operation", content = [Content(schema = Schema(implementation = Order::class))]), ApiResponse(responseCode = "400", description = "Invalid ID supplied"), @@ -81,7 +81,7 @@ class StoreApiController(@Autowired(required = true) val service: StoreApiServic @Operation( summary = "Place an order for a pet", operationId = "placeOrder", - description = "", + description = """""", responses = [ ApiResponse(responseCode = "200", description = "successful operation", content = [Content(schema = Schema(implementation = Order::class))]), ApiResponse(responseCode = "400", description = "Invalid Order") ] diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApiController.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApiController.kt index 6ffe38144d0..ed81d4a9edb 100644 --- a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApiController.kt +++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApiController.kt @@ -30,7 +30,7 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) @Operation( summary = "Create user", operationId = "createUser", - description = "This can only be done by the logged in user.", + description = """This can only be done by the logged in user.""", responses = [ ApiResponse(responseCode = "200", description = "successful operation") ] ) @@ -45,7 +45,7 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) @Operation( summary = "Creates list of users with given input array", operationId = "createUsersWithArrayInput", - description = "", + description = """""", responses = [ ApiResponse(responseCode = "200", description = "successful operation") ] ) @@ -60,7 +60,7 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) @Operation( summary = "Creates list of users with given input array", operationId = "createUsersWithListInput", - description = "", + description = """""", responses = [ ApiResponse(responseCode = "200", description = "successful operation") ] ) @@ -75,7 +75,7 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) @Operation( summary = "Delete user", operationId = "deleteUser", - description = "This can only be done by the logged in user.", + description = """This can only be done by the logged in user.""", responses = [ ApiResponse(responseCode = "400", description = "Invalid username supplied"), ApiResponse(responseCode = "404", description = "User not found") ] @@ -91,7 +91,7 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) @Operation( summary = "Get user by user name", operationId = "getUserByName", - description = "", + description = """""", responses = [ ApiResponse(responseCode = "200", description = "successful operation", content = [Content(schema = Schema(implementation = User::class))]), ApiResponse(responseCode = "400", description = "Invalid username supplied"), @@ -109,7 +109,7 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) @Operation( summary = "Logs user into the system", operationId = "loginUser", - description = "", + description = """""", responses = [ ApiResponse(responseCode = "200", description = "successful operation", content = [Content(schema = Schema(implementation = kotlin.String::class))]), ApiResponse(responseCode = "400", description = "Invalid username/password supplied") ] @@ -126,7 +126,7 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) @Operation( summary = "Logs out current logged in user session", operationId = "logoutUser", - description = "", + description = """""", responses = [ ApiResponse(responseCode = "200", description = "successful operation") ] ) @@ -141,7 +141,7 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) @Operation( summary = "Updated user", operationId = "updateUser", - description = "This can only be done by the logged in user.", + description = """This can only be done by the logged in user.""", responses = [ ApiResponse(responseCode = "400", description = "Invalid user supplied"), ApiResponse(responseCode = "404", description = "User not found") ] diff --git a/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/api/PetApiController.kt b/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/api/PetApiController.kt index b3182cd88f3..6d7b6e53d77 100644 --- a/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/api/PetApiController.kt +++ b/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/api/PetApiController.kt @@ -30,7 +30,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { @Operation( summary = "Add a new pet to the store", operationId = "addPet", - description = "", + description = """""", responses = [ ApiResponse(responseCode = "405", description = "Invalid input") ], security = [ SecurityRequirement(name = "petstore_auth", scopes = [ "write:pets", "read:pets" ]) ] @@ -47,7 +47,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { @Operation( summary = "Deletes a pet", operationId = "deletePet", - description = "", + description = """""", responses = [ ApiResponse(responseCode = "400", description = "Invalid pet value") ], security = [ SecurityRequirement(name = "petstore_auth", scopes = [ "write:pets", "read:pets" ]) ] @@ -63,7 +63,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { @Operation( summary = "Finds Pets by status", operationId = "findPetsByStatus", - description = "Multiple status values can be provided with comma separated strings", + description = """Multiple status values can be provided with comma separated strings""", responses = [ ApiResponse(responseCode = "200", description = "successful operation", content = [Content(schema = Schema(implementation = Pet::class))]), ApiResponse(responseCode = "400", description = "Invalid status value") ], @@ -81,7 +81,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { @Operation( summary = "Finds Pets by tags", operationId = "findPetsByTags", - description = "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", + description = """Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.""", responses = [ ApiResponse(responseCode = "200", description = "successful operation", content = [Content(schema = Schema(implementation = Pet::class))]), ApiResponse(responseCode = "400", description = "Invalid tag value") ], @@ -99,7 +99,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { @Operation( summary = "Find pet by ID", operationId = "getPetById", - description = "Returns a single pet", + description = """Returns a single pet""", responses = [ ApiResponse(responseCode = "200", description = "successful operation", content = [Content(schema = Schema(implementation = Pet::class))]), ApiResponse(responseCode = "400", description = "Invalid ID supplied"), @@ -118,7 +118,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { @Operation( summary = "Update an existing pet", operationId = "updatePet", - description = "", + description = """""", responses = [ ApiResponse(responseCode = "400", description = "Invalid ID supplied"), ApiResponse(responseCode = "404", description = "Pet not found"), @@ -137,7 +137,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { @Operation( summary = "Updates a pet in the store with form data", operationId = "updatePetWithForm", - description = "", + description = """""", responses = [ ApiResponse(responseCode = "405", description = "Invalid input") ], security = [ SecurityRequirement(name = "petstore_auth", scopes = [ "write:pets", "read:pets" ]) ] @@ -154,7 +154,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { @Operation( summary = "uploads an image", operationId = "uploadFile", - description = "", + description = """""", responses = [ ApiResponse(responseCode = "200", description = "successful operation", content = [Content(schema = Schema(implementation = ModelApiResponse::class))]) ], security = [ SecurityRequirement(name = "petstore_auth", scopes = [ "write:pets", "read:pets" ]) ] diff --git a/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/api/StoreApiController.kt b/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/api/StoreApiController.kt index 86236a97bef..b0946d1bbf6 100644 --- a/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/api/StoreApiController.kt +++ b/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/api/StoreApiController.kt @@ -29,7 +29,7 @@ class StoreApiController(@Autowired(required = true) val service: StoreApiServic @Operation( 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", + description = """For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors""", responses = [ ApiResponse(responseCode = "400", description = "Invalid ID supplied"), ApiResponse(responseCode = "404", description = "Order not found") ] @@ -45,7 +45,7 @@ class StoreApiController(@Autowired(required = true) val service: StoreApiServic @Operation( summary = "Returns pet inventories by status", operationId = "getInventory", - description = "Returns a map of status codes to quantities", + description = """Returns a map of status codes to quantities""", responses = [ ApiResponse(responseCode = "200", description = "successful operation", content = [Content(schema = Schema(implementation = kotlin.collections.Map::class))]) ], security = [ SecurityRequirement(name = "api_key") ] @@ -62,7 +62,7 @@ class StoreApiController(@Autowired(required = true) val service: StoreApiServic @Operation( 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", + description = """For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions""", responses = [ ApiResponse(responseCode = "200", description = "successful operation", content = [Content(schema = Schema(implementation = Order::class))]), ApiResponse(responseCode = "400", description = "Invalid ID supplied"), @@ -80,7 +80,7 @@ class StoreApiController(@Autowired(required = true) val service: StoreApiServic @Operation( summary = "Place an order for a pet", operationId = "placeOrder", - description = "", + description = """""", responses = [ ApiResponse(responseCode = "200", description = "successful operation", content = [Content(schema = Schema(implementation = Order::class))]), ApiResponse(responseCode = "400", description = "Invalid Order") ] diff --git a/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/api/UserApiController.kt b/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/api/UserApiController.kt index 5f6f44c3b78..f0aad1cbbe1 100644 --- a/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/api/UserApiController.kt +++ b/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/api/UserApiController.kt @@ -29,7 +29,7 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) @Operation( summary = "Create user", operationId = "createUser", - description = "This can only be done by the logged in user.", + description = """This can only be done by the logged in user.""", responses = [ ApiResponse(responseCode = "200", description = "successful operation") ] ) @@ -44,7 +44,7 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) @Operation( summary = "Creates list of users with given input array", operationId = "createUsersWithArrayInput", - description = "", + description = """""", responses = [ ApiResponse(responseCode = "200", description = "successful operation") ] ) @@ -59,7 +59,7 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) @Operation( summary = "Creates list of users with given input array", operationId = "createUsersWithListInput", - description = "", + description = """""", responses = [ ApiResponse(responseCode = "200", description = "successful operation") ] ) @@ -74,7 +74,7 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) @Operation( summary = "Delete user", operationId = "deleteUser", - description = "This can only be done by the logged in user.", + description = """This can only be done by the logged in user.""", responses = [ ApiResponse(responseCode = "400", description = "Invalid username supplied"), ApiResponse(responseCode = "404", description = "User not found") ] @@ -90,7 +90,7 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) @Operation( summary = "Get user by user name", operationId = "getUserByName", - description = "", + description = """""", responses = [ ApiResponse(responseCode = "200", description = "successful operation", content = [Content(schema = Schema(implementation = User::class))]), ApiResponse(responseCode = "400", description = "Invalid username supplied"), @@ -108,7 +108,7 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) @Operation( summary = "Logs user into the system", operationId = "loginUser", - description = "", + description = """""", responses = [ ApiResponse(responseCode = "200", description = "successful operation", content = [Content(schema = Schema(implementation = kotlin.String::class))]), ApiResponse(responseCode = "400", description = "Invalid username/password supplied") ] @@ -125,7 +125,7 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) @Operation( summary = "Logs out current logged in user session", operationId = "logoutUser", - description = "", + description = """""", responses = [ ApiResponse(responseCode = "200", description = "successful operation") ] ) @@ -140,7 +140,7 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) @Operation( summary = "Updated user", operationId = "updateUser", - description = "This can only be done by the logged in user.", + description = """This can only be done by the logged in user.""", responses = [ ApiResponse(responseCode = "400", description = "Invalid user supplied"), ApiResponse(responseCode = "404", description = "User not found") ] -- GitLab