+class FetchSchemaError(RuntimeError):
+ pass
+
+
+class _Schema:
+ def __init__(self, path):
+ self.ret = None
+ self.path = path
+
+ def get(self):
+ try:
+ if self.ret is None:
+ with open(self.path, 'r') as f:
+ self.ret = json.loads(f.read())
+ return self.ret
+ except Exception as e:
+ raise FetchSchemaError("Unexpected error from fetching schema", e)
+
+
+schema_schema = _Schema('schemas/schema.json')
+component_schema = _Schema('schemas/compspec.json')
+dataformat_schema = _Schema('schemas/dataformat.json')
+
+