@@ -733,6 +733,66 @@ public void testMultipartBoot() throws IOException {
733733 .containsWithNameAndAttributes ("RequestPart" , ImmutableMap .of ("value" , "\" statusArray\" " , "required" , "false" ));
734734 }
735735
736+ @ Test
737+ public void testReactiveMultipartBoot () throws IOException {
738+ final SpringCodegen codegen = new SpringCodegen ();
739+ codegen .setLibrary ("spring-boot" );
740+ codegen .setDelegatePattern (true );
741+ codegen .additionalProperties ().put (DOCUMENTATION_PROVIDER , "springfox" );
742+ codegen .additionalProperties ().put (SpringCodegen .REACTIVE , "true" );
743+
744+ final Map <String , File > files = generateFiles (codegen , "src/test/resources/3_0/form-multipart-binary-array.yaml" );
745+
746+ // Check that the delegate handles the array
747+ JavaFileAssert .assertThat (files .get ("MultipartArrayApiDelegate.java" ))
748+ .assertMethod ("multipartArray" , "Flux<Part>" , "ServerWebExchange" )
749+ .assertParameter ("files" ).hasType ("Flux<Part>" );
750+
751+ // Check that the api handles the array
752+ JavaFileAssert .assertThat (files .get ("MultipartArrayApi.java" ))
753+ .assertMethod ("multipartArray" , "Flux<Part>" , "ServerWebExchange" )
754+ .assertParameter ("files" ).hasType ("Flux<Part>" )
755+ .assertParameterAnnotations ()
756+ .containsWithNameAndAttributes ("ApiParam" , ImmutableMap .of ("value" , "\" Many files\" " ))
757+ .containsWithNameAndAttributes ("RequestPart" , ImmutableMap .of ("value" , "\" files\" " , "required" , "false" ));
758+
759+ // UPDATE: the following test has been ignored due to https://github.com/OpenAPITools/openapi-generator/pull/11081/
760+ // We will contact the contributor of the following test to see if the fix will break their use cases and
761+ // how we can fix it accordingly.
762+ //// Check that the delegate handles the single file
763+ // final File multipartSingleApiDelegate = files.get("MultipartSingleApiDelegate.java");
764+ // assertFileContains(multipartSingleApiDelegate.toPath(), "MultipartFile file");
765+
766+ // Check that the api handles the single file
767+ JavaFileAssert .assertThat (files .get ("MultipartSingleApi.java" ))
768+ .assertMethod ("multipartSingle" , "Part" , "ServerWebExchange" )
769+ .assertParameter ("file" ).hasType ("Part" )
770+ .assertParameterAnnotations ()
771+ .containsWithNameAndAttributes ("ApiParam" , ImmutableMap .of ("value" , "\" One file\" " ))
772+ .containsWithNameAndAttributes ("RequestPart" , ImmutableMap .of ("value" , "\" file\" " , "required" , "false" ));
773+
774+ // Check that api validates mixed multipart request
775+ JavaFileAssert .assertThat (files .get ("MultipartMixedApi.java" ))
776+ .assertMethod ("multipartMixed" , "MultipartMixedStatus" , "Part" , "MultipartMixedRequestMarker" , "List<MultipartMixedStatus>" , "ServerWebExchange" )
777+ .assertParameter ("status" ).hasType ("MultipartMixedStatus" )
778+ .assertParameterAnnotations ()
779+ .containsWithName ("Valid" )
780+ .containsWithNameAndAttributes ("ApiParam" , ImmutableMap .of ("value" , "\" \" " ))
781+ .containsWithNameAndAttributes ("RequestPart" , ImmutableMap .of ("value" , "\" status\" " , "required" , "true" ))
782+ .toParameter ().toMethod ()
783+ .assertParameter ("file" ).hasType ("Part" )
784+ .assertParameterAnnotations ()
785+ .containsWithNameAndAttributes ("RequestPart" , ImmutableMap .of ("value" , "\" file\" " , "required" , "true" ))
786+ .toParameter ().toMethod ()
787+ .assertParameter ("marker" ).hasType ("MultipartMixedRequestMarker" )
788+ .assertParameterAnnotations ()
789+ .containsWithNameAndAttributes ("RequestPart" , ImmutableMap .of ("value" , "\" marker\" " , "required" , "false" ))
790+ .toParameter ().toMethod ()
791+ .assertParameter ("statusArray" ).hasType ("List<MultipartMixedStatus>" )
792+ .assertParameterAnnotations ()
793+ .containsWithNameAndAttributes ("RequestPart" , ImmutableMap .of ("value" , "\" statusArray\" " , "required" , "false" ));
794+ }
795+
736796 @ Test
737797 public void testAdditionalProperties_issue1466 () throws IOException {
738798 final SpringCodegen codegen = new SpringCodegen ();
0 commit comments