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:
parent
3f18b9d682
commit
5008b7703f
2 changed files with 3 additions and 4 deletions
|
|
@ -287,8 +287,7 @@ class ModuleInfo:
|
||||||
self.desc = info.get("desc")
|
self.desc = info.get("desc")
|
||||||
self.opts = json.loads("{" + opts + "}")
|
self.opts = json.loads("{" + opts + "}")
|
||||||
|
|
||||||
@property
|
def get_schema(self):
|
||||||
def schema(self):
|
|
||||||
schema = {
|
schema = {
|
||||||
"title": f"Pipeline {self.type}",
|
"title": f"Pipeline {self.type}",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
|
|
@ -485,7 +484,7 @@ class Index:
|
||||||
elif klass in ["Assembler", "Input", "Source", "Stage"]:
|
elif klass in ["Assembler", "Input", "Source", "Stage"]:
|
||||||
info = self.get_module_info(klass, name)
|
info = self.get_module_info(klass, name)
|
||||||
if info:
|
if info:
|
||||||
schema = info.schema
|
schema = info.get_schema()
|
||||||
else:
|
else:
|
||||||
raise ValueError(f"Unknown klass: {klass}")
|
raise ValueError(f"Unknown klass: {klass}")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,7 @@ class TestDescriptions(unittest.TestCase):
|
||||||
klass, name = module
|
klass, name = module
|
||||||
try:
|
try:
|
||||||
info = osbuild.meta.ModuleInfo.load(os.curdir, klass, name)
|
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()
|
res = schema.check()
|
||||||
if not res:
|
if not res:
|
||||||
err = "\n ".join(str(e) for e in res)
|
err = "\n ".join(str(e) for e in res)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue