【Swagger】FormData パラメータサンプル【メモ】

Swagger

Swagger の formData パラメータのサンプルとなります。

swagger: "2.0"
info:
  version: "1.0.0"
  title: "test API"
paths:
  /data:
    post:
      summary: "input send"
      description: "テキストボックスやチェックボックス値を送信する"
      consumes:
        - "application/x-www-form-urlencoded"
      parameters:
        - in: "formData"
          name: "name"
          type: "string"
          required: true
          description: "略"
        - in: "formData"
          name: "join"
          type: "boolean"
          required: false
          description: "略"
      responses:
        200:
          description: "略"
        400:
          description: "略"
        500:
          description: "略"
  /data-upload:
    post:
      summary: "upload send"
      description: "ファイルを送信する"
      consumes:
       - "multipart/form-data"
      parameters:
       - in: "formData"
         name: "attach"
         type: "file"
         required: true
         description: "略"            
      responses:
        200:
          description: "略"
        400:
          description: "略"
        500:
          description: "略"
  /multi-data-upload:
    post:
      summary: "multi send"
      description: "テキストボックスの値やファイルなどをまとめて送信する"
      consumes:
        - "multipart/form-data"
      parameters:
        - in: "formData"
          name: "name"
          type: "string"
          required: true
          description: "略"
        - in: "formData"
          name: "join"
          type: "boolean"
          required: false
          description: "略"
        - in: "formData"
          name: "upfile"
          type: "file"
          description: "略"
      responses:
        200:
          description: "略"
        400:
          description: "略"
        500:
          description: "略"
タイトルとURLをコピーしました