Unable to resolve raml file errors

1.7k views Asked by At

I have been given the attached RAML file to use in Mule but I am having problems working out how to clean up the errors in the file and not even sure this raml file conforms to standards. The errors I am getting are for missing {} and another is missing block entry when I remove the version. Can't figure out how to resolve them.

Below is a cut down version of the RAML:

#%RAML 0.8
---
title: Databox
version: v1
protocols: [HTTPS]
baseUri: https://databox/v1/{version}
mediaType: application/json
traits:
  - http-data: !include http-data.raml
resourceTypes: !include types.raml

documentation:
  - title: Home
    content: |
      Databox 1st draft

/stores:
  type:
    store:
      description: Stores
      dataSchema: !include stores.json

The traits (http-data.raml):

responses:
  200:
    description: |
      Success

The resourceType (types.raml):

- store:
    head:
      description: Retrieve data for <<description>>.
      is: [ http-data ]
    get:
      description: Retrieve data for <<description>>.
      responses:
        200:
          body:
            application/json:
              schema: |
               {
                "type": "object",
                "properties": {
                  "meta": {
                    "title": "Data",
                    "type": "object",
                    "properties": {
                      "createdOn": {
                        "type": "string",
                        "format": "date-time"
                      }
                    },
                    "required": [
                      "createdOn"
                    ]
                  },
                  "data": {
                   "type": "array",
                   "items": <<dataSchema>>
                  }
                },
                "required": [
                  "data"
                ]
               }
          description: |
            Success. Returns a JSON object containing all <<description>>.

The schema (stores.json):

{
  "id": "http://localhost:8000/stores.json#",
  "$schema": "http://json-schema.org/draft-04/schema",
  "title": "Databox Store Schema",
  "type": "object",
  "properties": {
    "storeId": {
      "type": "string"
    },
    "storeDescription": {
      "type": "string"
    },
  },
  "required": [
    "storeId"
  ],
  "additionalProperties": false
}

Thanks

1

There are 1 answers

6
Pedro On

RAML is valid except for that <<dataSchema>> parameter used in the json schema, not sure if that's a valid use of parameters.

I would start by replacing that <<dataSchema>> for the json in stores.json and try again.

Let me know if that works or what errors you get.

UPDATE:

Mulesoft's anypoint portal validates your RAML with just that single change, you can see it here