hyperion.ng/test/jsonchecks/checkschema.py
redPanther 170ad4f5db improve serial hotplug (#389)
* - disable device when error indecates that the problem is not solvable on reconnect
- introduce a preOpenDelay of 2 seconds (currently value is hardcoded)

* rs232:
- make preOpenDelay available via webui
- fix preOpenDelay
- add basic usb serial detection

* - revert 3819ae7
- fix schema files

* make json checks compat with utf8+bom

* make shutdown effect a bit more flexible
2017-02-09 20:10:57 +01:00

22 lines
572 B
Python

#!/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.loads(jsonFile.read().decode('utf-8-sig'))
validator = Draft3Validator(json.loads(schemaFile.read().decode('utf-8-sig')))
validator.validate(j)
except Exception as e:
print('validation error: '+jsonFileName + ' '+schemaFileName+' ('+str(e)+')')
sys.exit(1)
sys.exit(0)