diff options
author | Zach White <skullydazed@gmail.com> | 2021-06-24 20:48:53 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-24 20:48:53 -0700 |
commit | b908275354ba6cd9dd4d393dbbedfbd2ad0f316d (patch) | |
tree | 7efbb70c51fb917d203b629feb9eadf169f71c91 /lib/python/qmk/cli/format/json.py | |
parent | 9d4412cb8bf9512952118b190fedea72e33d28cb (diff) |
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
Diffstat (limited to 'lib/python/qmk/cli/format/json.py')
-rwxr-xr-x | lib/python/qmk/cli/format/json.py | 5 |
1 files changed, 2 insertions, 3 deletions
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': |