Include both example and schema


#1

I’m trying to find a way to include both the example and the schema content

    schema: |       !include my-schema.xsd       
    example: |      !include my-example.xsd

#2

I got this working

                example: !include my-example.json

#3

The pipe means that what comes afterwards is text, hence parsers will not process the include.

“!include” is actually a YAML tag. YAML tags have special meaning, in this case, go fetch the file, parse it and include it here, but have rules on when they should be processed.

If you are very interested, you can check the YAML spec here.


#4

RAML supports both example and schema for it’s response. It’s actually the YAML syntax which is the foundation of RAML.

When you use!include you don’t need to use | as the pipe is used to support multi-line for in-line examples.