mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
* Refactor config API * Corrections * Test Qt 6.8 * Revert "Test Qt 6.8" This reverts commit eceebec49ecf1a3eda281a0630a9a7577b44ef0a. * Corrections 2 * Update Changelog * Add configFilter element for getconfig call * Do not create errors for DB updates when in read-only mode * Have configuration migration and validation before Hyperion starts * Correct Tests * Corrections * Add migration items * Correct windows build * Ensure that first instance as default one exists * Remove dependency between AuthManager and SSDPHandler * Correct typos * Address CodeQL findings * Replace CamkeSettings by Presets and provide debug scenarios
30 lines
813 B
Python
30 lines
813 B
Python
#!/usr/bin/env python
|
|
import json, sys
|
|
from os import path
|
|
from jsonschema import Draft3Validator, RefResolver
|
|
|
|
from urllib.parse import urljoin
|
|
from urllib.request import pathname2url
|
|
|
|
def path2url(path):
|
|
return urljoin('file:', pathname2url(path))
|
|
|
|
print('-- validate json file')
|
|
|
|
jsonFileName = sys.argv[1]
|
|
schemaFileName = sys.argv[2]
|
|
|
|
try:
|
|
with open(schemaFileName) as schemaFile:
|
|
with open(jsonFileName) as jsonFile:
|
|
schema = json.load(schemaFile)
|
|
uri = path2url('%s/' % path.abspath(path.dirname(schemaFileName)))
|
|
resolver = RefResolver(uri, referrer = schema)
|
|
instance = json.load(jsonFile)
|
|
Draft3Validator(schema, resolver=resolver).validate(instance)
|
|
except Exception as e:
|
|
print('validation error: '+jsonFileName + ' '+schemaFileName+' ('+str(e)+')')
|
|
sys.exit(1)
|
|
|
|
sys.exit(0)
|