Error while including schema file. Unable to find file even though it exists


#1

I’m using the API designer and I created a schema file. I’m trying to include the file like so:

#%RAML 0.8
title: Field Manual
version: 1.0
schemas:
  - root: !include /root.schema.json

But I get the error: /root.schema.json does not exist. I did create the file using the API designer and I can see it in the list of files.


#2

That error appears if the /root.schema.json is not visible to the Console/Designer.

Don’t know if you are using the “official” API Designer or the Mongo/REST API Designer.

In the case of the official repo, it uses local storage which is a HTML5 feature… and I guess the API Desginer/Console wont watch for external included files on LocalStorage (an internal storage of the browser).

In the case of the REST service that returns RAML files like this, If you use relative paths, then the API Console/Designer should have full visibility (public access) to the file, this means it should also include the CORS headers. This is due the webpage checks for CORS headers on request made to distinct domains that the current page (for security reasons).


#3

Please try !include root.schema.json without the leading /. Tell me if that worked or not?!