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 78dd8f8743c..3d547ad1382 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/api.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/api.mustache @@ -67,7 +67,7 @@ class {{classname}}Controller({{#serviceInterface}}@Autowired(required = true) v operationId = "{{{operationId}}}", description = """{{{unescapedNotes}}}""", responses = [{{#responses}} - ApiResponse(responseCode = "{{{code}}}", description = "{{{message}}}"{{#baseType}}, content = [Content(schema = Schema(implementation = {{{baseType}}}::class))]{{/baseType}}){{^-last}},{{/-last}}{{/responses}} ]{{#hasAuthMethods}}, + ApiResponse(responseCode = "{{{code}}}", description = "{{{message}}}"{{#baseType}}, content = [Content({{#isArray}}array = ArraySchema({{/isArray}}schema = Schema(implementation = {{{baseType}}}::class)){{#isArray}}){{/isArray}}]{{/baseType}}){{^-last}},{{/-last}}{{/responses}} ]{{#hasAuthMethods}}, security = [ {{#authMethods}}SecurityRequirement(name = "{{name}}"{{#isOAuth}}, scopes = [ {{#scopes}}"{{scope}}"{{^-last}}, {{/-last}}{{/scopes}} ]{{/isOAuth}}){{^-last}},{{/-last}}{{/authMethods}} ]{{/hasAuthMethods}} ){{/swagger2AnnotationLibrary}}{{#swagger1AnnotationLibrary}} @ApiOperation( 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 bc4a32f53d7..be1a5d800e0 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/apiInterface.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/apiInterface.mustache @@ -77,7 +77,7 @@ interface {{classname}} { operationId = "{{{operationId}}}", description = """{{{unescapedNotes}}}""", responses = [{{#responses}} - ApiResponse(responseCode = "{{{code}}}", description = "{{{message}}}"{{#baseType}}, content = [Content(schema = Schema(implementation = {{{baseType}}}::class))]{{/baseType}}){{^-last}},{{/-last}}{{/responses}} + ApiResponse(responseCode = "{{{code}}}", description = "{{{message}}}"{{#baseType}}, content = [Content({{#isArray}}array = ArraySchema({{/isArray}}schema = Schema(implementation = {{{baseType}}}::class)){{#isArray}}){{/isArray}}]{{/baseType}}){{^-last}},{{/-last}}{{/responses}} ]{{#hasAuthMethods}}, security = [ {{#authMethods}}SecurityRequirement(name = "{{name}}"{{#isOAuth}}, scopes = [ {{#scopes}}"{{scope}}"{{^-last}}, {{/-last}}{{/scopes}} ]{{/isOAuth}}){{^-last}},{{/-last}}{{/authMethods}} ]{{/hasAuthMethods}} ){{/swagger2AnnotationLibrary}}{{#swagger1AnnotationLibrary}} diff --git a/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/api/PetApiController.kt b/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/api/PetApiController.kt index 32b885c7ffd..8c62773506b 100644 --- a/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/api/PetApiController.kt +++ b/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/api/PetApiController.kt @@ -74,7 +74,7 @@ class PetApiController() { operationId = "findPetsByStatus", 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 = "200", description = "successful operation", content = [Content(array = ArraySchema(schema = Schema(implementation = Pet::class)))]), ApiResponse(responseCode = "400", description = "Invalid status value") ], security = [ SecurityRequirement(name = "petstore_auth", scopes = [ "read:pets" ]) ] ) @@ -92,7 +92,7 @@ class PetApiController() { operationId = "findPetsByTags", 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 = "200", description = "successful operation", content = [Content(array = ArraySchema(schema = Schema(implementation = Pet::class)))]), ApiResponse(responseCode = "400", description = "Invalid tag value") ], security = [ SecurityRequirement(name = "petstore_auth", scopes = [ "read:pets" ]) ] ) 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 7ef1423b9da..9e61db28ad3 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 @@ -82,7 +82,7 @@ interface PetApi { operationId = "findPetsByStatus", 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 = "200", description = "successful operation", content = [Content(array = ArraySchema(schema = Schema(implementation = Pet::class)))]), ApiResponse(responseCode = "400", description = "Invalid status value") ], security = [ SecurityRequirement(name = "petstore_auth", scopes = [ "read:pets" ]) ] @@ -101,7 +101,7 @@ interface PetApi { operationId = "findPetsByTags", 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 = "200", description = "successful operation", content = [Content(array = ArraySchema(schema = Schema(implementation = Pet::class)))]), ApiResponse(responseCode = "400", description = "Invalid tag value") ], security = [ SecurityRequirement(name = "petstore_auth", scopes = [ "read:pets" ]) ] 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 0cf82b64c04..898f02a0e15 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 @@ -72,7 +72,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { operationId = "findPetsByStatus", 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 = "200", description = "successful operation", content = [Content(array = ArraySchema(schema = Schema(implementation = Pet::class)))]), ApiResponse(responseCode = "400", description = "Invalid status value") ], security = [ SecurityRequirement(name = "petstore_auth", scopes = [ "write:pets", "read:pets" ]) ] ) @@ -90,7 +90,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { operationId = "findPetsByTags", 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 = "200", description = "successful operation", content = [Content(array = ArraySchema(schema = Schema(implementation = Pet::class)))]), ApiResponse(responseCode = "400", description = "Invalid tag value") ], 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/PetApiController.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApiController.kt index 047e4caafe9..0046eff8dbe 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 @@ -73,7 +73,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { operationId = "findPetsByStatus", 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 = "200", description = "successful operation", content = [Content(array = ArraySchema(schema = Schema(implementation = Pet::class)))]), ApiResponse(responseCode = "400", description = "Invalid status value") ], security = [ SecurityRequirement(name = "petstore_auth", scopes = [ "write:pets", "read:pets" ]) ] ) @@ -91,7 +91,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { operationId = "findPetsByTags", 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 = "200", description = "successful operation", content = [Content(array = ArraySchema(schema = Schema(implementation = Pet::class)))]), ApiResponse(responseCode = "400", description = "Invalid tag value") ], 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/PetApiController.kt b/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/api/PetApiController.kt index 0cf82b64c04..898f02a0e15 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 @@ -72,7 +72,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { operationId = "findPetsByStatus", 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 = "200", description = "successful operation", content = [Content(array = ArraySchema(schema = Schema(implementation = Pet::class)))]), ApiResponse(responseCode = "400", description = "Invalid status value") ], security = [ SecurityRequirement(name = "petstore_auth", scopes = [ "write:pets", "read:pets" ]) ] ) @@ -90,7 +90,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { operationId = "findPetsByTags", 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 = "200", description = "successful operation", content = [Content(array = ArraySchema(schema = Schema(implementation = Pet::class)))]), ApiResponse(responseCode = "400", description = "Invalid tag value") ], security = [ SecurityRequirement(name = "petstore_auth", scopes = [ "write:pets", "read:pets" ]) ] )