小编Sur*_*ari的帖子

在Swaggerhub中返回一个对象数组

我在swaggerhub中定义了一个API规范./ contacts请求返回一组联系人.定义如下:

/contacts:     
get:
  tags:
  - contacts
  summary: Get all the contacts
  description: This displays all the contacts present for the user.
  operationId: getContact
  produces:
  - application/json
  - application/xml  
  responses:
   200:
    description: successful operation
    schema:
      $ref: '#/definitions/AllContacts'
   400:
    description: Invalid id supplied
   404:
    description: Contact not found
   500:
    description: Server error
definitions:
  AllContacts:
   type: array
   items:
   -  $ref: '#/definitions/ContactModel1'
   -  $ref: '#/definitions/ContactModel2'


  ContactModel1:
    type: object
    properties:
      id:
        type: integer
        example: 1
      firstName:
        type: string
        example: 'someValue'
      lastName:
        type: string
        example: …
Run Code Online (Sandbox Code Playgroud)

yaml swagger swagger-2.0

7
推荐指数
2
解决办法
6815
查看次数

标签 统计

swagger ×1

swagger-2.0 ×1

yaml ×1