Eorrror While Parsing RAML


#1

Hi Team,

Below RAML code is working perfectly in MULE Exchange but when I am trying to open it in Anypoint Platform then throwing an error message-

Error Message - Unexpected key ‘items’. Options are : “default” or “description” or “displayName” or “example” or “examples” or “facets” or “required” or “usage” or “xml” or /((.+))/ or Any of :“type”,“schema”

RAML Code -

#%RAML 1.0
version: v1
title: New API
types:
  Customer:
    description: This is a new DataType
    example:
      strict: true
      value:
        AccountName: Account One
        AccountID: ACC00001
        AccountAddress: 505 Cadwalader Cir Exton PA
        AccountPhone: 222-222-2222
    type: object
baseUri: https://anypoint.mulesoft.com/mocking/api/v1/links/497122aa-4566-4dc3-9e86-1eb8ff9e8563/
/customers:
  get:
    responses:
      200:
        body:
          application/json:
            items:
              type:
                - Customer

#2

Can you try the to use the type expression type: <typeName>[] instead?

(...)
/customers:
  get:
    responses:
      200:
        body:
          application/json:
            type: Customer[]

Also, no need to set strict: true in your example since it is implied by default.

Your RAML could be simplified as follows:

#%RAML 1.0
baseUri: https://anypoint.mulesoft.com/mocking/api/v1/links/497122aa-4566-4dc3-9e86-1eb8ff9e8563/
version: v1
title: New API
types:
  Customer:
    type: object
    description: This is a new DataType
    example:
      AccountName: Account One
      AccountID: ACC00001
      AccountAddress: 505 Cadwalader Cir Exton PA
      AccountPhone: 222-222-2222

/customers:
  get:
    responses:
      200:
        body:
          application/json:
            type: Customer[]

Note that the example in your Customer type has not properties defined, was that intended?