summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/CMakePresets/validate_schema.py
blob: c9f84ee1760f012f6dec4d923cb476f4c74fd8ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import jsmin
import json
import jsonschema
import os.path
import sys


with open(sys.argv[1], "rb") as f:
    contents = json.loads(jsmin.jsmin(f.read().decode("utf-8-sig")))

schema_file = os.path.join(
        os.path.dirname(__file__),
        "..", "..", "..", "Help", "manual", "presets", "schema.json")
with open(schema_file) as f:
    schema = json.load(f)

jsonschema.validate(contents, schema)