Nested Arrays in RAML Example


I have looked in the V1 spec and can not find a good example for what I am trying to do. I am trying to do my examples in RAML in the hope it will save me from separate JSON and XML even though I know there are lots of converters. What I am trying to represent is something that has multiple datatypes. Class1 contains an array of class2 that has several properties one of which is also an array which is another class. something like

  property 2
  property 3 (which is really an array of class 2

Class 2
  property 1
  property 2
  property 3
  property 4 (which is an array of Class 3)

Class 3 
    same thing and this would be the final level

This all works just fine with the datatype definitions whether in the api.raml file or in a datatypes directory with !include.

I can not seem to get a RAML example to work to represent this.



What about the following:

      c: Class2[]
      a: "aaaa"
        - b:
            g: "gggg"
        - b:
            g: "jkghrhgjr"
      b: Class3


I am not too worried about examples in the type definition. I am looking for an example section of the RAML Something like:
type: Course[]
#sorry for the formatting. below would obviously be correctly indented.
courseID: 22345A
courseTitle: "A second example course title"
courseDescription: "This course will introduce the mathematics for quantum computation. This includes basic notions from quantum mechanics, linear algebra, probability theory and number theory. No a priori knowledge of linear algebra is required except for a familiarity with basic facts about complex numbers and 2x2 matrices; in particular, what is taught in Mathematics 21b suffices. No a priori knowledge of either number theory or probability is needed.\n"
catalogSubject: Math
courseNumber: "Math 162"
classKey: 234567890
lastUpdated: 2017-07-04T21:00:00
published: 2017-07-04T21:00:00
classes: [classKey: 43, lastUpdated: 2017-07]
It is the line above that I am having trouble getting right. I was pointed to

that did not really help.


I think I have it worked out. It just basic YAML nothing special here. Thanks.


Exactly. Same syntax in payloads as in types. Nothing special indeed :slight_smile: