From b908275354ba6cd9dd4d393dbbedfbd2ad0f316d Mon Sep 17 00:00:00 2001 From: Zach White Date: Thu, 24 Jun 2021 20:48:53 -0700 Subject: Optimize our jsonschema by using refs (#13271) * fix some broken info.json files * optimize our jsonschema using refs * fix formatting after vscode broke it * make flake8 happy * cleanup * make our schema validation more compact and flexible --- lib/python/qmk/cli/format/json.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'lib/python/qmk/cli') diff --git a/lib/python/qmk/cli/format/json.py b/lib/python/qmk/cli/format/json.py index 1358c70e7a..19d504491f 100755 --- a/lib/python/qmk/cli/format/json.py +++ b/lib/python/qmk/cli/format/json.py @@ -8,7 +8,7 @@ from jsonschema import ValidationError from milc import cli from qmk.info import info_json -from qmk.json_schema import json_load, keyboard_validate +from qmk.json_schema import json_load, validate from qmk.json_encoders import InfoJSONEncoder, KeymapJSONEncoder from qmk.path import normpath @@ -23,14 +23,13 @@ def format_json(cli): if cli.args.format == 'auto': try: - keyboard_validate(json_file) + validate(json_file, 'qmk.keyboard.v1') json_encoder = InfoJSONEncoder except ValidationError as e: cli.log.warning('File %s did not validate as a keyboard:\n\t%s', cli.args.json_file, e) cli.log.info('Treating %s as a keymap file.', cli.args.json_file) json_encoder = KeymapJSONEncoder - elif cli.args.format == 'keyboard': json_encoder = InfoJSONEncoder elif cli.args.format == 'keymap': -- cgit v1.2.3