Search code examples
restyamldocumentationraml

raml 1.0 response types


I am trying to build a RAML documentation (v 1.0) and I am stuck it seams at the very first stages. I have the vendor resource, I defined as follows:

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

I just cannot figure out what to write for type on the get request (where ??? now is) the API responds with an array of objects of type vendor but how exactly do I convey that to RAML?


Solution

  • Try:

    type: Vendor[]
    

    You can read more on the official documentation: http://docs.raml.org/specs/1.0/#raml-10-spec-array-types