如何使用在YAML / swagger.io中具有href自身的数组来构造响应?

时间:2014-12-23 19:31:34

标签: rest yaml swagger

我该怎么做:

"groups":{  
      "href":"https://api.mydomain.com/account/abC132/groups",
      "items":[  

      ]
   }

我有这个:

groups:
            type: array
            properties:
              href:
                type: string
            items:
              type: object
              name: division
              properties:
                href:
                  type: string
                id:
                  type: string

但是招摇的编辑器没有认识到该组属性下的href。

2 个答案:

答案 0 :(得分:6)

我相信你正在寻找类似的东西:

definitions:
  groups:
    title: groups
    type: object
    properties:
      href:
        type: string
      items:
        type: array
        items:
          $ref: '#/definitions/group'
  group:
    type: object
    properties:
      href:
        type: string
      id:
        type: string

答案 1 :(得分:1)

我必须做以下事情:

definitions:
  groups:
    title: groups
    type: object
    properties:
      href:
        type: string
      items:
        type: array
        items:
          $ref: '#/definitions/group'
  group:
    type: object
    properties:
      href:
        type: string
      id:
        type: string