Schema Mapping

In addition to validating a document against the schema specified in its interface field, this library can map schema URIs to files based on their filepaths within the backend storage. The purpose is to uphold an orderly directory structure by specifying the oldest supported schema version against which files will (in the near future) be validated at the point that they are written to the system.

The current implemented convention is that:

  • The root of the document path corresponds to the schema name

  • The first subdirectory corresponds to the major version number

  • The returned schema is the earliest compatible minor version i.e. zero

For example a document with key ska-telmodel-layout/v1/layout.json would correspond to the schema URI https://schema.skao.int/ska-telmodel-layout/1.0.

Warning

This convention assumes that for a given major version of a schema, all minor versions are forward and backward compatible with each other. If this is not true the document may not validate against the path-mapped schema.