mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Hyperion Light 2 (#1428)
* Hyperion Light - Have EffectEngine as component * Hyperion light - Build switches for LED Devices (Serial, Network) * Fix file uri generation * Fix missing guard for Windows * Fix file uri generation * Update jsonschema and checkschema * Allow to provide cmake build args to docker build
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
Copyright (c) 2011 Julian Berman
|
||||
Copyright (c) 2013 Julian Berman
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
@@ -3,6 +3,12 @@ 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]
|
||||
@@ -11,8 +17,11 @@ schemaFileName = sys.argv[2]
|
||||
try:
|
||||
with open(schemaFileName) as schemaFile:
|
||||
with open(jsonFileName) as jsonFile:
|
||||
resolver = RefResolver('file://%s/schema/' % path.abspath(path.dirname(schemaFileName)), None)
|
||||
Draft3Validator(json.loads(schemaFile.read()), resolver=resolver).validate(json.loads(jsonFile.read()))
|
||||
schema = json.load(schemaFile)
|
||||
uri = path2url('%s/schema/' % 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)
|
||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user