cmake/Tests/RunCMake/CMakePresets/validate_schema.py

17 lines
393 B
Python
Raw Normal View History

2021-09-14 00:13:48 +02:00
import json
import jsonschema
import os.path
import sys
2023-07-02 19:51:09 +02:00
with open(sys.argv[1], "r", encoding="utf-8-sig") as f:
contents = json.load(f)
2021-09-14 00:13:48 +02:00
schema_file = os.path.join(
os.path.dirname(__file__),
"..", "..", "..", "Help", "manual", "presets", "schema.json")
2023-07-02 19:51:09 +02:00
with open(schema_file, "r", encoding="utf-8") as f:
2021-09-14 00:13:48 +02:00
schema = json.load(f)
jsonschema.validate(contents, schema)