Mixing schemas with metadata in responses


#1

I never used json schemas so I may be missing something.

When specifying body responses, RAML lets me use schemas for items and collections. What would be the recommend way to mix a schema with various metadata like “status”, “total_items”, etc?

For example let’s take the Step 6 from the [documentation][1]:

1  /books:
2    /{bookTitle}:
3      get:
4        description: Retrieve a specific book title
5        responses:
6          200:
7            body:
8              application/json:
9                example: |
10                 {
11                   "data": {
12                     "id": "SbBGk",
13                     "title": "Stiff: The Curious Lives of Human Cadavers",
14                     "description": null,
15                     "datetime": 1341533193,
16                     "genre": "science",
17                     "author": "Mary Roach",
18                     "link": "http://e-bookmobile.com/books/Stiff",
19                   },
20                   "success": true,
21                   "status": 200
22                 }

In the above example, how would “data” be specified as a schema while still allowing for additional data such as “success” (boolean) and “status” (integer)?

One could add any additional data to the schema but I would guess this is wrong.

Thank you.
[1]: http://raml.org/docs.html