在Swagger中,如果我像这样定义响应对象,响应会是什么样的

时间:2015-12-29 06:56:16

标签: swagger

我希望此API在响应HTTP正文中生成JSON。

switch (Extension)
    {
        case ".xls": //Excel 97-03
            conStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended Properties='Excel 8.0;HDR={1};IMEX=1;'";
            break;
        case ".xlsx": //Excel 07
            conStr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties='Excel 12.0;HDR={1};IMEX=1;'";
            break;
    }

我认为回应机构将是:

 responses:
        '200':
          description: success
          schema:
            $ref: '#/definitions/Company'
        '400':
          description: client doesn't exist
 definitions:
   Company:
    description: ''
    type: object
    properties:
      id:
        type: string
        description: Empty when creating a record
      name:
        type: string
        description: Not empty when creating record, or updating this field
      email: 
        type: string

这是对的吗?或

{
  "code": 200,
  "company": {...company object...}
}

以下是swagger工具生成的文档:

enter image description here

0 个答案:

没有答案