diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/api.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/api.mustache index 071669010e6..14cd22d0d2c 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/api.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/api.mustache @@ -275,7 +275,7 @@ public interface {{classname}} { } // Override this method - {{#jdk8-default-interface}}default {{/jdk8-default-interface}} {{>responseType}} {{operationId}}({{#allParams}}{{^isFile}}{{^isBodyParam}}{{>optionalDataType}}{{/isBodyParam}}{{#isBodyParam}}{{^reactive}}{{>optionalDataType}}{{/reactive}}{{#reactive}}{{^isArray}}Mono<{{{dataType}}}>{{/isArray}}{{#isArray}}Flux<{{{baseType}}}>{{/isArray}}{{/reactive}}{{/isBodyParam}}{{/isFile}}{{#isFile}}{{#reactive}}Flux{{/reactive}}{{^reactive}}{{#isArray}}List{{/isArray}}{{^isArray}}MultipartFile{{/isArray}}{{/reactive}}{{/isFile}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#reactive}}{{#hasParams}}, {{/hasParams}}{{#springFoxDocumentationProvider}}@ApiIgnore{{/springFoxDocumentationProvider}} final ServerWebExchange exchange{{/reactive}}{{#vendorExtensions.x-spring-paginated}}{{#hasParams}}, {{/hasParams}}{{^hasParams}}{{#reactive}}, {{/reactive}}{{/hasParams}}{{#springFoxDocumentationProvider}}@ApiIgnore{{/springFoxDocumentationProvider}}final Pageable pageable{{/vendorExtensions.x-spring-paginated}}){{#unhandledException}} throws Exception{{/unhandledException}} { + {{#jdk8-default-interface}}default {{/jdk8-default-interface}} {{>responseType}} {{operationId}}({{#allParams}}{{^isFile}}{{^isBodyParam}}{{>optionalDataType}}{{/isBodyParam}}{{#isBodyParam}}{{^reactive}}{{>optionalDataType}}{{/reactive}}{{#reactive}}{{^isArray}}Mono<{{{dataType}}}>{{/isArray}}{{#isArray}}Flux<{{{baseType}}}>{{/isArray}}{{/reactive}}{{/isBodyParam}}{{/isFile}}{{#isFile}}{{#reactive}}{{#isArray}}Flux<{{/isArray}}Part{{#isArray}}>{{/isArray}}{{/reactive}}{{^reactive}}{{#isArray}}List<{{/isArray}}MultipartFile{{#isArray}}>{{/isArray}}{{/reactive}}{{/isFile}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#reactive}}{{#hasParams}}, {{/hasParams}}{{#springFoxDocumentationProvider}}@ApiIgnore{{/springFoxDocumentationProvider}} final ServerWebExchange exchange{{/reactive}}{{#vendorExtensions.x-spring-paginated}}{{#hasParams}}, {{/hasParams}}{{^hasParams}}{{#reactive}}, {{/reactive}}{{/hasParams}}{{#springFoxDocumentationProvider}}@ApiIgnore{{/springFoxDocumentationProvider}}final Pageable pageable{{/vendorExtensions.x-spring-paginated}}){{#unhandledException}} throws Exception{{/unhandledException}} { {{/delegate-method}} {{^isDelegate}} {{>methodBody}}{{! prevent indent}} diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/apiDelegate.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/apiDelegate.mustache index 060df0fc84c..f971353dcb1 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/apiDelegate.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/apiDelegate.mustache @@ -71,7 +71,7 @@ public interface {{classname}}Delegate { {{#isDeprecated}} @Deprecated {{/isDeprecated}} - {{#jdk8-default-interface}}default {{/jdk8-default-interface}}{{>responseType}} {{operationId}}({{#allParams}}{{^isFile}}{{^isBodyParam}}{{>optionalDataType}}{{/isBodyParam}}{{#isBodyParam}}{{^reactive}}{{>optionalDataType}}{{/reactive}}{{#reactive}}{{^isArray}}Mono<{{{dataType}}}>{{/isArray}}{{#isArray}}Flux<{{{baseType}}}>{{/isArray}}{{/reactive}}{{/isBodyParam}}{{/isFile}}{{#isFile}}{{#isArray}}List<{{/isArray}}{{#reactive}}Flux{{/reactive}}{{^reactive}}{{#isFormParam}}MultipartFile{{/isFormParam}}{{^isFormParam}}{{>optionalDataType}}{{/isFormParam}}{{/reactive}}{{#isArray}}>{{/isArray}}{{/isFile}} {{paramName}}{{^-last}}, + {{#jdk8-default-interface}}default {{/jdk8-default-interface}}{{>responseType}} {{operationId}}({{#allParams}}{{^isFile}}{{^isBodyParam}}{{>optionalDataType}}{{/isBodyParam}}{{#isBodyParam}}{{^reactive}}{{>optionalDataType}}{{/reactive}}{{#reactive}}{{^isArray}}Mono<{{{dataType}}}>{{/isArray}}{{#isArray}}Flux<{{{baseType}}}>{{/isArray}}{{/reactive}}{{/isBodyParam}}{{/isFile}}{{#isFile}}{{#reactive}}{{#isArray}}Flux<{{/isArray}}Part{{#isArray}}>{{/isArray}}{{/reactive}}{{^reactive}}{{#isArray}}List<{{/isArray}}{{#isFormParam}}MultipartFile{{/isFormParam}}{{^isFormParam}}{{>optionalDataType}}{{/isFormParam}}{{#isArray}}>{{/isArray}}{{/reactive}}{{/isFile}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#reactive}}{{#hasParams}}, {{/hasParams}}ServerWebExchange exchange{{/reactive}}{{#vendorExtensions.x-spring-paginated}}{{#hasParams}}, {{/hasParams}}{{^hasParams}}{{#reactive}}, {{/reactive}}{{/hasParams}}final Pageable pageable{{/vendorExtensions.x-spring-paginated}}){{#unhandledException}} throws Exception{{/unhandledException}}{{^jdk8-default-interface}};{{/jdk8-default-interface}}{{#jdk8-default-interface}} { {{>methodBody}}{{! prevent indent}} diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/formParams.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/formParams.mustache index fdb51cc6c69..08b8b2b3c74 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/formParams.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/formParams.mustache @@ -1 +1 @@ -{{#isFormParam}}{{^isFile}}{{>paramDoc}}{{#useBeanValidation}} @Valid{{/useBeanValidation}} {{#isModel}}@RequestPart{{/isModel}}{{^isModel}}{{#isArray}}@RequestPart{{/isArray}}{{^isArray}}{{#reactive}}@RequestPart{{/reactive}}{{^reactive}}@RequestParam{{/reactive}}{{/isArray}}{{/isModel}}(value = "{{baseName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}){{>dateTimeParam}} {{^required}}{{#useOptional}}Optional<{{/useOptional}}{{/required}}{{{dataType}}}{{^required}}{{#useOptional}}>{{/useOptional}}{{/required}} {{paramName}}{{/isFile}}{{#isFile}}{{>paramDoc}} @RequestPart(value = "{{baseName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}) {{#isArray}}List<{{/isArray}}{{#reactive}}Flux{{/reactive}}{{^reactive}}MultipartFile{{/reactive}}{{#isArray}}>{{/isArray}} {{paramName}}{{/isFile}}{{/isFormParam}} \ No newline at end of file +{{#isFormParam}}{{^isFile}}{{>paramDoc}}{{#useBeanValidation}} @Valid{{/useBeanValidation}} {{#isModel}}@RequestPart{{/isModel}}{{^isModel}}{{#isArray}}@RequestPart{{/isArray}}{{^isArray}}{{#reactive}}@RequestPart{{/reactive}}{{^reactive}}@RequestParam{{/reactive}}{{/isArray}}{{/isModel}}(value = "{{baseName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}){{>dateTimeParam}} {{^required}}{{#useOptional}}Optional<{{/useOptional}}{{/required}}{{{dataType}}}{{^required}}{{#useOptional}}>{{/useOptional}}{{/required}} {{paramName}}{{/isFile}}{{#isFile}}{{>paramDoc}} @RequestPart(value = "{{baseName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}) {{#reactive}}{{#isArray}}Flux<{{/isArray}}Part{{#isArray}}>{{/isArray}}{{/reactive}}{{^reactive}}{{#isArray}}List<{{/isArray}}MultipartFile{{#isArray}}>{{/isArray}}{{/reactive}} {{paramName}}{{/isFile}}{{/isFormParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java index 9390923cbf9..efd26c6f2b1 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java @@ -733,6 +733,66 @@ public class SpringCodegenTest { .containsWithNameAndAttributes("RequestPart", ImmutableMap.of("value", "\"statusArray\"", "required", "false")); } + @Test + public void testReactiveMultipartBoot() throws IOException { + final SpringCodegen codegen = new SpringCodegen(); + codegen.setLibrary("spring-boot"); + codegen.setDelegatePattern(true); + codegen.additionalProperties().put(DOCUMENTATION_PROVIDER, "springfox"); + codegen.additionalProperties().put(SpringCodegen.REACTIVE, "true"); + + final Map files = generateFiles(codegen, "src/test/resources/3_0/form-multipart-binary-array.yaml"); + + // Check that the delegate handles the array + JavaFileAssert.assertThat(files.get("MultipartArrayApiDelegate.java")) + .assertMethod("multipartArray", "Flux", "ServerWebExchange") + .assertParameter("files").hasType("Flux"); + + // Check that the api handles the array + JavaFileAssert.assertThat(files.get("MultipartArrayApi.java")) + .assertMethod("multipartArray", "Flux", "ServerWebExchange") + .assertParameter("files").hasType("Flux") + .assertParameterAnnotations() + .containsWithNameAndAttributes("ApiParam", ImmutableMap.of("value", "\"Many files\"")) + .containsWithNameAndAttributes("RequestPart", ImmutableMap.of("value", "\"files\"", "required", "false")); + + // UPDATE: the following test has been ignored due to https://github.com/OpenAPITools/openapi-generator/pull/11081/ + // We will contact the contributor of the following test to see if the fix will break their use cases and + // how we can fix it accordingly. + //// Check that the delegate handles the single file + // final File multipartSingleApiDelegate = files.get("MultipartSingleApiDelegate.java"); + // assertFileContains(multipartSingleApiDelegate.toPath(), "MultipartFile file"); + + // Check that the api handles the single file + JavaFileAssert.assertThat(files.get("MultipartSingleApi.java")) + .assertMethod("multipartSingle", "Part", "ServerWebExchange") + .assertParameter("file").hasType("Part") + .assertParameterAnnotations() + .containsWithNameAndAttributes("ApiParam", ImmutableMap.of("value", "\"One file\"")) + .containsWithNameAndAttributes("RequestPart", ImmutableMap.of("value", "\"file\"", "required", "false")); + + // Check that api validates mixed multipart request + JavaFileAssert.assertThat(files.get("MultipartMixedApi.java")) + .assertMethod("multipartMixed", "MultipartMixedStatus", "Part", "MultipartMixedRequestMarker", "List", "ServerWebExchange") + .assertParameter("status").hasType("MultipartMixedStatus") + .assertParameterAnnotations() + .containsWithName("Valid") + .containsWithNameAndAttributes("ApiParam", ImmutableMap.of("value", "\"\"")) + .containsWithNameAndAttributes("RequestPart", ImmutableMap.of("value", "\"status\"", "required", "true")) + .toParameter().toMethod() + .assertParameter("file").hasType("Part") + .assertParameterAnnotations() + .containsWithNameAndAttributes("RequestPart", ImmutableMap.of("value", "\"file\"", "required", "true")) + .toParameter().toMethod() + .assertParameter("marker").hasType("MultipartMixedRequestMarker") + .assertParameterAnnotations() + .containsWithNameAndAttributes("RequestPart", ImmutableMap.of("value", "\"marker\"", "required", "false")) + .toParameter().toMethod() + .assertParameter("statusArray").hasType("List") + .assertParameterAnnotations() + .containsWithNameAndAttributes("RequestPart", ImmutableMap.of("value", "\"statusArray\"", "required", "false")); + } + @Test public void testAdditionalProperties_issue1466() throws IOException { final SpringCodegen codegen = new SpringCodegen(); diff --git a/samples/client/petstore/spring-http-interface-reactive-noResponseEntity/src/main/java/org/openapitools/api/FakeApi.java b/samples/client/petstore/spring-http-interface-reactive-noResponseEntity/src/main/java/org/openapitools/api/FakeApi.java index fa41fd05fed..fa265b3ae60 100644 --- a/samples/client/petstore/spring-http-interface-reactive-noResponseEntity/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/client/petstore/spring-http-interface-reactive-noResponseEntity/src/main/java/org/openapitools/api/FakeApi.java @@ -226,7 +226,7 @@ public interface FakeApi { @RequestPart(value = "int64", required = false) Long int64, @RequestPart(value = "float", required = false) Float _float, @RequestPart(value = "string", required = false) String string, - @RequestPart(value = "binary", required = false) Flux binary, + @RequestPart(value = "binary", required = false) Part binary, @RequestPart(value = "date", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate date, @RequestPart(value = "dateTime", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) OffsetDateTime dateTime, @RequestPart(value = "password", required = false) String password, diff --git a/samples/client/petstore/spring-http-interface-reactive-noResponseEntity/src/main/java/org/openapitools/api/PetApi.java b/samples/client/petstore/spring-http-interface-reactive-noResponseEntity/src/main/java/org/openapitools/api/PetApi.java index 6750f0c8219..739a83de1b8 100644 --- a/samples/client/petstore/spring-http-interface-reactive-noResponseEntity/src/main/java/org/openapitools/api/PetApi.java +++ b/samples/client/petstore/spring-http-interface-reactive-noResponseEntity/src/main/java/org/openapitools/api/PetApi.java @@ -210,7 +210,7 @@ public interface PetApi { Mono uploadFile( @PathVariable("petId") Long petId, @RequestPart(value = "additionalMetadata", required = false) String additionalMetadata, - @RequestPart(value = "file", required = false) Flux file + @RequestPart(value = "file", required = false) Part file ); @@ -232,7 +232,7 @@ public interface PetApi { ) Mono uploadFileWithRequiredFile( @PathVariable("petId") Long petId, - @RequestPart(value = "requiredFile", required = true) Flux requiredFile, + @RequestPart(value = "requiredFile", required = true) Part requiredFile, @RequestPart(value = "additionalMetadata", required = false) String additionalMetadata ); diff --git a/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/api/FakeApi.java b/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/api/FakeApi.java index a4c20ccce89..8609df4ea32 100644 --- a/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/api/FakeApi.java @@ -217,7 +217,7 @@ public interface FakeApi { @RequestPart(value = "int64", required = false) Long int64, @RequestPart(value = "float", required = false) Float _float, @RequestPart(value = "string", required = false) String string, - @RequestPart(value = "binary", required = false) Flux binary, + @RequestPart(value = "binary", required = false) Part binary, @RequestPart(value = "date", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate date, @RequestPart(value = "dateTime", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) OffsetDateTime dateTime, @RequestPart(value = "password", required = false) String password, diff --git a/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/api/PetApi.java b/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/api/PetApi.java index 88618eba35f..c8a46f721a3 100644 --- a/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/api/PetApi.java +++ b/samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/api/PetApi.java @@ -201,7 +201,7 @@ public interface PetApi { Mono> uploadFile( @PathVariable("petId") Long petId, @RequestPart(value = "additionalMetadata", required = false) String additionalMetadata, - @RequestPart(value = "file", required = false) Flux file + @RequestPart(value = "file", required = false) Part file ); @@ -222,7 +222,7 @@ public interface PetApi { ) Mono> uploadFileWithRequiredFile( @PathVariable("petId") Long petId, - @RequestPart(value = "requiredFile", required = true) Flux requiredFile, + @RequestPart(value = "requiredFile", required = true) Part requiredFile, @RequestPart(value = "additionalMetadata", required = false) String additionalMetadata ); diff --git a/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/FakeApi.java index f2898201e9e..7b165ea9b08 100644 --- a/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/FakeApi.java @@ -396,7 +396,7 @@ public interface FakeApi { @ApiParam(value = "None") @Valid @RequestPart(value = "int64", required = false) Long int64, @ApiParam(value = "None") @Valid @RequestPart(value = "float", required = false) Float _float, @ApiParam(value = "None") @Valid @RequestPart(value = "string", required = false) String string, - @ApiParam(value = "None") @RequestPart(value = "binary", required = false) Flux binary, + @ApiParam(value = "None") @RequestPart(value = "binary", required = false) Part binary, @ApiParam(value = "None") @Valid @RequestPart(value = "date", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate date, @ApiParam(value = "None") @Valid @RequestPart(value = "dateTime", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) OffsetDateTime dateTime, @ApiParam(value = "None") @Valid @RequestPart(value = "password", required = false) String password, @@ -698,7 +698,7 @@ public interface FakeApi { default Mono uploadFileWithRequiredFile( @ApiParam(value = "ID of pet to update", required = true) @PathVariable("petId") Long petId, - @ApiParam(value = "file to upload", required = true) @RequestPart(value = "requiredFile", required = true) Flux requiredFile, + @ApiParam(value = "file to upload", required = true) @RequestPart(value = "requiredFile", required = true) Part requiredFile, @ApiParam(value = "Additional data to pass to server") @Valid @RequestPart(value = "additionalMetadata", required = false) String additionalMetadata, @ApiIgnore final ServerWebExchange exchange ) { diff --git a/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/FakeApiDelegate.java b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/FakeApiDelegate.java index 4d9e5d40c13..f9adf53ee21 100644 --- a/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/FakeApiDelegate.java +++ b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/FakeApiDelegate.java @@ -238,7 +238,7 @@ public interface FakeApiDelegate { Long int64, Float _float, String string, - Flux binary, + Part binary, LocalDate date, OffsetDateTime dateTime, String password, @@ -411,7 +411,7 @@ public interface FakeApiDelegate { * @see FakeApi#uploadFileWithRequiredFile */ default Mono uploadFileWithRequiredFile(Long petId, - Flux requiredFile, + Part requiredFile, String additionalMetadata, ServerWebExchange exchange) { Mono result = Mono.empty(); diff --git a/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/PetApi.java b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/PetApi.java index 30a64e6b3a3..be73e4335e7 100644 --- a/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/PetApi.java @@ -365,7 +365,7 @@ public interface PetApi { default Mono uploadFile( @ApiParam(value = "ID of pet to update", required = true) @PathVariable("petId") Long petId, @ApiParam(value = "Additional data to pass to server") @Valid @RequestPart(value = "additionalMetadata", required = false) String additionalMetadata, - @ApiParam(value = "file to upload") @RequestPart(value = "file", required = false) Flux file, + @ApiParam(value = "file to upload") @RequestPart(value = "file", required = false) Part file, @ApiIgnore final ServerWebExchange exchange ) { return getDelegate().uploadFile(petId, additionalMetadata, file, exchange); diff --git a/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/PetApiDelegate.java b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/PetApiDelegate.java index 9f666ec7414..fcee0e1dbde 100644 --- a/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/PetApiDelegate.java +++ b/samples/server/petstore/springboot-reactive-noResponseEntity/src/main/java/org/openapitools/api/PetApiDelegate.java @@ -209,7 +209,7 @@ public interface PetApiDelegate { */ default Mono uploadFile(Long petId, String additionalMetadata, - Flux file, + Part file, ServerWebExchange exchange) { Mono result = Mono.empty(); exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApi.java index 8b65d6a66ba..8b2a125f772 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApi.java @@ -386,7 +386,7 @@ public interface FakeApi { @ApiParam(value = "None") @Valid @RequestPart(value = "int64", required = false) Long int64, @ApiParam(value = "None") @Valid @RequestPart(value = "float", required = false) Float _float, @ApiParam(value = "None") @Valid @RequestPart(value = "string", required = false) String string, - @ApiParam(value = "None") @RequestPart(value = "binary", required = false) Flux binary, + @ApiParam(value = "None") @RequestPart(value = "binary", required = false) Part binary, @ApiParam(value = "None") @Valid @RequestPart(value = "date", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate date, @ApiParam(value = "None") @Valid @RequestPart(value = "dateTime", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) OffsetDateTime dateTime, @ApiParam(value = "None") @Valid @RequestPart(value = "password", required = false) String password, @@ -680,7 +680,7 @@ public interface FakeApi { default Mono> uploadFileWithRequiredFile( @ApiParam(value = "ID of pet to update", required = true) @PathVariable("petId") Long petId, - @ApiParam(value = "file to upload", required = true) @RequestPart(value = "requiredFile", required = true) Flux requiredFile, + @ApiParam(value = "file to upload", required = true) @RequestPart(value = "requiredFile", required = true) Part requiredFile, @ApiParam(value = "Additional data to pass to server") @Valid @RequestPart(value = "additionalMetadata", required = false) String additionalMetadata, @ApiIgnore final ServerWebExchange exchange ) { diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApiDelegate.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApiDelegate.java index 753459a1917..9762c352268 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApiDelegate.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApiDelegate.java @@ -239,7 +239,7 @@ public interface FakeApiDelegate { Long int64, Float _float, String string, - Flux binary, + Part binary, LocalDate date, OffsetDateTime dateTime, String password, @@ -412,7 +412,7 @@ public interface FakeApiDelegate { * @see FakeApi#uploadFileWithRequiredFile */ default Mono> uploadFileWithRequiredFile(Long petId, - Flux requiredFile, + Part requiredFile, String additionalMetadata, ServerWebExchange exchange) { Mono result = Mono.empty(); diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/PetApi.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/PetApi.java index e9e47dce113..ebf3681f423 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/PetApi.java @@ -357,7 +357,7 @@ public interface PetApi { default Mono> uploadFile( @ApiParam(value = "ID of pet to update", required = true) @PathVariable("petId") Long petId, @ApiParam(value = "Additional data to pass to server") @Valid @RequestPart(value = "additionalMetadata", required = false) String additionalMetadata, - @ApiParam(value = "file to upload") @RequestPart(value = "file", required = false) Flux file, + @ApiParam(value = "file to upload") @RequestPart(value = "file", required = false) Part file, @ApiIgnore final ServerWebExchange exchange ) { return getDelegate().uploadFile(petId, additionalMetadata, file, exchange); diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/PetApiDelegate.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/PetApiDelegate.java index 68c88a6a26c..09a24b0a6e1 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/PetApiDelegate.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/PetApiDelegate.java @@ -210,7 +210,7 @@ public interface PetApiDelegate { */ default Mono> uploadFile(Long petId, String additionalMetadata, - Flux file, + Part file, ServerWebExchange exchange) { Mono result = Mono.empty(); exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);