Lines Matching +full:json +full:- +full:schema
10 # SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
14 import json
29 def __init__(self, message="Json Validation Failed"):
40 def render(template_path: str, driver_jsoncontext: list) -> str:
42 Render template from the input file and driver JSON.
54 driver_jsoncontext: list) -> None:
65 encoding='UTF-8') as out_file:
69 def validate_json(driverjson_data: Driver, driverschema_list: dict) -> None:
71 Validate the Driver JSON against an appropriate schema
72 the schema passed could be that matching an opaque/ transparent driver.
78 jsonschema.validate(instance=driverjson_data, schema=_schema)
80 # This could happen if the driverjson_data.type does not exist in the provided schema list
91 print("Error: Failed to validate data file: {} using schema: {}."
94 print("Error: Failed to validate data file: {} using schema: {}."
100 def load_driver(schemas: Dict[str, Any], driver_file: str) -> Any:
101 """loads validated json driver"""
102 with open(file=driver_file, mode='r', encoding='UTF-8') as f:
103 json_data = json.load(f)
111 def load_schemas(project_root: str) -> Dict[str, Any]:
120 'driver_transparent_schema.json'),
125 'driver_opaque_schema.json')
129 with open(file=file_path, mode='r', encoding='UTF-8') as file:
130 driver_schema[key] = json.load(file)
136 jsondriver_list: str) -> list:
138 Merge driver JSON files into a single ordered JSON after validation.
144 encoding='UTF-8') as driver_list_file:
145 driver_list = json.load(driver_list_file)
152 def trace_exception(e: Exception, file=sys.stderr) -> None:
162 def main() -> int:
169 parser.add_argument('--project-root', default=def_arg_project_root,
171 parser.add_argument('--template-dir',
173 parser.add_argument('--json-dir',
198 # Read and validate list of driver jsons from driverlist.json
201 'driverlist.json')