summaryrefslogtreecommitdiff
path: root/lib/python/qmk
diff options
context:
space:
mode:
authorJoel Challis <git@zvecr.com>2022-06-18 06:30:46 +0100
committerGitHub <noreply@github.com>2022-06-18 15:30:46 +1000
commit17ec1650fd4fd27b3bf409e3493faf11c8d421e8 (patch)
tree971345d0b08d840fb28951c03af689dac0ebcd8f /lib/python/qmk
parent7b3ee1db8cfaed4315b93f7f4c06f07faa08ae71 (diff)
Additional schema fixes (#17414)
Diffstat (limited to 'lib/python/qmk')
-rwxr-xr-xlib/python/qmk/cli/generate/info_json.py8
-rw-r--r--lib/python/qmk/json_schema.py6
2 files changed, 5 insertions, 9 deletions
diff --git a/lib/python/qmk/cli/generate/info_json.py b/lib/python/qmk/cli/generate/info_json.py
index 284d1a8510..0dc80f10cc 100755
--- a/lib/python/qmk/cli/generate/info_json.py
+++ b/lib/python/qmk/cli/generate/info_json.py
@@ -5,7 +5,7 @@ Compile an info.json for a particular keyboard and pretty-print it.
import json
from argcomplete.completers import FilesCompleter
-from jsonschema import Draft7Validator, RefResolver, validators
+from jsonschema import Draft202012Validator, RefResolver, validators
from milc import cli
from pathlib import Path
@@ -18,7 +18,7 @@ from qmk.path import is_keyboard, normpath
def pruning_validator(validator_class):
- """Extends Draft7Validator to remove properties that aren't specified in the schema.
+ """Extends Draft202012Validator to remove properties that aren't specified in the schema.
"""
validate_properties = validator_class.VALIDATORS["properties"]
@@ -37,10 +37,10 @@ def strip_info_json(kb_info_json):
"""Remove the API-only properties from the info.json.
"""
schema_store = compile_schema_store()
- pruning_draft_7_validator = pruning_validator(Draft7Validator)
+ pruning_draft_validator = pruning_validator(Draft202012Validator)
schema = schema_store['qmk.keyboard.v1']
resolver = RefResolver.from_schema(schema_store['qmk.keyboard.v1'], store=schema_store)
- validator = pruning_draft_7_validator(schema, resolver=resolver).validate
+ validator = pruning_draft_validator(schema, resolver=resolver).validate
return validator(kb_info_json)
diff --git a/lib/python/qmk/json_schema.py b/lib/python/qmk/json_schema.py
index 682346113e..01175146b5 100644
--- a/lib/python/qmk/json_schema.py
+++ b/lib/python/qmk/json_schema.py
@@ -68,11 +68,7 @@ def create_validator(schema):
schema_store = compile_schema_store()
resolver = jsonschema.RefResolver.from_schema(schema_store[schema], store=schema_store)
- # TODO: Remove this after the jsonschema>=4 requirement had time to reach users
- try:
- return jsonschema.Draft202012Validator(schema_store[schema], resolver=resolver).validate
- except AttributeError:
- return jsonschema.Draft7Validator(schema_store[schema], resolver=resolver).validate
+ return jsonschema.Draft202012Validator(schema_store[schema], resolver=resolver).validate
def validate(data, schema):