swagger で CSV get/put を自分はこう書いた話 にゃ (正しいとは言っていない)


schema の書き方がわからないから雑にやったった

api:
  parameters:
    - xxxx
  get
    summary: csv download
    description: |
      xxxx
  response:
    200:
      description: |
        OK

        * col1  integer   xxxxx
        * col2  string  xxxxx
        * col3  integer   xxxxx

        Example)
        100,Bob,200
        200,Max,10
        300,Tom,4400
    400:
      $ref: '#/common/error'
  put
    summary: csv upload
    description: |
      xxxx
    parameters:
      - name: body
        in: body
        required: true
        description: |
          OK 

          * col1  integer   xxxxx
          * col2  string  xxxxx
          * col3  integer   xxxxx

          Example)
          100,Bob,200
          200,Max,10
          300,Tom,4400
        schema:
          text/csv:
            schema:
              type: string
    responses:
      200:
        description: OK 
      400:
        $ref: '#/common/CsvBadRequest'

Gist