mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
add json check before compile (#354)
* add json check before compile * do more checking on effects * add effects checking * better effects checking. * integrate schema check for default config reduce size of default configs
This commit is contained in:
21
test/jsonchecks/checkschema.py
Normal file
21
test/jsonchecks/checkschema.py
Normal file
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env python
|
||||
import json, sys, glob
|
||||
from os import path
|
||||
from jsonschema import Draft3Validator
|
||||
|
||||
print('-- validate json file')
|
||||
|
||||
jsonFileName = sys.argv[1]
|
||||
schemaFileName = sys.argv[2]
|
||||
|
||||
try:
|
||||
with open(schemaFileName) as schemaFile:
|
||||
with open(jsonFileName) as jsonFile:
|
||||
j = json.load(jsonFile)
|
||||
validator = Draft3Validator(json.load(schemaFile))
|
||||
validator.validate(j)
|
||||
except Exception as e:
|
||||
print('validation error: '+jsonFileName + ' '+schemaFileName+' ('+str(e)+')')
|
||||
sys.exit(1)
|
||||
|
||||
sys.exit(0)
|
Reference in New Issue
Block a user