对文件和对象数据的Swagger响应

时间:2016-06-28 19:14:44

标签: swagger-2.0

我有一个Swagger文件,我试图用图像(定义为对象)返回文件(.png图像)和其他数据 这是我的yaml文件当前的样子,只返回带有200响应代码的对象:

 get:
  summary: Get Practice Information
  description: |
    This call will return information about a specific Practice.
  tags:
  - Practice
  parameters:
  - name: apikey
    in: query
    description: apikey
    required: true
    type: string
  - name: PracticeName
    in: query
    description: Name of Practice
    required: true
    type: string
  responses:
    200:
      description: Information about a Practice
      schema:
        $ref: '#/definitions/PracticeInfo'
    400:
      description: Application error
      schema:
        $ref: '#/definitions/ApplicationError'
    500:
      description: System error
      schema:
        $ref: '#/definitions/SystemError'

我尝试过将“type:File”放在各个地方但没有运气。我尝试将文件放在对象本身中,但这也无效。我可以让它只返回一个图像:

responses:
    200:
      description: Information about a Practice
      schema:
        type: file
        description: Logo

但我似乎无法同时做到这两件事。表单数据适用于参数输入,但我没有看到如何在响应中执行此操作。

0 个答案:

没有答案