raml 1.0响应类型

时间:2015-11-17 15:03:34

标签: api rest documentation yaml raml

我正在尝试构建一个RAML文档(v 1.0),并且在最初阶段我遇到了它。我有供应商资源,我定义如下:

types:
    Vendor: 
        type: object
        properties:
            name: string
            url: string
            service_email: string
            service_phone: string
            image: string

/vendors:
  description: foo bar
  displayName: Vendor
  get:
    description: retrieve a list of vendors
    responses:
      200:
        body:
          application/json:
            type: ???
            uniqueItems: true

  /{ident}:
    get:
      description: retrieve a single vendor item identified by ident
      responses:
        200:
          body:
            application/json:
              type: Vendor

我只是无法弄清楚要在get请求中写入什么类型(现在是???),api会回复一个类型为vendor的对象数组,但我究竟如何将它传达给RAML?

1 个答案:

答案 0 :(得分:2)

尝试:

public ArrayList<DropItem> filterDrops(ArrayList <DropItem> hasRelationList, ArrayList <DropItem> allDropsList){
    Iterator<DropItem> allDropsIterator = allDropsList.iterator();

    while(allDropsIterator.hasNext()) {
        DropItem dropItemAll = allDropsIterator.next();

        for(DropItem dropItemRelation  : hasRelationList) {
          if(dropItemAll.getObjectId().equals(dropItemRelation.getObjectId()){
              allDropsIterator.remove(dropItemAll);
        }
    }

    return allDropsList;
}

您可以在官方文档中阅读更多信息:http://docs.raml.org/specs/1.0/#raml-10-spec-array-types