config.h. While this worked well when QMK was only a handful of keyboards we've grown to encompass nearly 1500 supported keyboards. That extrapolates out to 6000 configuration files under
keyboards/alone! The freeform nature of these files and the unique patterns people have used to avoid duplication have made ongoing maintenance a challenge, and a large number of our keyboards follow patterns that are outdated and sometimes harder to understand.
info.jsonas a first step towards this. The QMK API is an effort to combine these 3 sources of information-
info.json- into a single source of truth that end-user tools can use.
info.json, allowing us to have a single source of truth. This will allow us to use automated tooling to maintain keyboards saving a lot of time and maintenance work.
info.json. The basic process is:
rules.mkvalue to info.json.
data/schemas. The values that go into keyboard-specific
info.jsonfiles are kept in
keyboard.jsonschema. Any value you want to make available to end users to edit must go in here.
url. This is appropriate when your option is self-contained and not directly related to other options.
object. This is particularly true when adding support for a feature. Some examples to follow for this are
rgblight. If you are not sure how to integrate your new option(s) open an issue or join #cli on Discord and start a conversation there.
data/mappings/info_rules.json, and control mapping for
rules.mk, respectively. Each mapping is keyed by the
rules.mkvariable, and the value is a hash with the following keys:
info_key: (required) The location within
info.jsonfor this value. See below.
value_type: (optional) Default
str. The format for this variable's value. See below.
to_json: (optional) Default
true. Set to
falseto exclude this mapping from info.json
to_c: (optional) Default
true. Set to
falseto exclude this mapping from config.h
warn_duplicate: (optional) Default
true. Set to
falseto turn off warning when a value exists in both places
info_json["rgblight"]["split_count"]I would specify
rgblight.split_count. This allows you to address deeply nested keys with a simple string.
array: A comma separated array of strings
array.int: A comma separated array of integers
int: An integer
hex: A number formatted as hex
list: A space separate array of strings
mapping: A hash of key/value pairs
info.jsonit extracts information from
rules.mk. You will need to add code for your new config value to
lib/python/qmk/info.py. Typically this means adding a new
_extract_<feature>()function and then calling your function in either
config.hvalues you'll need to write a function for your rule(s) and call that function in
rules.mkyou can simply add your keys to
info_to_rulesat the top of
lib/python/qmk/cli/generate/rules_mk.py. Otherwise you'll need to create a new if block for your feature in