我正在使用Swagger 2.0,我有一个问题是发送多个帖子参数。我有一个招摇错误Operation cannot have a body parameter and a formData parameter
,我不知道如何解决它。在我的定义中,我有一个body参数,这个参数需要一个JSON格式,但是我还有其他参数,比如要上传的文件和文件名。
如何发送body和formData参数呢?
这是Web服务定义:
/updateDatas:
post:
summary: Upadate datas
description: |
Update datas
consumes:
- multipart/form-data
produces:
- application/json
parameters:
- name: firstFileName
in: formData
description: First file name.
required: true
type: string
- name: secondFileName
in: formData
description: Second file name.
required: true
type: string
- name: datas
in: body
description: Json object informations.
required: true
schema:
$ref: '#/definitions/Datas'
- name: firstFile
in: formData
description: First file .jpg
required: true
type: file
- name: clientFile
in: formData
description: Second file .jpg
required: true
type: file
tags:
- Application
responses:
'200':
description: Uploaded
schema:
$ref: '#/definitions/Upload'
'401':
description: Unauthorized Bad Token