summaryrefslogtreecommitdiff
path: root/data/schemas
diff options
context:
space:
mode:
Diffstat (limited to 'data/schemas')
-rw-r--r--data/schemas/api_keyboard.jsonschema44
-rw-r--r--data/schemas/definitions.jsonschema107
-rw-r--r--data/schemas/keyboard.jsonschema253
3 files changed, 162 insertions, 242 deletions
diff --git a/data/schemas/api_keyboard.jsonschema b/data/schemas/api_keyboard.jsonschema
index d570ee9990..d638658a1d 100644
--- a/data/schemas/api_keyboard.jsonschema
+++ b/data/schemas/api_keyboard.jsonschema
@@ -1,34 +1,22 @@
{
+ "$id": "qmk.api.keyboard.v1",
"allOf": [
- { "$ref": "qmk.keyboard.v1" },
+ {"$ref": "qmk.keyboard.v1"},
{
- "$id": "qmk.api.keyboard.v1",
- "keymaps": {
- "type": "string"
- },
- "parse_errors": {
- "type": "array",
- "items": {
- "type": "string"
- }
- },
- "parse_warnings": {
- "type": "array",
- "items": {
- "type": "string"
- }
- },
- "processor_type": {
- "type": "string"
- },
- "protocol": {
- "type": "string"
- },
- "keyboard_folder": {
- "type": "string"
- },
- "platform": {
- "type": "string"
+ "properties": {
+ "keymaps": {
+ "type": "object",
+ "properties": {
+ "url": {"type": "string"}
+ }
+
+ },
+ "parse_errors": {"$ref": "qmk.definitions.v1#/string_array"},
+ "parse_warnings": {"$ref": "qmk.definitions.v1#/string_array"},
+ "processor_type": {"type": "string"},
+ "protocol": {"type": "string"},
+ "keyboard_folder": {"type": "string"},
+ "platform": {"type": "string"}
}
}
]
diff --git a/data/schemas/definitions.jsonschema b/data/schemas/definitions.jsonschema
new file mode 100644
index 0000000000..822f237073
--- /dev/null
+++ b/data/schemas/definitions.jsonschema
@@ -0,0 +1,107 @@
+{
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "$id": "qmk.definitions.v1",
+ "title": "Common definitions used across QMK's jsonschemas.",
+ "type": "object",
+ "boolean_array": {
+ "type": "object",
+ "additionalProperties": {"type": "boolean"}
+ },
+ "filename": {
+ "type": "string",
+ "minLength": 1,
+ "pattern": "^[0-9a-z_]*$"
+ },
+ "hex_number_2d": {
+ "type": "string",
+ "pattern": "^0x[0-9A-F]{2}$"
+ },
+ "hex_number_4d": {
+ "type": "string",
+ "pattern": "^0x[0-9A-F]{4}$"
+ },
+ "text_identifier": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 250
+ },
+ "layout_macro": {
+ "oneOf": [
+ {
+ "type": "string",
+ "enum": ["LAYOUT", "LAYOUT_planck_1x2uC"]
+ },
+ {
+ "type": "string",
+ "pattern": "^LAYOUT_[0-9a-z_]*$"
+ }
+ ]
+ },
+ "key_unit": {
+ "type": "number",
+ "min": 0.25
+ },
+ "mcu_pin_array": {
+ "type": "array",
+ "items": {"$ref": "#/mcu_pin"}
+ },
+ "mcu_pin": {
+ "oneOf": [
+ {
+ "type": "string",
+ "pattern": "^[A-K]\\d{1,2}$"
+ },
+ {
+ "type": "string",
+ "pattern": "^LINE_PIN\\d{1,2}$"
+ },
+ {
+ "type": "number",
+ "multipleOf": 1
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "signed_decimal": {
+ "type": "number"
+ },
+ "signed_int": {
+ "type": "number",
+ "multipleOf": 1
+ }
+ "signed_int_8": {
+ "type": "number",
+ "min": -127,
+ "max": 127,
+ "multipleOf": 1
+ }
+ "string_array": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "string_object": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
+ },
+ "unsigned_decimal": {
+ "type": "number",
+ "min": 0
+ },
+ "unsigned_int": {
+ "type": "number",
+ "min": 0,
+ "multipleOf": 1
+ }
+ "unsigned_int_8": {
+ "type": "number",
+ "min": 0,
+ "max": 255,
+ "multipleOf": 1
+ }
+}
diff --git a/data/schemas/keyboard.jsonschema b/data/schemas/keyboard.jsonschema
index c335f49d52..764f665240 100644
--- a/data/schemas/keyboard.jsonschema
+++ b/data/schemas/keyboard.jsonschema
@@ -1,31 +1,19 @@
{
- "$schema": "http://json-schema.org/schema#",
+ "$schema": "http://json-schema.org/draft-07/schema#",
"$id": "qmk.keyboard.v1",
"title": "Keyboard Information",
"type": "object",
"properties": {
- "keyboard_name": {
- "type": "string",
- "minLength": 2,
- "maxLength": 250
- },
- "maintainer": {
- "type": "string",
- "minLength": 2,
- "maxLength": 250
- },
- "manufacturer": {
- "type": "string",
- "minLength": 2,
- "maxLength": 250
- },
+ "keyboard_name": {"$ref": "qmk.definitions.v1#/text_identifier"},
+ "maintainer": {"$ref": "qmk.definitions.v1#/text_identifier"},
+ "manufacturer": {"$ref": "qmk.definitions.v1#/text_identifier"},
"url": {
"type": "string",
"format": "uri"
},
"processor": {
"type": "string",
- "enum": ["cortex-m0", "cortex-m0plus", "cortex-m3", "cortex-m4", "MKL26Z64", "MK20DX128", "MK20DX256", "MK66F18", "STM32F042", "STM32F072", "STM32F103", "STM32F303", "STM32F401", "STM32F411", "STM32F446", "STM32G431", "STM32G474", "STM32L433", "STM32L443", "atmega16u2", "atmega32u2", "atmega16u4", "atmega32u4", "at90usb162", "at90usb646", "at90usb647", "at90usb1286", "at90usb1287", "atmega32a", "atmega328p", "atmega328", "attiny85", "unknown"]
+ "enum": ["cortex-m0", "cortex-m0plus", "cortex-m3", "cortex-m4", "MKL26Z64", "MK20DX128", "MK20DX256", "MK66F18", "STM32F042", "STM32F072", "STM32F103", "STM32F303", "STM32F401", "STM32F411", "STM32F446", "STM32G431", "STM32G474", "STM32L412", "STM32L422", "STM32L433", "STM32L443", "atmega16u2", "atmega32u2", "atmega16u4", "atmega32u4", "at90usb162", "at90usb646", "at90usb647", "at90usb1286", "at90usb1287", "atmega32a", "atmega328p", "atmega328", "attiny85", "unknown"]
},
"board": {
"type": "string",
@@ -34,68 +22,29 @@
},
"bootloader": {
"type": "string",
- "enum": ["atmel-dfu", "bootloadHID", "caterina", "halfkay", "kiibohd", "lufa-dfu", "lufa-ms", "micronucleus", "qmk-dfu", "stm32-dfu", "stm32duino", "unknown", "USBasp", "tinyuf2"]
+ "enum": ["atmel-dfu", "bootloadHID", "caterina", "halfkay", "kiibohd", "lufa-dfu", "lufa-ms", "micronucleus", "qmk-dfu", "qmk-hid", "stm32-dfu", "stm32duino", "unknown", "USBasp", "tinyuf2"]
},
"diode_direction": {
"type": "string",
"enum": ["COL2ROW", "ROW2COL"]
},
- "debounce": {
- "type": "number",
- "min": 0,
- "multipleOf": 1
- },
- "height": {
- "type": "number",
- "min": 0.25
- },
- "width": {
- "type": "number",
- "min": 0.25
- },
+ "debounce": {"$ref": "qmk.definitions.v1#/unsigned_int"},
"community_layouts": {
"type": "array",
- "items": {
- "type": "string",
- "minLength": 2,
- "pattern": "^[0-9a-z_]*$"
- }
- },
- "features": {
- "type": "object",
- "additionalProperties": {"type": "boolean"}
+ "items": {"$ref": "qmk.definitions.v1#/filename"}
},
+ "features": {"$ref": "qmk.definitions.v1#/boolean_array"},
"indicators": {
"type": "object",
"properties": {
- "caps_lock": {
- "type": "string",
- "pattern": "^[A-K]\\d{1,2}$"
- },
- "num_lock": {
- "type": "string",
- "pattern": "^[A-K]\\d{1,2}$"
- },
- "scroll_lock": {
- "type": "string",
- "pattern": "^[A-K]\\d{1,2}$"
- }
+ "caps_lock": {"$ref": "qmk.definitions.v1#/mcu_pin"},
+ "num_lock": {"$ref": "qmk.definitions.v1#/mcu_pin"},
+ "scroll_lock": {"$ref": "qmk.definitions.v1#/mcu_pin"}
}
},
"layout_aliases": {
"type": "object",
- "additionalProperties": {
- "oneOf": [
- {
- "type": "string",
- "enum": ["LAYOUT", "LAYOUT_planck_1x2uC"]
- },
- {
- "type": "string",
- "pattern": "^LAYOUT_[0-9a-z_]*$"
- }
- ]
- }
+ "additionalProperties": {"$ref": "qmk.definitions.v1#/layout_macro"}
},
"layouts": {
"type": "object",
@@ -109,11 +58,7 @@
"c_macro": {
"type": "boolean"
},
- "key_count": {
- "type": "number",
- "min": 0,
- "multipleOf": 1
- },
+ "key_count": {"$ref": "qmk.definitions.v1#/key_unit"},
"layout": {
"type": "array",
"items": {
@@ -131,34 +76,14 @@
"multipleOf": 1
}
},
- "h": {
- "type": "number",
- "min": 0.25
- },
- "r": {
- "type": "number",
- "min": 0
- },
- "rx": {
- "type": "number",
- "min": 0
- },
- "ry": {
- "type": "number",
- "min": 0
- },
- "w": {
- "type": "number",
- "min": 0.25
- },
- "x": {
- "type": "number",
- "min": 0
- },
- "y": {
- "type": "number",
- "min": 0
- }
+ "key_count": {"$ref": "qmk.definitions.v1#/key_unit"},
+ "r": {"$ref": "qmk.definitions.v1#/unsigned_decimal"},
+ "rx": {"$ref": "qmk.definitions.v1#/unsigned_decimal"},
+ "ry": {"$ref": "qmk.definitions.v1#/unsigned_decimal"},
+ "h": {"$ref": "qmk.definitions.v1#/key_unit"},
+ "w": {"$ref": "qmk.definitions.v1#/key_unit"},
+ "x": {"$ref": "qmk.definitions.v1#/key_unit"},
+ "y": {"$ref": "qmk.definitions.v1#/key_unit"}
}
}
}
@@ -171,61 +96,10 @@
"properties": {
"direct": {
"type": "array",
- "items": {
- "type": "array",
- "items": {
- "oneOf": [
- {
- "type": "string",
- "pattern": "^[A-K]\\d{1,2}$"
- },
- {
- "type": "number",
- "multipleOf": 1
- },
- {
- "type": "null"
- }
- ]
- }
- }
- },
- "cols": {
- "type": "array",
- "items": {
- "oneOf": [
- {
- "type": "string",
- "pattern": "^[A-K]\\d{1,2}$"
- },
- {
- "type": "number",
- "multipleOf": 1
- },
- {
- "type": "null"
- }
- ]
- }
+ "items": {$ref": "qmk.definitions.v1#/mcu_pin_array"}
},
- "rows": {
- "type": "array",
- "items": {
- "oneOf": [
- {
- "type": "string",
- "pattern": "^[A-K]\\d{1,2}$"
- },
- {
- "type": "number",
- "multipleOf": 1
- },
- {
- "type": "null"
- }
- ]
- }
- }
+ "cols": {"$ref": "qmk.definitions.v1#/mcu_pin_array"},
+ "rows": {"$ref": "qmk.definitions.v1#/mcu_pin_array"}
}
},
"rgblight": {
@@ -238,47 +112,19 @@
"type": "boolean"
}
},
- "brightness_steps": {
- "type": "number",
- "min": 0,
- "multipleOf": 1
- },
- "hue_steps": {
- "type": "number",
- "min": 0,
- "multipleOf": 1
- },
- "led_count": {
- "type": "number",
- "min": 0,
- "multipleOf": 1
- },
- "max_brightness": {
- "type": "number",
- "min": 0,
- "max": 255,
- "multipleOf": 1
- },
- "pin": {
- "type": "string",
- "pattern": "^[A-K]\\d{1,2}$"
- },
- "saturation_steps": {
- "type": "number",
- "min": 0,
- "multipleOf": 1
- },
+ "brightness_steps": {"$ref": "qmk.definitions.v1#/unsigned_int"},
+ "hue_steps": {"$ref": "qmk.definitions.v1#/unsigned_int"},
+ "led_count": {"$ref": "qmk.definitions.v1#/unsigned_int"},
+ "max_brightness": {"$ref": "qmk.definitions.v1#/unsigned_int_8"},
+ "pin": {"$ref": "qmk.definitions.v1#/mcu_pin"},
+ "saturation_steps": {"$ref": "qmk.definitions.v1#/unsigned_int"},
"sleep": {"type": "boolean"},
"split": {"type": "boolean"},
"split_count": {
"type": "array",
"minLength": 2,
"maxLength": 2,
- "items": {
- "type": "number",
- "min": 0,
- "multipleOf": 1
- }
+ "items": {"$ref": "qmk.definitions.v1#/unsigned_int"}
}
}
},
@@ -286,40 +132,19 @@
"type": "object",
"additionalProperties": false,
"properties": {
- "device_ver": {
- "type": "string",
- "pattern": "^[0-9A-F]x[0-9A-F][0-9A-F][0-9A-F][0-9A-F]"
- },
- "pid": {
- "type": "string",
- "pattern": "^[0-9A-F]x[0-9A-F][0-9A-F][0-9A-F][0-9A-F]"
- },
- "vid": {
- "type": "string",
- "pattern": "^[0-9A-F]x[0-9A-F][0-9A-F][0-9A-F][0-9A-F]"
- }
+ "device_ver": {"$ref": "qmk.definitions.v1#/hex_number_4d"},
+ "pid": {"$ref": "qmk.definitions.v1#/hex_number_4d"},
+ "vid": {"$ref": "qmk.definitions.v1#/hex_number_4d"}
}
},
"qmk_lufa_bootloader": {
"type": "object",
"additionalProperties": false,
"properties": {
- "esc_output": {
- "type": "string",
- "pattern": "^[A-K]\\d{1,2}$"
- },
- "esc_input": {
- "type": "string",
- "pattern": "^[A-K]\\d{1,2}$"
- },
- "led": {
- "type": "string",
- "pattern": "^[A-K]\\d{1,2}$"
- },
- "speaker": {
- "type": "string",
- "pattern": "^[A-K]\\d{1,2}$"
- }
+ "esc_output": {"$ref": "qmk.definitions.v1#/mcu_pin"},
+ "esc_input": {"$ref": "qmk.definitions.v1#/mcu_pin"},
+ "led": {"$ref": "qmk.definitions.v1#/mcu_pin"},
+ "speaker": {"$ref": "qmk.definitions.v1#/mcu_pin"}
}
}
}