JSON Schemas in RAML 1.0


I’m helping out with development on ramlfications, a Python library for processing RAML specifications. We’d like to understand better how JSON Schemas can be used in RAML.

When defining a type, we understand the simple case of referencing an external JSON Schema document:

        type: !include person.json

What’s less obvious is whether we can include a JSON Schema document inline:

        type: |
            {"$schema": "http://json-schema.org/draft-03/schema",
             "properties": {
                 "input": {
                     "required": false,
                     "type": "string"
             "required": false,
             "type": "object"

Should this be considered legal?


Yes, it’s considered valid @fdrake! This is because of the !include mechanism that basically appends any content from the file you pointing to, to the node you used the !include tag.


You guys can also take a look at https://github.com/raml-org/raml-tck/tree/wip/2.0.0 with 142 tests around the RAML specs. I constantly add more and it’s by far not finished yet, but at least it gives you some possibilities to test the parser :slight_smile: I have sent it to Lynn also. She should be aware!


I actually added your example here.


If you’d like to contribute more, please go ahead. The syntax for tests are quite simple :slight_smile:


Thanks, Christian! I’ll take a look at your tests.

It looks like there are only positive tests; do you have any plans to include negative tests as well (where validation of the RAML is expected to fail)?


Never mind; I see how you’ve included negative tests.