Can you use an example inside of an example?


#1

I’ve created several types and examples for each. For example, I have Product and Category types. A Product has a property of type Category. Rather than having to re-define an example of the Category in the example of the Product, can I simply reference the example I have for the Category type?


#2

I am not 100% sure on this, but I think RAML 1.0 adds the support of multiple response examples. I would assume you could use an include for each, and put your examples in separate files in say examples/ folder, and then include them in different responses to reuse them.


#3

You can achieve that by using property specific examples.

types:
  Category:
    properties:
      name:
        type: string
        example: Cat1
  Product:
    properties:
      categories: Category[]
      price:
        type: number
        example: 22.34