Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/373.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 带有openapi和openapi生成器maven插件的requestbody中的多个文件_Java_Spring_Openapi - Fatal编程技术网

Java 带有openapi和openapi生成器maven插件的requestbody中的多个文件

Java 带有openapi和openapi生成器maven插件的requestbody中的多个文件,java,spring,openapi,Java,Spring,Openapi,最初,我在使用spring boot的MVC控制器中的方法是: public Response sendMailWithAttachment( @RequestParam(name = "wrapper") String wrapper, @RequestParam(name = "file", required = false) MultipartFile... file ) {... 文件-vararg,多文件请求支持 现在,我想描述OAS3中的规范,并用这个方法生成接口: /ema

最初,我在使用spring boot的MVC控制器中的方法是:

public Response sendMailWithAttachment(
@RequestParam(name = "wrapper") String wrapper, 
@RequestParam(name = "file", required = false) MultipartFile... file
) {...
文件-vararg,多文件请求支持

现在,我想描述OAS3中的规范,并用这个方法生成接口:

  /email/sendmail:
    post:
      tags:
        - email-controller
      summary: Send email, can add attachment
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                wrapper:
                  type: string
                  description: incoming request object
                file:
                  type: array
                  items:
                    type: string
                    format: binary
                    description: file for sending (attachment)
但是接口,在openapi生成器maven插件(4.2.2)未生成vararg参数之后:

default ResponseEntity<EmailResponse> sendMailWithAttachmentUsingPOST(
@RequestParam(value="wrapper", required=false)  String wrapper, 
@Valid @RequestPart("file") MultipartFile file
) {...


default ResponseEntity sendMailWithAttachmentUsingPOST(
@RequestParam(value=“wrapper”,required=false)字符串包装器,
@有效的@RequestPart(“文件”)多部分文件
) {...
到目前为止,我不知道如何生成支持vararg或数组参数的接口。 谢谢


谢谢!!

尝试使用最新版本的maven插件(目前为4.2.3) 生成的界面在我看来很好:

default ResponseEntity<EmailResponse> sendMailWithAttachmentUsingPOST(
    @ApiParam(value = "incoming request object") @RequestParam(value="wrapper", required=false)  String wrapper,
    @ApiParam(value = "") @Valid @RequestPart("file") List<MultipartFile> file
)
default ResponseEntity sendMailWithAttachmentUsingPOST(
@ApiParam(value=“incoming request object”)@RequestParam(value=“wrapper”,required=false)字符串包装器,
@ApiParam(value=”“)@Valid@RequestPart(“文件”)列表文件
)