meta: ModuleInfo.{schema -> get_schema()}

Change the `ModuleInfo.schema` propertly into a `get_schema`
method call. This is in preparation to allow for different
schemata versions to be supported.
This commit is contained in:
Christian Kellner 2021-02-10 11:30:38 +00:00
parent 3f18b9d682
commit 5008b7703f
2 changed files with 3 additions and 4 deletions

View file

@ -287,8 +287,7 @@ class ModuleInfo:
self.desc = info.get("desc")
self.opts = json.loads("{" + opts + "}")
@property
def schema(self):
def get_schema(self):
schema = {
"title": f"Pipeline {self.type}",
"type": "object",
@ -485,7 +484,7 @@ class Index:
elif klass in ["Assembler", "Input", "Source", "Stage"]:
info = self.get_module_info(klass, name)
if info:
schema = info.schema
schema = info.get_schema()
else:
raise ValueError(f"Unknown klass: {klass}")

View file

@ -122,7 +122,7 @@ class TestDescriptions(unittest.TestCase):
klass, name = module
try:
info = osbuild.meta.ModuleInfo.load(os.curdir, klass, name)
schema = osbuild.meta.Schema(info.schema, name)
schema = osbuild.meta.Schema(info.get_schema(), name)
res = schema.check()
if not res:
err = "\n ".join(str(e) for e in res)