【发布时间】:2020-01-31 11:55:12
【问题描述】:
原来,我在 MVC-controller 中使用 spring-boot 的方法是:
public Response sendMailWithAttachment(
@RequestParam(name = "wrapper") String wrapper,
@RequestParam(name = "file", required = false) MultipartFile... file
) {...
file - 可变参数,支持多文件请求
现在,我想在 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-generator-maven-plugin (4.2.2) 后不生成可变参数:
default ResponseEntity<EmailResponse> sendMailWithAttachmentUsingPOST(
@RequestParam(value="wrapper", required=false) String wrapper,
@Valid @RequestPart("file") MultipartFile file
) {...
到目前为止,我不明白如何生成具有可变参数或数组参数支持的接口。 谢谢!!
谢谢!!
【问题讨论】: