Determining the type of a schema


When parsing a RAML document, it seems that the type of a schema element is undetermined. Neither the elements of the root level schemas element or the schema associated with a body response is typed. In the case of body elements one could make an assumption about that the schema type based on media type of the response, but this seems undesirable.

One could scan the schema trying to match it against a known type (JSON schema, XML schema), but again, this seem like guessing. It seems to me that the schema elements should have an associated media type (e.g. application/schema+json). That way you’d be certain about which validator to invoke then validating the referenced schema.


Similarly, the body schema property’s value may be the name of one of the schemas defined in the root level schemas property, but whether the value of the schema property is a reference to a schema in the root level schemas property or an inline schema is ambiguous. The reference to a schema defined in a root level schemas property does not use a YAML reference, which would make it unambiguous.

While parsing a RAML file, if you encounter a schema property, and you don’t find it in a root level schemas property and it does not parse as a schema (assuming you can guess which type of schema it is), you don’t know what type of error this is. Is this an invalid schema or a bad schema reference?