私はSwagger 2.0を使用していますが、複数の投稿パラメータを送信する際に問題があります。私は奇妙なエラーOperation cannot have a body parameter and a formData parameter
を持っており、私はそれを修正する方法を知らない。私の定義ではbodyパラメータがあり、このパラメータにはJSON形式が必要ですが、アップロードするファイルやファイル名のような他のパラメータがあります。Swagger send bodyとformDataパラメータ
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
[Swaggerでは、スキーマパラメータとともにファイルを使用するAPIを定義する方法は?](https://stackoverflow.com/questions/32725052/in-swagger-how-to-define-anスキル・パラメーイングと一緒にファイルを使用する) – Helen
私の質問はこのポストよりも古いです... – John
実際に(2015年以降の)古いものです。 – Helen