[Kotlin-Spring] Support multiline descriptions (#14406)

* [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>

* [Kotlin-Spring] Update samples

Signed-off-by: Nico Korthout <nico.korthout@camunda.com>

---------

Signed-off-by: Nico Korthout <nico.korthout@camunda.com>
This commit is contained in:
Nico Korthout
2023-02-07 18:25:12 +01:00
committed by GitHub
parent 515abf8c68
commit 26eb1dc805
16 changed files with 148 additions and 82 deletions

View File

@@ -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}}

View File

@@ -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}},

View File

@@ -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\"\"\""
);
}
}

View File

@@ -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

View File

@@ -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))])
],

View File

@@ -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")

View File

@@ -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")

View File

@@ -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" ]) ]

View File

@@ -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") ]

View File

@@ -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") ]

View File

@@ -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" ]) ]

View File

@@ -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") ]

View File

@@ -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") ]

View File

@@ -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" ]) ]

View File

@@ -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") ]

View File

@@ -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") ]