feat(config): Schema validator, initial config merger setup
This commit is contained in:
+18
-2
@@ -1,2 +1,18 @@
|
||||
def validate():
|
||||
pass
|
||||
import json
|
||||
import jsonschema
|
||||
|
||||
with open("config.schema.json") as file:
|
||||
schema = json.load(file)
|
||||
|
||||
|
||||
def validate(config):
|
||||
try:
|
||||
jsonschema.validate(config, schema)
|
||||
except jsonschema.SchemaError:
|
||||
print("Schema invalid")
|
||||
return False
|
||||
except jsonschema.ValidationError:
|
||||
print("Config invalid")
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user