diff options
author | Zach White <skullydazed@gmail.com> | 2021-08-16 15:33:30 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-16 23:33:30 +0100 |
commit | 8d9bfdc25437bb401985ba93b47edae2126e7fac (patch) | |
tree | 2439e7adde0bafd6af9a403c92c1a89384c3f6ea /lib/python/qmk/json_schema.py | |
parent | fac717c11cfa27780f2f9098383673784174141a (diff) | |
download | qmk_firmware-8d9bfdc25437bb401985ba93b47edae2126e7fac.tar.gz qmk_firmware-8d9bfdc25437bb401985ba93b47edae2126e7fac.zip |
Add a lot more data to info.json (#13366)
* add some split data to info.json
* add tags
* add half of config_options.md to info.json
* add support for designating master split
* sort out split transport and primary
* fix bad data in UNUSED_PINS
* fixup custom transport
* wip
* allow for setting split right half keyboard matrix
* add SPLIT_USB_DETECT
* minor cleanup
* fix an erroneous message
* rework split.usb_detect
* adding missing rgblight vars to info.json
* add mouse_key to info.json
* add all remaining options from docs/config_options.md
* fix audio voices
* qmk info: Change text output to use dotted notation
* tweak layout output
* resolve alias names
* break out some functions to make flake8 happy
* add a field for bootloader instructions
* qmk generate-info-json: add a write-to-file argument
Adds an argument that instructs qmk generate-info-json to write the output to a file instead of just to the terminal.
* -arg_only, +action
Because it was never my intention that one would have to specify a value for the argument that enables writing the file.
* Bring qmk generate-info-json inline with other generate commands
* pytest fixup
* fix esca/getawayvan
* fix data driven errors for bpiphany converters
* features.force_nkro -> usb.force_nkro
* split.primary->split.main
* fix esca/getawayvan_f042
* fix the bpiphany converters for real
* fix bpiphany/tiger_lily
* Apply suggestions from code review
Co-authored-by: Nick Brassel <nick@tzarc.org>
* fix generate-api errors
* fix matrix pin extraction for split boards
* fix ploopyco/trackball_nano/rev1_001
Co-authored-by: James Young <18669334+noroadsleft@users.noreply.github.com>
Co-authored-by: Nick Brassel <nick@tzarc.org>
Diffstat (limited to 'lib/python/qmk/json_schema.py')
-rw-r--r-- | lib/python/qmk/json_schema.py | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/python/qmk/json_schema.py b/lib/python/qmk/json_schema.py index cbc5bff51..ffc7c6bcd 100644 --- a/lib/python/qmk/json_schema.py +++ b/lib/python/qmk/json_schema.py | |||
@@ -2,6 +2,7 @@ | |||
2 | """ | 2 | """ |
3 | import json | 3 | import json |
4 | from collections.abc import Mapping | 4 | from collections.abc import Mapping |
5 | from functools import lru_cache | ||
5 | from pathlib import Path | 6 | from pathlib import Path |
6 | 7 | ||
7 | import hjson | 8 | import hjson |
@@ -25,6 +26,7 @@ def json_load(json_file): | |||
25 | exit(1) | 26 | exit(1) |
26 | 27 | ||
27 | 28 | ||
29 | @lru_cache(maxsize=0) | ||
28 | def load_jsonschema(schema_name): | 30 | def load_jsonschema(schema_name): |
29 | """Read a jsonschema file from disk. | 31 | """Read a jsonschema file from disk. |
30 | """ | 32 | """ |
@@ -39,8 +41,9 @@ def load_jsonschema(schema_name): | |||
39 | return json_load(schema_path) | 41 | return json_load(schema_path) |
40 | 42 | ||
41 | 43 | ||
42 | def create_validator(schema): | 44 | @lru_cache(maxsize=0) |
43 | """Creates a validator for the given schema id. | 45 | def compile_schema_store(): |
46 | """Compile all our schemas into a schema store. | ||
44 | """ | 47 | """ |
45 | schema_store = {} | 48 | schema_store = {} |
46 | 49 | ||
@@ -51,6 +54,14 @@ def create_validator(schema): | |||
51 | continue | 54 | continue |
52 | schema_store[schema_data['$id']] = schema_data | 55 | schema_store[schema_data['$id']] = schema_data |
53 | 56 | ||
57 | return schema_store | ||
58 | |||
59 | |||
60 | @lru_cache(maxsize=0) | ||
61 | def create_validator(schema): | ||
62 | """Creates a validator for the given schema id. | ||
63 | """ | ||
64 | schema_store = compile_schema_store() | ||
54 | resolver = jsonschema.RefResolver.from_schema(schema_store['qmk.keyboard.v1'], store=schema_store) | 65 | resolver = jsonschema.RefResolver.from_schema(schema_store['qmk.keyboard.v1'], store=schema_store) |
55 | 66 | ||
56 | return jsonschema.Draft7Validator(schema_store[schema], resolver=resolver).validate | 67 | return jsonschema.Draft7Validator(schema_store[schema], resolver=resolver).validate |