diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/apiDelegate.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/apiDelegate.mustache index 47bd58a4818..82e39150609 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/apiDelegate.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/apiDelegate.mustache @@ -6,7 +6,6 @@ import org.springframework.http.HttpStatus import org.springframework.http.MediaType import org.springframework.http.ResponseEntity import org.springframework.web.context.request.NativeWebRequest -import org.springframework.core.io.Resource {{#appendRequestToHandler}} import org.springframework.http.server.reactive.ServerHttpRequest {{/appendRequestToHandler}} @@ -33,7 +32,7 @@ interface {{classname}}Delegate { /** * @see {{classname}}#{{operationId}} */ - {{#reactive}}{{^isArray}}suspend {{/isArray}}{{/reactive}}fun {{operationId}}({{#allParams}}{{{paramName}}}: {{^isFile}}{{^reactive}}{{>optionalDataType}}{{/reactive}}{{#reactive}}{{^isArray}}{{>optionalDataType}}{{/isArray}}{{#isArray}}{{#isBodyParam}}Flow<{{{baseType}}}>{{/isBodyParam}}{{^isBodyParam}}{{>optionalDataType}}{{/isBodyParam}}{{/isArray}}{{/reactive}}{{/isFile}}{{#isFile}}Resource?{{/isFile}}{{^-last}}, + {{#reactive}}{{^isArray}}suspend {{/isArray}}{{/reactive}}fun {{operationId}}({{#allParams}}{{{paramName}}}: {{^reactive}}{{>optionalDataType}}{{/reactive}}{{#reactive}}{{^isArray}}{{>optionalDataType}}{{/isArray}}{{#isArray}}{{#isBodyParam}}Flow<{{{baseType}}}>{{/isBodyParam}}{{^isBodyParam}}{{>optionalDataType}}{{/isBodyParam}}{{/isArray}}{{/reactive}}{{^-last}}, {{/-last}}{{/allParams}}): {{#responseWrapper}}{{.}}<{{/responseWrapper}}ResponseEntity<{{>returnTypes}}>{{#responseWrapper}}>{{/responseWrapper}}{{^skipDefaultDelegateInterface}} { {{>methodBody}} }{{/skipDefaultDelegateInterface}} diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/optionalDataType.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/optionalDataType.mustache index 7c026fa826f..a6b059b8632 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/optionalDataType.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/optionalDataType.mustache @@ -1 +1 @@ -{{#required}}{{{dataType}}}{{/required}}{{^required}}{{#defaultValue}}{{{dataType}}}{{/defaultValue}}{{^defaultValue}}{{{dataType}}}?{{/defaultValue}}{{/required}} \ No newline at end of file +{{^isFile}}{{{dataType}}}{{^required}}{{^defaultValue}}?{{/defaultValue}}{{/required}}{{/isFile}}{{#isFile}}{{#isArray}}Array<{{/isArray}}org.springframework.web.multipart.MultipartFile{{#isArray}}>{{/isArray}}{{^isArray}}{{^required}}?{{/required}}{{/isArray}}{{/isFile}} \ No newline at end of file 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 dc2a699c2b1..46fb7fae80e 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 @@ -92,14 +92,14 @@ public class KotlinSpringServerCodegenTest { codegen.setLibrary("spring-cloud"); new DefaultGenerator().opts(new ClientOptInput() - .openAPI(TestUtils.parseSpec("src/test/resources/3_0/kotlin/feat13488_use_kotlinSpring_with_springCloud.yaml")) - .config(codegen)) - .generate(); + .openAPI(TestUtils.parseSpec("src/test/resources/3_0/kotlin/feat13488_use_kotlinSpring_with_springCloud.yaml")) + .config(codegen)) + .generate(); // Check that the @RequestMapping annotation is not generated in the Api file assertFileNotContains( - Paths.get(output + "/src/main/kotlin/org/openapitools/api/TestV1Api.kt"), - "@RequestMapping(\"\\${api.base-path" + Paths.get(output + "/src/main/kotlin/org/openapitools/api/TestV1Api.kt"), + "@RequestMapping(\"\\${api.base-path" ); } @@ -290,18 +290,18 @@ public class KotlinSpringServerCodegenTest { codegen.additionalProperties().put(KotlinSpringServerCodegen.USE_TAGS, true); List files = new DefaultGenerator() - .opts( - new ClientOptInput() - .openAPI(TestUtils.parseSpec("src/test/resources/3_0/kotlin/issue5497-use-tags-kotlin.yaml")) - .config(codegen) - ) - .generate(); + .opts( + new ClientOptInput() + .openAPI(TestUtils.parseSpec("src/test/resources/3_0/kotlin/issue5497-use-tags-kotlin.yaml")) + .config(codegen) + ) + .generate(); Assertions.assertThat(files).contains( - new File(output, "src/main/kotlin/org/openapitools/api/TestV1ApiController.kt"), - new File(output, "src/main/kotlin/org/openapitools/api/TestV1ApiDelegate.kt"), - new File(output, "src/main/kotlin/org/openapitools/api/TestV2ApiController.kt"), - new File(output, "src/main/kotlin/org/openapitools/api/TestV2ApiDelegate.kt") + new File(output, "src/main/kotlin/org/openapitools/api/TestV1ApiController.kt"), + new File(output, "src/main/kotlin/org/openapitools/api/TestV1ApiDelegate.kt"), + new File(output, "src/main/kotlin/org/openapitools/api/TestV2ApiController.kt"), + new File(output, "src/main/kotlin/org/openapitools/api/TestV2ApiDelegate.kt") ); } @@ -315,51 +315,51 @@ public class KotlinSpringServerCodegenTest { codegen.additionalProperties().put(KotlinSpringServerCodegen.USE_TAGS, true); List files = new DefaultGenerator() - .opts( - new ClientOptInput() - .openAPI(TestUtils.parseSpec("src/test/resources/3_0/kotlin/issue7325-use-delegate-reactive-tags-kotlin.yaml")) - .config(codegen) - ) - .generate(); + .opts( + new ClientOptInput() + .openAPI(TestUtils.parseSpec("src/test/resources/3_0/kotlin/issue7325-use-delegate-reactive-tags-kotlin.yaml")) + .config(codegen) + ) + .generate(); Assertions.assertThat(files).contains( - new File(output, "src/main/kotlin/org/openapitools/api/TestV1Api.kt"), - new File(output, "src/main/kotlin/org/openapitools/api/TestV1ApiController.kt"), - new File(output, "src/main/kotlin/org/openapitools/api/TestV1ApiDelegate.kt"), - new File(output, "src/main/kotlin/org/openapitools/api/TestV2Api.kt"), - new File(output, "src/main/kotlin/org/openapitools/api/TestV2ApiController.kt"), - new File(output, "src/main/kotlin/org/openapitools/api/TestV2ApiDelegate.kt"), - new File(output, "src/main/kotlin/org/openapitools/api/TestV3Api.kt"), - new File(output, "src/main/kotlin/org/openapitools/api/TestV3ApiController.kt"), - new File(output, "src/main/kotlin/org/openapitools/api/TestV3ApiDelegate.kt") + new File(output, "src/main/kotlin/org/openapitools/api/TestV1Api.kt"), + new File(output, "src/main/kotlin/org/openapitools/api/TestV1ApiController.kt"), + new File(output, "src/main/kotlin/org/openapitools/api/TestV1ApiDelegate.kt"), + new File(output, "src/main/kotlin/org/openapitools/api/TestV2Api.kt"), + new File(output, "src/main/kotlin/org/openapitools/api/TestV2ApiController.kt"), + new File(output, "src/main/kotlin/org/openapitools/api/TestV2ApiDelegate.kt"), + new File(output, "src/main/kotlin/org/openapitools/api/TestV3Api.kt"), + new File(output, "src/main/kotlin/org/openapitools/api/TestV3ApiController.kt"), + new File(output, "src/main/kotlin/org/openapitools/api/TestV3ApiDelegate.kt") ); assertFileContains(Paths.get(output + "/src/main/kotlin/org/openapitools/api/TestV1Api.kt"), - "suspend fun"); + "suspend fun"); assertFileNotContains(Paths.get(output + "/src/main/kotlin/org/openapitools/api/TestV1Api.kt"), - "exchange"); + "exchange"); assertFileContains(Paths.get(output + "/src/main/kotlin/org/openapitools/api/TestV1ApiDelegate.kt"), - "suspend fun"); + "suspend fun"); assertFileNotContains(Paths.get(output + "/src/main/kotlin/org/openapitools/api/TestV1ApiDelegate.kt"), - "ApiUtil"); + "ApiUtil"); assertFileContains(Paths.get(output + "/src/main/kotlin/org/openapitools/api/TestV2Api.kt"), - "import kotlinx.coroutines.flow.Flow", "ResponseEntity>"); + "import kotlinx.coroutines.flow.Flow", "ResponseEntity>"); assertFileNotContains(Paths.get(output + "/src/main/kotlin/org/openapitools/api/TestV2Api.kt"), - "exchange"); + "exchange"); assertFileContains(Paths.get(output + "/src/main/kotlin/org/openapitools/api/TestV2ApiDelegate.kt"), - "import kotlinx.coroutines.flow.Flow", "ResponseEntity>"); + "import kotlinx.coroutines.flow.Flow", "ResponseEntity>"); assertFileNotContains(Paths.get(output + "/src/main/kotlin/org/openapitools/api/TestV2ApiDelegate.kt"), - "suspend fun", "ApiUtil"); + "suspend fun", "ApiUtil"); assertFileContains(Paths.get(output + "/src/main/kotlin/org/openapitools/api/TestV3Api.kt"), - "import kotlinx.coroutines.flow.Flow", "requestBody: Flow"); + "import kotlinx.coroutines.flow.Flow", "requestBody: Flow"); assertFileNotContains(Paths.get(output + "/src/main/kotlin/org/openapitools/api/TestV3Api.kt"), - "exchange"); + "exchange"); assertFileContains(Paths.get(output + "/src/main/kotlin/org/openapitools/api/TestV3ApiDelegate.kt"), - "import kotlinx.coroutines.flow.Flow", "suspend fun", "requestBody: Flow"); + "import kotlinx.coroutines.flow.Flow", "suspend fun", "requestBody: Flow"); assertFileNotContains(Paths.get(output + "/src/main/kotlin/org/openapitools/api/TestV3ApiDelegate.kt"), - "ApiUtil"); + "ApiUtil"); } @Test @@ -400,7 +400,7 @@ public class KotlinSpringServerCodegenTest { String outputPath = output.getAbsolutePath().replace('\\', '/'); OpenAPI openAPI = new OpenAPIParser() - .readLocation("src/test/resources/3_0/objectQueryParam.yaml", null, new ParseOptions()).getOpenAPI(); + .readLocation("src/test/resources/3_0/objectQueryParam.yaml", null, new ParseOptions()).getOpenAPI(); KotlinSpringServerCodegen codegen = new KotlinSpringServerCodegen(); codegen.setOutputDir(output.getAbsolutePath()); @@ -430,7 +430,7 @@ public class KotlinSpringServerCodegenTest { String outputPath = output.getAbsolutePath().replace('\\', '/'); OpenAPI openAPI = new OpenAPIParser() - .readLocation("src/test/resources/3_0/issue_3248.yaml", null, new ParseOptions()).getOpenAPI(); + .readLocation("src/test/resources/3_0/issue_3248.yaml", null, new ParseOptions()).getOpenAPI(); KotlinSpringServerCodegen codegen = new KotlinSpringServerCodegen(); codegen.setOutputDir(output.getAbsolutePath()); @@ -467,7 +467,7 @@ public class KotlinSpringServerCodegenTest { String outputPath = output.getAbsolutePath().replace('\\', '/'); OpenAPI openAPI = new OpenAPIParser() - .readLocation("src/test/resources/3_0/issue_2053.yaml", null, new ParseOptions()).getOpenAPI(); + .readLocation("src/test/resources/3_0/issue_2053.yaml", null, new ParseOptions()).getOpenAPI(); KotlinSpringServerCodegen codegen = new KotlinSpringServerCodegen(); codegen.setOutputDir(output.getAbsolutePath()); @@ -487,12 +487,12 @@ public class KotlinSpringServerCodegenTest { generator.opts(input).generate(); assertFileContains( - Paths.get(outputPath + "/src/main/kotlin/org/openapitools/api/ElephantsApiController.kt"), - "@org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE)" + Paths.get(outputPath + "/src/main/kotlin/org/openapitools/api/ElephantsApiController.kt"), + "@org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE)" ); assertFileContains( - Paths.get(outputPath + "/src/main/kotlin/org/openapitools/api/ZebrasApiController.kt"), - "@org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE_TIME)" + Paths.get(outputPath + "/src/main/kotlin/org/openapitools/api/ZebrasApiController.kt"), + "@org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE_TIME)" ); } @@ -507,13 +507,13 @@ public class KotlinSpringServerCodegenTest { codegen.additionalProperties().put(KotlinSpringServerCodegen.BEAN_QUALIFIERS, true); new DefaultGenerator().opts(new ClientOptInput() - .openAPI(TestUtils.parseSpec("src/test/resources/3_0/kotlin/bean-qualifiers.yaml")) - .config(codegen)) - .generate(); + .openAPI(TestUtils.parseSpec("src/test/resources/3_0/kotlin/bean-qualifiers.yaml")) + .config(codegen)) + .generate(); assertFileContains( - Paths.get(outputPath + "/src/main/kotlin/org/openapitools/api/PingApiController.kt"), - "@RestController(\"org.openapitools.api.PingApiController\")" + Paths.get(outputPath + "/src/main/kotlin/org/openapitools/api/PingApiController.kt"), + "@RestController(\"org.openapitools.api.PingApiController\")" ); } @@ -529,13 +529,13 @@ public class KotlinSpringServerCodegenTest { codegen.additionalProperties().put(KotlinSpringServerCodegen.SKIP_DEFAULT_INTERFACE, true); new DefaultGenerator().opts(new ClientOptInput() - .openAPI(TestUtils.parseSpec("src/test/resources/3_0/kotlin/skip-default-interface.yaml")) - .config(codegen)) - .generate(); + .openAPI(TestUtils.parseSpec("src/test/resources/3_0/kotlin/skip-default-interface.yaml")) + .config(codegen)) + .generate(); assertFileNotContains( - Paths.get(outputPath + "/src/main/kotlin/org/openapitools/api/PingApi.kt"), - "return " + Paths.get(outputPath + "/src/main/kotlin/org/openapitools/api/PingApi.kt"), + "return " ); } @@ -551,13 +551,13 @@ public class KotlinSpringServerCodegenTest { codegen.additionalProperties().put(KotlinSpringServerCodegen.SKIP_DEFAULT_INTERFACE, true); new DefaultGenerator().opts(new ClientOptInput() - .openAPI(TestUtils.parseSpec("src/test/resources/3_0/kotlin/petstore-with-fake-endpoints-for-testing-with-cookie.yaml")) - .config(codegen)) - .generate(); + .openAPI(TestUtils.parseSpec("src/test/resources/3_0/kotlin/petstore-with-fake-endpoints-for-testing-with-cookie.yaml")) + .config(codegen)) + .generate(); assertFileContains( - Paths.get(outputPath + "/src/main/kotlin/org/openapitools/api/FakeApi.kt"), - "@CookieValue" + Paths.get(outputPath + "/src/main/kotlin/org/openapitools/api/FakeApi.kt"), + "@CookieValue" ); } @@ -571,13 +571,13 @@ public class KotlinSpringServerCodegenTest { codegen.setOutputDir(output.getAbsolutePath()); new DefaultGenerator().opts(new ClientOptInput() - .openAPI(TestUtils.parseSpec("src/test/resources/3_0/kotlin/petstore-with-fake-endpoints-for-testing-with-cookie.yaml")) - .config(codegen)) - .generate(); + .openAPI(TestUtils.parseSpec("src/test/resources/3_0/kotlin/petstore-with-fake-endpoints-for-testing-with-cookie.yaml")) + .config(codegen)) + .generate(); assertFileContains( - Paths.get(outputPath + "/src/main/kotlin/org/openapitools/api/FakeApiController.kt"), - "@CookieValue" + Paths.get(outputPath + "/src/main/kotlin/org/openapitools/api/FakeApiController.kt"), + "@CookieValue" ); } @@ -592,21 +592,21 @@ public class KotlinSpringServerCodegenTest { codegen.additionalProperties().put(KotlinSpringServerCodegen.USE_SPRING_BOOT3, true); new DefaultGenerator().opts(new ClientOptInput() - .openAPI(TestUtils.parseSpec("src/test/resources/3_0/kotlin/feat13578_use_springboot3_jakarta_extension.yaml")) - .config(codegen)) - .generate(); + .openAPI(TestUtils.parseSpec("src/test/resources/3_0/kotlin/feat13578_use_springboot3_jakarta_extension.yaml")) + .config(codegen)) + .generate(); assertFileContains( - Paths.get(outputPath + "/src/main/kotlin/org/openapitools/api/ApiUtil.kt"), - "import jakarta.servlet.http.HttpServletResponse" + Paths.get(outputPath + "/src/main/kotlin/org/openapitools/api/ApiUtil.kt"), + "import jakarta.servlet.http.HttpServletResponse" ); assertFileContains( - Paths.get(outputPath + "/src/main/kotlin/org/openapitools/api/Exceptions.kt"), - "import jakarta.validation.ConstraintViolationException" + Paths.get(outputPath + "/src/main/kotlin/org/openapitools/api/Exceptions.kt"), + "import jakarta.validation.ConstraintViolationException" ); assertFileContains( - Paths.get(outputPath + "/src/main/kotlin/org/openapitools/api/PingApiController.kt"), - "import jakarta.validation.Valid" + Paths.get(outputPath + "/src/main/kotlin/org/openapitools/api/PingApiController.kt"), + "import jakarta.validation.Valid" ); } @@ -628,12 +628,12 @@ public class KotlinSpringServerCodegenTest { KotlinSpringServerCodegen codegen = new KotlinSpringServerCodegen(); codegen.setOutputDir(output.getAbsolutePath()); codegen.additionalProperties().put(KotlinSpringServerCodegen.INTERFACE_ONLY, - isInterfaceOnly); + isInterfaceOnly); new DefaultGenerator().opts(new ClientOptInput() - .openAPI(TestUtils.parseSpec("src/test/resources/3_0/kotlin/issue4111-multiline-operation-description.yaml")) - .config(codegen)) - .generate(); + .openAPI(TestUtils.parseSpec("src/test/resources/3_0/kotlin/issue4111-multiline-operation-description.yaml")) + .config(codegen)) + .generate(); final String pingApiFileName; if (isInterfaceOnly) { @@ -642,15 +642,15 @@ public class KotlinSpringServerCodegenTest { 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\"\"\"" + 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\"\"\"" ); } @@ -664,25 +664,25 @@ public class KotlinSpringServerCodegenTest { codegen.setOutputDir(output.getAbsolutePath()); new DefaultGenerator().opts(new ClientOptInput() - .openAPI(TestUtils.parseSpec("src/test/resources/3_0/kotlin/issue3596-use-correct-get-annotation-target.yaml")) - .config(codegen)) - .generate(); + .openAPI(TestUtils.parseSpec("src/test/resources/3_0/kotlin/issue3596-use-correct-get-annotation-target.yaml")) + .config(codegen)) + .generate(); assertFileNotContains( - Paths.get(outputPath + "/src/main/kotlin/org/openapitools/model/Animal.kt"), - "@Schema(example = \"null\", description = \"\")" + Paths.get(outputPath + "/src/main/kotlin/org/openapitools/model/Animal.kt"), + "@Schema(example = \"null\", description = \"\")" ); assertFileContains( - Paths.get(outputPath + "/src/main/kotlin/org/openapitools/model/Animal.kt"), - "@get:Schema(example = \"null\", description = \"\")" + Paths.get(outputPath + "/src/main/kotlin/org/openapitools/model/Animal.kt"), + "@get:Schema(example = \"null\", description = \"\")" ); assertFileNotContains( - Paths.get(outputPath + "/src/main/kotlin/org/openapitools/model/Animal.kt"), - "@Schema(example = \"null\", requiredMode = Schema.RequiredMode.REQUIRED, description = \"\")" + Paths.get(outputPath + "/src/main/kotlin/org/openapitools/model/Animal.kt"), + "@Schema(example = \"null\", requiredMode = Schema.RequiredMode.REQUIRED, description = \"\")" ); assertFileContains( - Paths.get(outputPath + "/src/main/kotlin/org/openapitools/model/Animal.kt"), - "@get:Schema(example = \"null\", requiredMode = Schema.RequiredMode.REQUIRED, description = \"\")" + Paths.get(outputPath + "/src/main/kotlin/org/openapitools/model/Animal.kt"), + "@get:Schema(example = \"null\", requiredMode = Schema.RequiredMode.REQUIRED, description = \"\")" ); } @@ -698,25 +698,25 @@ public class KotlinSpringServerCodegenTest { codegen.additionalProperties().put(DOCUMENTATION_PROVIDER, DocumentationProvider.SPRINGFOX.toCliOptValue()); new DefaultGenerator().opts(new ClientOptInput() - .openAPI(TestUtils.parseSpec("src/test/resources/3_0/kotlin/issue3596-use-correct-get-annotation-target.yaml")) - .config(codegen)) - .generate(); + .openAPI(TestUtils.parseSpec("src/test/resources/3_0/kotlin/issue3596-use-correct-get-annotation-target.yaml")) + .config(codegen)) + .generate(); assertFileNotContains( - Paths.get(outputPath + "/src/main/kotlin/org/openapitools/model/Animal.kt"), - "@ApiModelProperty(example = \"null\", value = \"\")" + Paths.get(outputPath + "/src/main/kotlin/org/openapitools/model/Animal.kt"), + "@ApiModelProperty(example = \"null\", value = \"\")" ); assertFileContains( - Paths.get(outputPath + "/src/main/kotlin/org/openapitools/model/Animal.kt"), - "@get:ApiModelProperty(example = \"null\", value = \"\")" + Paths.get(outputPath + "/src/main/kotlin/org/openapitools/model/Animal.kt"), + "@get:ApiModelProperty(example = \"null\", value = \"\")" ); assertFileNotContains( - Paths.get(outputPath + "/src/main/kotlin/org/openapitools/model/Animal.kt"), - "@ApiModelProperty(example = \"null\", required = true, value = \"\")" + Paths.get(outputPath + "/src/main/kotlin/org/openapitools/model/Animal.kt"), + "@ApiModelProperty(example = \"null\", required = true, value = \"\")" ); assertFileContains( - Paths.get(outputPath + "/src/main/kotlin/org/openapitools/model/Animal.kt"), - "@get:ApiModelProperty(example = \"null\", required = true, value = \"\")" + Paths.get(outputPath + "/src/main/kotlin/org/openapitools/model/Animal.kt"), + "@get:ApiModelProperty(example = \"null\", required = true, value = \"\")" ); } @@ -726,7 +726,7 @@ public class KotlinSpringServerCodegenTest { output.deleteOnExit(); OpenAPI openAPI = new OpenAPIParser() - .readLocation("src/test/resources/bugs/issue_13932.yml", null, new ParseOptions()).getOpenAPI(); + .readLocation("src/test/resources/bugs/issue_13932.yml", null, new ParseOptions()).getOpenAPI(); KotlinSpringServerCodegen codegen = new KotlinSpringServerCodegen(); codegen.setOutputDir(output.getAbsolutePath()); codegen.additionalProperties().put(KotlinSpringServerCodegen.INTERFACE_ONLY, "true"); @@ -735,19 +735,88 @@ public class KotlinSpringServerCodegenTest { codegen.additionalProperties().put(CodegenConstants.API_PACKAGE, "xyz.controller"); ClientOptInput input = new ClientOptInput() - .openAPI(openAPI) - .config(codegen); + .openAPI(openAPI) + .config(codegen); DefaultGenerator generator = new DefaultGenerator(); Map files = generator.opts(input).generate().stream() - .collect(Collectors.toMap(File::getName, Function.identity())); + .collect(Collectors.toMap(File::getName, Function.identity())); assertFileContains( - Paths.get(files.get("AddApi.kt").getAbsolutePath()), - "@Min(2)" + Paths.get(files.get("AddApi.kt").getAbsolutePath()), + "@Min(2)" ); } + @Test + public void givenMultipartFormArray_whenGenerateDelegateAndService_thenParameterIsCreatedAsListOfMultipartFile() throws IOException { + File output = Files.createTempDirectory("test").toFile().getCanonicalFile(); + output.deleteOnExit(); + String outputPath = output.getAbsolutePath().replace('\\', '/'); + + final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/kotlin/petstore-with-tags.yaml"); + final KotlinSpringServerCodegen codegen = new KotlinSpringServerCodegen(); + codegen.setOpenAPI(openAPI); + codegen.setOutputDir(output.getAbsolutePath()); + codegen.setDelegatePattern(true); + codegen.setServiceInterface(true); + + ClientOptInput input = new ClientOptInput(); + input.openAPI(openAPI); + input.config(codegen); + + DefaultGenerator generator = new DefaultGenerator(); + + generator.setGeneratorPropertyDefault(CodegenConstants.MODELS, "false"); + generator.setGeneratorPropertyDefault(CodegenConstants.MODEL_TESTS, "false"); + generator.setGeneratorPropertyDefault(CodegenConstants.MODEL_DOCS, "false"); + generator.setGeneratorPropertyDefault(CodegenConstants.APIS, "true"); + generator.setGeneratorPropertyDefault(CodegenConstants.SUPPORTING_FILES, "false"); + + generator.opts(input).generate(); + + Path delegateFile = Paths.get(outputPath + "/src/main/kotlin/org/openapitools/api/PetApiDelegate.kt"); + assertFileContains(delegateFile, "additionalMetadata: kotlin.String?"); + assertFileContains(delegateFile, "images: Array"); + + Path controllerFile = Paths.get(outputPath + "/src/main/kotlin/org/openapitools/api/PetApi.kt"); + assertFileContains(controllerFile, "images: Array"); + + + Path serviceFile = Paths.get(outputPath + "/src/main/kotlin/org/openapitools/api/PetApiService.kt"); + assertFileContains(serviceFile, "images: Array"); + } + + @Test + public void givenOctetStreamResponseType_whenGenerateServer_thenReturnTypeIsResource() throws IOException { + File output = Files.createTempDirectory("test").toFile().getCanonicalFile(); + output.deleteOnExit(); + String outputPath = output.getAbsolutePath().replace('\\', '/'); + + final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/kotlin/petstore-with-tags.yaml"); + final KotlinSpringServerCodegen codegen = new KotlinSpringServerCodegen(); + codegen.setOpenAPI(openAPI); + codegen.setOutputDir(output.getAbsolutePath()); + + ClientOptInput input = new ClientOptInput(); + input.openAPI(openAPI); + input.config(codegen); + + DefaultGenerator generator = new DefaultGenerator(); + + generator.setGeneratorPropertyDefault(CodegenConstants.MODELS, "false"); + generator.setGeneratorPropertyDefault(CodegenConstants.MODEL_TESTS, "false"); + generator.setGeneratorPropertyDefault(CodegenConstants.MODEL_DOCS, "false"); + generator.setGeneratorPropertyDefault(CodegenConstants.APIS, "true"); + generator.setGeneratorPropertyDefault(CodegenConstants.SUPPORTING_FILES, "false"); + + generator.opts(input).generate(); + + Path outputFilepath = Paths.get(outputPath + "/src/main/kotlin/org/openapitools/api/PetApiController.kt"); + + assertFileContains(outputFilepath, "): ResponseEntity"); + } + @Test public void givenMultipartForm_whenGenerateReactiveServer_thenParameterAreCreatedAsRequestPart() throws IOException { File output = Files.createTempDirectory("test").toFile().getCanonicalFile(); @@ -776,9 +845,9 @@ public class KotlinSpringServerCodegenTest { Path outputFilepath = Paths.get(outputPath + "/src/main/kotlin/org/openapitools/api/PetApiController.kt"); assertFileContains(outputFilepath, - "@Parameter(description = \"Additional data to pass to server\") @RequestParam(value = \"additionalMetadata\", required = false) additionalMetadata: kotlin.String?"); + "@Parameter(description = \"Additional data to pass to server\") @RequestParam(value = \"additionalMetadata\", required = false) additionalMetadata: kotlin.String?"); assertFileContains(outputFilepath, - "@Parameter(description = \"image to upload\") @Valid @RequestPart(\"image\", required = false) image: org.springframework.core.io.Resource?"); + "@Parameter(description = \"image to upload\") @Valid @RequestPart(\"image\", required = false) image: org.springframework.web.multipart.MultipartFile"); } diff --git a/modules/openapi-generator/src/test/resources/3_0/kotlin/petstore-with-tags.yaml b/modules/openapi-generator/src/test/resources/3_0/kotlin/petstore-with-tags.yaml index 1f33f481042..062ab023e2d 100644 --- a/modules/openapi-generator/src/test/resources/3_0/kotlin/petstore-with-tags.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/kotlin/petstore-with-tags.yaml @@ -8,19 +8,19 @@ info: url: http://www.apache.org/licenses/LICENSE-2.0.html version: 1.0.0 servers: -- url: http://petstore.swagger.io/v2 + - url: http://petstore.swagger.io/v2 tags: -- name: pet - description: Everything about your Pets -- name: store - description: Access to Petstore orders -- name: user - description: Operations about user + - name: pet + description: Everything about your Pets + - name: store + description: Access to Petstore orders + - name: user + description: Operations about user paths: /pet: put: tags: - - pet tag + - pet tag summary: Update an existing pet operationId: updatePet requestBody: @@ -36,21 +36,21 @@ paths: responses: 400: description: Invalid ID supplied - content: {} + content: { } 404: description: Pet not found - content: {} + content: { } 405: description: Validation exception - content: {} + content: { } security: - - petstore_auth: - - write:pets - - read:pets + - petstore_auth: + - write:pets + - read:pets x-codegen-request-body-name: body post: tags: - - pet tag + - pet tag summary: Add a new pet to the store operationId: addPet requestBody: @@ -66,35 +66,35 @@ paths: responses: 405: description: Invalid input - content: {} + content: { } security: - - petstore_auth: - - write:pets - - read:pets + - petstore_auth: + - write:pets + - read:pets x-codegen-request-body-name: body /pet/findByStatus: get: tags: - - pet tag + - pet tag summary: Finds Pets by status description: Multiple status values can be provided with comma separated strings operationId: findPetsByStatus parameters: - - name: status - in: query - description: Status values that need to be considered for filter - required: true - style: form - explode: false - schema: - type: array - items: - type: string - default: available - enum: - - available - - pending - - sold + - name: status + in: query + description: Status values that need to be considered for filter + required: true + style: form + explode: false + schema: + type: array + items: + type: string + default: available + enum: + - available + - pending + - sold responses: 200: description: successful operation @@ -111,31 +111,31 @@ paths: $ref: '#/components/schemas/Pet' 400: description: Invalid status value - content: {} + content: { } security: - - petstore_auth: - - write:pets - - read:pets + - petstore_auth: + - write:pets + - read:pets x-spring-paginated: true /pet/findByTags: get: tags: - - pet tag + - pet tag summary: Finds Pets by tags description: Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. operationId: findPetsByTags parameters: - - name: tags - in: query - description: Tags to filter by - required: true - style: form - explode: false - schema: - type: array - items: - type: string + - name: tags + in: query + description: Tags to filter by + required: true + style: form + explode: false + schema: + type: array + items: + type: string responses: 200: description: successful operation @@ -152,28 +152,28 @@ paths: $ref: '#/components/schemas/Pet' 400: description: Invalid tag value - content: {} + content: { } deprecated: true security: - - petstore_auth: - - write:pets - - read:pets + - petstore_auth: + - write:pets + - read:pets x-spring-paginated: true /pet/{petId}: get: tags: - - pet tag + - pet tag summary: Find pet by ID description: Returns a single pet operationId: getPetById parameters: - - name: petId - in: path - description: ID of pet to return - required: true - schema: - type: integer - format: int64 + - name: petId + in: path + description: ID of pet to return + required: true + schema: + type: integer + format: int64 responses: 200: description: successful operation @@ -186,25 +186,25 @@ paths: $ref: '#/components/schemas/Pet' 400: description: Invalid ID supplied - content: {} + content: { } 404: description: Pet not found - content: {} + content: { } security: - - api_key: [] + - api_key: [ ] post: tags: - - pet tag + - pet tag summary: Updates a pet in the store with form data operationId: updatePetWithForm parameters: - - name: petId - in: path - description: ID of pet that needs to be updated - required: true - schema: - type: integer - format: int64 + - name: petId + in: path + description: ID of pet that needs to be updated + required: true + schema: + type: integer + format: int64 requestBody: content: application/x-www-form-urlencoded: @@ -219,50 +219,50 @@ paths: responses: 405: description: Invalid input - content: {} + content: { } security: - - petstore_auth: - - write:pets - - read:pets + - petstore_auth: + - write:pets + - read:pets delete: tags: - - pet tag + - pet tag summary: Deletes a pet operationId: deletePet parameters: - - name: api_key - in: header - schema: - type: string - - name: petId - in: path - description: Pet id to delete - required: true - schema: - type: integer - format: int64 + - name: api_key + in: header + schema: + type: string + - name: petId + in: path + description: Pet id to delete + required: true + schema: + type: integer + format: int64 responses: 400: description: Invalid pet value - content: {} + content: { } security: - - petstore_auth: - - write:pets - - read:pets + - petstore_auth: + - write:pets + - read:pets /pet/{petId}/uploadImage: post: tags: - - pet tag + - pet tag summary: uploads an image operationId: uploadFile parameters: - - name: petId - in: path - description: ID of pet to update - required: true - schema: - type: integer - format: int64 + - name: petId + in: path + description: ID of pet to update + required: true + schema: + type: integer + format: int64 requestBody: content: multipart/form-data: @@ -285,13 +285,80 @@ paths: schema: $ref: '#/components/schemas/ApiResponse' security: - - petstore_auth: - - write:pets - - read:pets + - petstore_auth: + - write:pets + - read:pets + /pet/{petId}/uploadMultipleImage: + post: + tags: + - pet tag + summary: uploads multiple images + operationId: uploadMultipleFile + parameters: + - name: petId + in: path + description: ID of pet to update + required: true + schema: + type: integer + format: int64 + requestBody: + content: + multipart/form-data: + schema: + properties: + additionalMetadata: + type: string + description: Additional data to pass to server + required: false + images: + type: array + items: + type: string + description: image to upload + format: binary + required: true + responses: + 200: + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + security: + - petstore_auth: + - write:pets + - read:pets + /pet/{petId}/getImage: + get: + tags: + - pet tag + summary: Get an image + operationId: getImage + parameters: + - name: petId + in: path + description: ID of pet to get image + required: true + schema: + type: integer + format: int64 + responses: + 200: + description: successful operation + content: + application/octet-stream: + schema: + type: string + format: binary + security: + - petstore_auth: + - write:pets + - read:pets /store/inventory: get: tags: - - store tag + - store tag summary: Returns pet inventories by status description: Returns a map of status codes to quantities operationId: getInventory @@ -306,11 +373,11 @@ paths: type: integer format: int32 security: - - api_key: [] + - api_key: [ ] /store/order: post: tags: - - store tag + - store tag summary: Place an order for a pet operationId: placeOrder requestBody: @@ -332,26 +399,26 @@ paths: $ref: '#/components/schemas/Order' 400: description: Invalid Order - content: {} + content: { } x-codegen-request-body-name: body /store/order/{orderId}: get: tags: - - store tag + - store tag summary: Find purchase order by ID description: For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions operationId: getOrderById parameters: - - name: orderId - in: path - description: ID of pet that needs to be fetched - required: true - schema: - maximum: 5 - minimum: 1 - type: integer - format: int64 + - name: orderId + in: path + description: ID of pet that needs to be fetched + required: true + schema: + maximum: 5 + minimum: 1 + type: integer + format: int64 responses: 200: description: successful operation @@ -364,35 +431,35 @@ paths: $ref: '#/components/schemas/Order' 400: description: Invalid ID supplied - content: {} + content: { } 404: description: Order not found - content: {} + content: { } delete: tags: - - store tag + - store tag summary: Delete purchase order by ID description: For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors operationId: deleteOrder parameters: - - name: orderId - in: path - description: ID of the order that needs to be deleted - required: true - schema: - type: string + - name: orderId + in: path + description: ID of the order that needs to be deleted + required: true + schema: + type: string responses: 400: description: Invalid ID supplied - content: {} + content: { } 404: description: Order not found - content: {} + content: { } /user: post: tags: - - user tag + - user tag summary: Create user description: This can only be done by the logged in user. operationId: createUser @@ -406,12 +473,12 @@ paths: responses: default: description: successful operation - content: {} + content: { } x-codegen-request-body-name: body /user/createWithArray: post: tags: - - user tag + - user tag summary: Creates list of users with given input array operationId: createUsersWithArrayInput requestBody: @@ -426,12 +493,12 @@ paths: responses: default: description: successful operation - content: {} + content: { } x-codegen-request-body-name: body /user/createWithList: post: tags: - - user tag + - user tag summary: Creates list of users with given input array operationId: createUsersWithListInput requestBody: @@ -446,27 +513,27 @@ paths: responses: default: description: successful operation - content: {} + content: { } x-codegen-request-body-name: body /user/login: get: tags: - - user tag + - user tag summary: Logs user into the system operationId: loginUser parameters: - - name: username - in: query - description: The user name for login - required: true - schema: - type: string - - name: password - in: query - description: The password for login in clear text - required: true - schema: - type: string + - name: username + in: query + description: The user name for login + required: true + schema: + type: string + - name: password + in: query + description: The password for login in clear text + required: true + schema: + type: string responses: 200: description: successful operation @@ -490,39 +557,39 @@ paths: type: string 400: description: Invalid username/password supplied - content: {} + content: { } /user/logout: get: tags: - - user tag + - user tag summary: Logs out current logged in user session operationId: logoutUser responses: default: description: successful operation - content: {} + content: { } options: tags: - - user tag + - user tag summary: logoutUserOptions operationId: logoutUserOptions responses: default: description: endpoint configuration response - content: {} + content: { } /user/{username}: get: tags: - - user tag + - user tag summary: Get user by user name operationId: getUserByName parameters: - - name: username - in: path - description: The name that needs to be fetched. Use user1 for testing. - required: true - schema: - type: string + - name: username + in: path + description: The name that needs to be fetched. Use user1 for testing. + required: true + schema: + type: string responses: 200: description: successful operation @@ -535,23 +602,23 @@ paths: $ref: '#/components/schemas/User' 400: description: Invalid username supplied - content: {} + content: { } 404: description: User not found - content: {} + content: { } put: tags: - - user tag + - user tag summary: Updated user description: This can only be done by the logged in user. operationId: updateUser parameters: - - name: username - in: path - description: name that need to be deleted - required: true - schema: - type: string + - name: username + in: path + description: name that need to be deleted + required: true + schema: + type: string requestBody: description: Updated user object content: @@ -562,31 +629,31 @@ paths: responses: 400: description: Invalid user supplied - content: {} + content: { } 404: description: User not found - content: {} + content: { } x-codegen-request-body-name: body delete: tags: - - user tag + - user tag summary: Delete user description: This can only be done by the logged in user. operationId: deleteUser parameters: - - name: username - in: path - description: The name that needs to be deleted - required: true - schema: - type: string + - name: username + in: path + description: The name that needs to be deleted + required: true + schema: + type: string responses: 400: description: Invalid username supplied - content: {} + content: { } 404: description: User not found - content: {} + content: { } components: schemas: Order: @@ -609,9 +676,9 @@ components: type: string description: Order Status enum: - - placed - - approved - - delivered + - placed + - approved + - delivered complete: type: boolean default: false @@ -671,8 +738,8 @@ components: Pet: title: a Pet required: - - name - - photoUrls + - name + - photoUrls type: object properties: id: @@ -701,9 +768,9 @@ components: type: string description: pet status in the store enum: - - available - - pending - - sold + - available + - pending + - sold description: A pet for sale in the pet store xml: name: Pet diff --git a/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/api/PetApi.kt b/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/api/PetApi.kt index 0ec25b5a574..552f9120495 100644 --- a/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/api/PetApi.kt +++ b/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/api/PetApi.kt @@ -110,7 +110,7 @@ interface PetApi { produces = ["application/json"], consumes = ["multipart/form-data"] ) - fun uploadFile( @PathVariable("petId") petId: kotlin.Long, @RequestParam(value = "additionalMetadata", required = false) additionalMetadata: kotlin.String? , @Valid @RequestPart("file", required = false) file: org.springframework.core.io.Resource?): ResponseEntity { + fun uploadFile( @PathVariable("petId") petId: kotlin.Long, @RequestParam(value = "additionalMetadata", required = false) additionalMetadata: kotlin.String? , @Valid @RequestPart("file", required = false) file: org.springframework.web.multipart.MultipartFile?): ResponseEntity { return ResponseEntity(HttpStatus.NOT_IMPLEMENTED) } } 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 81bd74f4213..fc44c9d500a 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 @@ -176,7 +176,7 @@ class PetApiController() { produces = ["application/json"], consumes = ["multipart/form-data"] ) - fun uploadFile(@Parameter(description = "ID of pet to update", required = true) @PathVariable("petId") petId: kotlin.Long,@Parameter(description = "Additional data to pass to server") @RequestParam(value = "additionalMetadata", required = false) additionalMetadata: kotlin.String? ,@Parameter(description = "file to upload") @Valid @RequestPart("file", required = false) file: org.springframework.core.io.Resource?): ResponseEntity { + fun uploadFile(@Parameter(description = "ID of pet to update", required = true) @PathVariable("petId") petId: kotlin.Long,@Parameter(description = "Additional data to pass to server") @RequestParam(value = "additionalMetadata", required = false) additionalMetadata: kotlin.String? ,@Parameter(description = "file to upload") @Valid @RequestPart("file", required = false) file: org.springframework.web.multipart.MultipartFile?): ResponseEntity { return ResponseEntity(HttpStatus.NOT_IMPLEMENTED) } } diff --git a/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/api/PetApiController.kt b/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/api/PetApiController.kt index 14f6f0ae6d8..41c0da8045e 100644 --- a/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/api/PetApiController.kt +++ b/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/api/PetApiController.kt @@ -106,7 +106,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { produces = ["application/json"], consumes = ["multipart/form-data"] ) - fun uploadFile( @PathVariable("petId") petId: kotlin.Long, @RequestParam(value = "additionalMetadata", required = false) additionalMetadata: kotlin.String? , @Valid @RequestPart("file", required = false) file: org.springframework.core.io.Resource?): ResponseEntity { + fun uploadFile( @PathVariable("petId") petId: kotlin.Long, @RequestParam(value = "additionalMetadata", required = false) additionalMetadata: kotlin.String? , @Valid @RequestPart("file", required = false) file: org.springframework.web.multipart.MultipartFile?): ResponseEntity { return ResponseEntity(service.uploadFile(petId, additionalMetadata, file), HttpStatus.valueOf(200)) } } diff --git a/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/api/PetApiService.kt b/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/api/PetApiService.kt index 04f76e4963e..54df94484e4 100644 --- a/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/api/PetApiService.kt +++ b/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/api/PetApiService.kt @@ -99,5 +99,5 @@ interface PetApiService { * @return successful operation (status code 200) * @see PetApi#uploadFile */ - fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: org.springframework.core.io.Resource?): ModelApiResponse + fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: org.springframework.web.multipart.MultipartFile?): ModelApiResponse } diff --git a/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt b/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt index 35dffecfac0..a81dbcbdb0a 100644 --- a/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt +++ b/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt @@ -34,7 +34,7 @@ class PetApiServiceImpl : PetApiService { TODO("Implement me") } - override fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: org.springframework.core.io.Resource?): ModelApiResponse { + override fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: org.springframework.web.multipart.MultipartFile?): ModelApiResponse { TODO("Implement me") } } diff --git a/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/api/PetApi.kt b/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/api/PetApi.kt index cd26fb897ed..95ae87a12c0 100644 --- a/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/api/PetApi.kt +++ b/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/api/PetApi.kt @@ -199,7 +199,7 @@ interface PetApi { produces = ["application/json"], consumes = ["multipart/form-data"] ) - fun uploadFile(@Parameter(description = "ID of pet to update", required = true) @PathVariable("petId") petId: kotlin.Long,@Parameter(description = "Additional data to pass to server") @RequestParam(value = "additionalMetadata", required = false) additionalMetadata: kotlin.String? ,@Parameter(description = "file to upload") @Valid @RequestPart("file", required = false) file: org.springframework.core.io.Resource?): ResponseEntity { + fun uploadFile(@Parameter(description = "ID of pet to update", required = true) @PathVariable("petId") petId: kotlin.Long,@Parameter(description = "Additional data to pass to server") @RequestParam(value = "additionalMetadata", required = false) additionalMetadata: kotlin.String? ,@Parameter(description = "file to upload") @Valid @RequestPart("file", required = false) file: org.springframework.web.multipart.MultipartFile?): ResponseEntity { return getDelegate().uploadFile(petId, additionalMetadata, file) } } diff --git a/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/api/PetApiDelegate.kt b/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/api/PetApiDelegate.kt index 8ecb4c46bc5..8a8b79e04af 100644 --- a/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/api/PetApiDelegate.kt +++ b/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/api/PetApiDelegate.kt @@ -6,7 +6,6 @@ import org.springframework.http.HttpStatus import org.springframework.http.MediaType import org.springframework.http.ResponseEntity import org.springframework.web.context.request.NativeWebRequest -import org.springframework.core.io.Resource import java.util.Optional @@ -69,6 +68,6 @@ interface PetApiDelegate { */ fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, - file: Resource?): ResponseEntity + file: org.springframework.web.multipart.MultipartFile?): ResponseEntity } diff --git a/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/api/StoreApiDelegate.kt b/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/api/StoreApiDelegate.kt index 3bcb84444b9..cde9ef1d288 100644 --- a/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/api/StoreApiDelegate.kt +++ b/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/api/StoreApiDelegate.kt @@ -5,7 +5,6 @@ import org.springframework.http.HttpStatus import org.springframework.http.MediaType import org.springframework.http.ResponseEntity import org.springframework.web.context.request.NativeWebRequest -import org.springframework.core.io.Resource import java.util.Optional diff --git a/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/api/UserApiDelegate.kt b/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/api/UserApiDelegate.kt index 4cdbf737cf5..f6cd7e70b52 100644 --- a/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/api/UserApiDelegate.kt +++ b/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/api/UserApiDelegate.kt @@ -5,7 +5,6 @@ import org.springframework.http.HttpStatus import org.springframework.http.MediaType import org.springframework.http.ResponseEntity import org.springframework.web.context.request.NativeWebRequest -import org.springframework.core.io.Resource import java.util.Optional 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 708df6fda21..6f19103223c 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 @@ -198,7 +198,7 @@ interface PetApi { produces = ["application/json"], consumes = ["multipart/form-data"] ) - fun uploadFile(@Parameter(description = "ID of pet to update", required = true) @PathVariable("petId") petId: kotlin.Long,@Parameter(description = "Additional data to pass to server") @RequestParam(value = "additionalMetadata", required = false) additionalMetadata: kotlin.String? ,@Parameter(description = "file to upload") @Valid @RequestPart("file", required = false) file: org.springframework.core.io.Resource?): ResponseEntity { + fun uploadFile(@Parameter(description = "ID of pet to update", required = true) @PathVariable("petId") petId: kotlin.Long,@Parameter(description = "Additional data to pass to server") @RequestParam(value = "additionalMetadata", required = false) additionalMetadata: kotlin.String? ,@Parameter(description = "file to upload") @Valid @RequestPart("file", required = false) file: org.springframework.web.multipart.MultipartFile?): ResponseEntity { return getDelegate().uploadFile(petId, additionalMetadata, file) } } diff --git a/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/api/PetApiDelegate.kt b/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/api/PetApiDelegate.kt index 7a173551ccb..ea2fd10a006 100644 --- a/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/api/PetApiDelegate.kt +++ b/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/api/PetApiDelegate.kt @@ -6,7 +6,6 @@ import org.springframework.http.HttpStatus import org.springframework.http.MediaType import org.springframework.http.ResponseEntity import org.springframework.web.context.request.NativeWebRequest -import org.springframework.core.io.Resource import org.springframework.http.server.reactive.ServerHttpRequest import java.util.Optional @@ -151,7 +150,7 @@ interface PetApiDelegate { */ fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, - file: Resource?): ResponseEntity { + file: org.springframework.web.multipart.MultipartFile?): ResponseEntity { getRequest().ifPresent { request -> for (mediaType in MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { diff --git a/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/api/StoreApiDelegate.kt b/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/api/StoreApiDelegate.kt index 49366c5d72c..47f101468e9 100644 --- a/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/api/StoreApiDelegate.kt +++ b/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/api/StoreApiDelegate.kt @@ -5,7 +5,6 @@ import org.springframework.http.HttpStatus import org.springframework.http.MediaType import org.springframework.http.ResponseEntity import org.springframework.web.context.request.NativeWebRequest -import org.springframework.core.io.Resource import org.springframework.http.server.reactive.ServerHttpRequest import java.util.Optional diff --git a/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/api/UserApiDelegate.kt b/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/api/UserApiDelegate.kt index 818d5c84fdf..def5e179e01 100644 --- a/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/api/UserApiDelegate.kt +++ b/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/api/UserApiDelegate.kt @@ -5,7 +5,6 @@ import org.springframework.http.HttpStatus import org.springframework.http.MediaType import org.springframework.http.ResponseEntity import org.springframework.web.context.request.NativeWebRequest -import org.springframework.core.io.Resource import org.springframework.http.server.reactive.ServerHttpRequest import java.util.Optional 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 c2410b3266e..ad45a6ad8be 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 @@ -172,7 +172,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { produces = ["application/json"], consumes = ["multipart/form-data"] ) - fun uploadFile(@Parameter(description = "ID of pet to update", required = true) @PathVariable("petId") petId: kotlin.Long,@Parameter(description = "Additional data to pass to server") @RequestParam(value = "additionalMetadata", required = false) additionalMetadata: kotlin.String? ,@Parameter(description = "file to upload") @Valid @RequestPart("file", required = false) file: org.springframework.core.io.Resource?): ResponseEntity { + fun uploadFile(@Parameter(description = "ID of pet to update", required = true) @PathVariable("petId") petId: kotlin.Long,@Parameter(description = "Additional data to pass to server") @RequestParam(value = "additionalMetadata", required = false) additionalMetadata: kotlin.String? ,@Parameter(description = "file to upload") @Valid @RequestPart("file", required = false) file: org.springframework.web.multipart.MultipartFile?): ResponseEntity { return ResponseEntity(service.uploadFile(petId, additionalMetadata, file), HttpStatus.valueOf(200)) } } diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/PetApiService.kt b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/PetApiService.kt index ee0e3bef83c..bee779a6933 100644 --- a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/PetApiService.kt +++ b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/PetApiService.kt @@ -90,5 +90,5 @@ interface PetApiService { * @return successful operation (status code 200) * @see PetApi#uploadFile */ - fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: org.springframework.core.io.Resource?): ModelApiResponse + fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: org.springframework.web.multipart.MultipartFile?): ModelApiResponse } diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt index 452e4e400b7..6b401e7ee88 100644 --- a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt +++ b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt @@ -34,7 +34,7 @@ class PetApiServiceImpl : PetApiService { TODO("Implement me") } - override fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: org.springframework.core.io.Resource?): ModelApiResponse { + override fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: org.springframework.web.multipart.MultipartFile?): ModelApiResponse { TODO("Implement me") } } diff --git a/samples/server/petstore/kotlin-springboot-multipart-request-model/src/main/kotlin/org/openapitools/api/MultipartMixedApiController.kt b/samples/server/petstore/kotlin-springboot-multipart-request-model/src/main/kotlin/org/openapitools/api/MultipartMixedApiController.kt index a2b304ac2f2..f9a8789ef3d 100644 --- a/samples/server/petstore/kotlin-springboot-multipart-request-model/src/main/kotlin/org/openapitools/api/MultipartMixedApiController.kt +++ b/samples/server/petstore/kotlin-springboot-multipart-request-model/src/main/kotlin/org/openapitools/api/MultipartMixedApiController.kt @@ -46,7 +46,7 @@ class MultipartMixedApiController() { value = ["/multipart-mixed"], consumes = ["multipart/form-data"] ) - fun multipartMixed(@Parameter(description = "", required = true, schema = Schema(allowableValues = ["ALLOWED", "IN_PROGRESS", "REJECTED"])) @RequestParam(value = "status", required = true) status: MultipartMixedStatus ,@Parameter(description = "a file") @Valid @RequestPart("file", required = true) file: org.springframework.core.io.Resource,@Parameter(description = "") @RequestPart(value = "marker", required = false) marker: MultipartMixedRequestMarker? ): ResponseEntity { + fun multipartMixed(@Parameter(description = "", required = true, schema = Schema(allowableValues = ["ALLOWED", "IN_PROGRESS", "REJECTED"])) @RequestParam(value = "status", required = true) status: MultipartMixedStatus ,@Parameter(description = "a file") @Valid @RequestPart("file", required = true) file: org.springframework.web.multipart.MultipartFile,@Parameter(description = "") @RequestPart(value = "marker", required = false) marker: MultipartMixedRequestMarker? ): ResponseEntity { return ResponseEntity(HttpStatus.NOT_IMPLEMENTED) } } 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 db8e1ef75c4..8f13477bde2 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 @@ -173,7 +173,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { produces = ["application/json"], consumes = ["multipart/form-data"] ) - suspend fun uploadFile(@Parameter(description = "ID of pet to update", required = true) @PathVariable("petId") petId: kotlin.Long,@Parameter(description = "Additional data to pass to server") @RequestParam(value = "additionalMetadata", required = false) additionalMetadata: kotlin.String? ,@Parameter(description = "file to upload") @Valid @RequestPart("file", required = false) file: org.springframework.core.io.Resource?): ResponseEntity { + suspend fun uploadFile(@Parameter(description = "ID of pet to update", required = true) @PathVariable("petId") petId: kotlin.Long,@Parameter(description = "Additional data to pass to server") @RequestParam(value = "additionalMetadata", required = false) additionalMetadata: kotlin.String? ,@Parameter(description = "file to upload") @Valid @RequestPart("file", required = false) file: org.springframework.web.multipart.MultipartFile?): ResponseEntity { return ResponseEntity(service.uploadFile(petId, additionalMetadata, file), HttpStatus.valueOf(200)) } } diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApiService.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApiService.kt index 4e368ce87c5..b61111bac52 100644 --- a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApiService.kt +++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApiService.kt @@ -91,5 +91,5 @@ interface PetApiService { * @return successful operation (status code 200) * @see PetApi#uploadFile */ - suspend fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: org.springframework.core.io.Resource?): ModelApiResponse + suspend fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: org.springframework.web.multipart.MultipartFile?): ModelApiResponse } diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt index 263716758a7..187e1f34515 100644 --- a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt +++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt @@ -35,7 +35,7 @@ class PetApiServiceImpl : PetApiService { TODO("Implement me") } - override suspend fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: org.springframework.core.io.Resource?): ModelApiResponse { + override suspend fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: org.springframework.web.multipart.MultipartFile?): ModelApiResponse { TODO("Implement me") } } diff --git a/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/api/PetApi.kt b/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/api/PetApi.kt index 87da8582986..c58fdf8d09b 100644 --- a/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/api/PetApi.kt +++ b/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/api/PetApi.kt @@ -196,7 +196,7 @@ interface PetApi { produces = ["application/json"], consumes = ["multipart/form-data"] ) - fun uploadFile(@Parameter(description = "ID of pet to update", required = true) @PathVariable("petId") petId: kotlin.Long,@Parameter(description = "Additional data to pass to server") @RequestParam(value = "additionalMetadata", required = false) additionalMetadata: kotlin.String? ,@Parameter(description = "file to upload") @Valid @RequestPart("file", required = false) file: org.springframework.core.io.Resource?): ResponseEntity { + fun uploadFile(@Parameter(description = "ID of pet to update", required = true) @PathVariable("petId") petId: kotlin.Long,@Parameter(description = "Additional data to pass to server") @RequestParam(value = "additionalMetadata", required = false) additionalMetadata: kotlin.String? ,@Parameter(description = "file to upload") @Valid @RequestPart("file", required = false) file: org.springframework.web.multipart.MultipartFile?): ResponseEntity { return ResponseEntity(HttpStatus.NOT_IMPLEMENTED) } } diff --git a/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/api/PetApiController.kt b/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/api/PetApiController.kt index eab188e87bf..c8dcb731d8a 100644 --- a/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/api/PetApiController.kt +++ b/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/api/PetApiController.kt @@ -175,7 +175,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { produces = ["application/json"], consumes = ["multipart/form-data"] ) - fun uploadFile(@ApiParam(value = "ID of pet to update", required = true) @PathVariable("petId") petId: kotlin.Long,@ApiParam(value = "Additional data to pass to server") @RequestParam(value = "additionalMetadata", required = false) additionalMetadata: kotlin.String? ,@ApiParam(value = "file detail") @Valid @RequestPart("file", required = false) file: org.springframework.core.io.Resource?): ResponseEntity { + fun uploadFile(@ApiParam(value = "ID of pet to update", required = true) @PathVariable("petId") petId: kotlin.Long,@ApiParam(value = "Additional data to pass to server") @RequestParam(value = "additionalMetadata", required = false) additionalMetadata: kotlin.String? ,@ApiParam(value = "file detail") @Valid @RequestPart("file", required = false) file: org.springframework.web.multipart.MultipartFile?): ResponseEntity { return ResponseEntity(service.uploadFile(petId, additionalMetadata, file), HttpStatus.valueOf(200)) } } diff --git a/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/api/PetApiService.kt b/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/api/PetApiService.kt index ee0e3bef83c..bee779a6933 100644 --- a/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/api/PetApiService.kt +++ b/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/api/PetApiService.kt @@ -90,5 +90,5 @@ interface PetApiService { * @return successful operation (status code 200) * @see PetApi#uploadFile */ - fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: org.springframework.core.io.Resource?): ModelApiResponse + fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: org.springframework.web.multipart.MultipartFile?): ModelApiResponse } diff --git a/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt b/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt index 452e4e400b7..6b401e7ee88 100644 --- a/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt +++ b/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt @@ -34,7 +34,7 @@ class PetApiServiceImpl : PetApiService { TODO("Implement me") } - override fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: org.springframework.core.io.Resource?): ModelApiResponse { + override fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: org.springframework.web.multipart.MultipartFile?): ModelApiResponse { TODO("Implement me") } } 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 c2410b3266e..ad45a6ad8be 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 @@ -172,7 +172,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { produces = ["application/json"], consumes = ["multipart/form-data"] ) - fun uploadFile(@Parameter(description = "ID of pet to update", required = true) @PathVariable("petId") petId: kotlin.Long,@Parameter(description = "Additional data to pass to server") @RequestParam(value = "additionalMetadata", required = false) additionalMetadata: kotlin.String? ,@Parameter(description = "file to upload") @Valid @RequestPart("file", required = false) file: org.springframework.core.io.Resource?): ResponseEntity { + fun uploadFile(@Parameter(description = "ID of pet to update", required = true) @PathVariable("petId") petId: kotlin.Long,@Parameter(description = "Additional data to pass to server") @RequestParam(value = "additionalMetadata", required = false) additionalMetadata: kotlin.String? ,@Parameter(description = "file to upload") @Valid @RequestPart("file", required = false) file: org.springframework.web.multipart.MultipartFile?): ResponseEntity { return ResponseEntity(service.uploadFile(petId, additionalMetadata, file), HttpStatus.valueOf(200)) } } diff --git a/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/api/PetApiService.kt b/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/api/PetApiService.kt index ee0e3bef83c..bee779a6933 100644 --- a/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/api/PetApiService.kt +++ b/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/api/PetApiService.kt @@ -90,5 +90,5 @@ interface PetApiService { * @return successful operation (status code 200) * @see PetApi#uploadFile */ - fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: org.springframework.core.io.Resource?): ModelApiResponse + fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: org.springframework.web.multipart.MultipartFile?): ModelApiResponse } diff --git a/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt b/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt index 452e4e400b7..6b401e7ee88 100644 --- a/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt +++ b/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt @@ -34,7 +34,7 @@ class PetApiServiceImpl : PetApiService { TODO("Implement me") } - override fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: org.springframework.core.io.Resource?): ModelApiResponse { + override fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: org.springframework.web.multipart.MultipartFile?): ModelApiResponse { TODO("Implement me") } } diff --git a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/api/PetApiController.kt b/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/api/PetApiController.kt index eab188e87bf..c8dcb731d8a 100644 --- a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/api/PetApiController.kt +++ b/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/api/PetApiController.kt @@ -175,7 +175,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { produces = ["application/json"], consumes = ["multipart/form-data"] ) - fun uploadFile(@ApiParam(value = "ID of pet to update", required = true) @PathVariable("petId") petId: kotlin.Long,@ApiParam(value = "Additional data to pass to server") @RequestParam(value = "additionalMetadata", required = false) additionalMetadata: kotlin.String? ,@ApiParam(value = "file detail") @Valid @RequestPart("file", required = false) file: org.springframework.core.io.Resource?): ResponseEntity { + fun uploadFile(@ApiParam(value = "ID of pet to update", required = true) @PathVariable("petId") petId: kotlin.Long,@ApiParam(value = "Additional data to pass to server") @RequestParam(value = "additionalMetadata", required = false) additionalMetadata: kotlin.String? ,@ApiParam(value = "file detail") @Valid @RequestPart("file", required = false) file: org.springframework.web.multipart.MultipartFile?): ResponseEntity { return ResponseEntity(service.uploadFile(petId, additionalMetadata, file), HttpStatus.valueOf(200)) } } diff --git a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/api/PetApiService.kt b/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/api/PetApiService.kt index ee0e3bef83c..bee779a6933 100644 --- a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/api/PetApiService.kt +++ b/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/api/PetApiService.kt @@ -90,5 +90,5 @@ interface PetApiService { * @return successful operation (status code 200) * @see PetApi#uploadFile */ - fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: org.springframework.core.io.Resource?): ModelApiResponse + fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: org.springframework.web.multipart.MultipartFile?): ModelApiResponse } diff --git a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt b/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt index 452e4e400b7..6b401e7ee88 100644 --- a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt +++ b/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt @@ -34,7 +34,7 @@ class PetApiServiceImpl : PetApiService { TODO("Implement me") } - override fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: org.springframework.core.io.Resource?): ModelApiResponse { + override fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: org.springframework.web.multipart.MultipartFile?): ModelApiResponse { TODO("Implement me") } } diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiController.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiController.kt index 030db2ed898..ee8089e3b34 100644 --- a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiController.kt +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiController.kt @@ -105,7 +105,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { produces = ["application/json"], consumes = ["multipart/form-data"] ) - fun uploadFile( @PathVariable("petId") petId: kotlin.Long, @RequestParam(value = "additionalMetadata", required = false) additionalMetadata: kotlin.String? , @Valid @RequestPart("file", required = false) file: org.springframework.core.io.Resource?): ResponseEntity { + fun uploadFile( @PathVariable("petId") petId: kotlin.Long, @RequestParam(value = "additionalMetadata", required = false) additionalMetadata: kotlin.String? , @Valid @RequestPart("file", required = false) file: org.springframework.web.multipart.MultipartFile?): ResponseEntity { return ResponseEntity(service.uploadFile(petId, additionalMetadata, file), HttpStatus.valueOf(200)) } } diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiService.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiService.kt index ee0e3bef83c..bee779a6933 100644 --- a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiService.kt +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiService.kt @@ -90,5 +90,5 @@ interface PetApiService { * @return successful operation (status code 200) * @see PetApi#uploadFile */ - fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: org.springframework.core.io.Resource?): ModelApiResponse + fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: org.springframework.web.multipart.MultipartFile?): ModelApiResponse } diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt index 452e4e400b7..6b401e7ee88 100644 --- a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt @@ -34,7 +34,7 @@ class PetApiServiceImpl : PetApiService { TODO("Implement me") } - override fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: org.springframework.core.io.Resource?): ModelApiResponse { + override fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: org.springframework.web.multipart.MultipartFile?): ModelApiResponse { TODO("Implement me") } }