Recently, I was trying to update our raml files by adding response body schemas. This seem to have been already mentioned before on this group, but I guess no one found the way to solve it (
https://groups.google.com/forum/#!topic/openlmis-dev/_7GciBqHLfU). There seems to be a problem with defining "arrays of objects of specified type". We define a schema like this:
- facilityArray: |
{
"type": "array",
"items": { "type": "object", "$ref":"#/schemas/facility" }
}
Then, if we put this as a schema for response body, the integration test would fail on following line:
assertThat(RAML_ASSERT_MESSAGE, restAssured.getLastReport(), RamlMatchers.hasNoViolations());
saying, that "the reference schema could not be resolved" (more info in the topic linked above).
I have not found any solution or live example in official raml docs, though I found a post on their official forum with similar issue (http://forums.raml.org/t/set-body-to-be-array-of-defined-schema-objects/1566).
From what is suggests, RAML 0.8 does not fully support that kind of declaration, or at least it's related tools do not.
Does anyone know a solution to this issue?
If we can't come up with a solution to this, we may switch to RAML 1.0 (although we might also need to revise if our tools support it), or have some workaround (like defining the above facilityArray as array of objects without referencing schema (so we're losing consistency), or copy-paste facility's definition in place of reference (making redundant declaration) - those two are proven to work).
Best regards,
Paweł