opensteno_qmk/data/schemas/keymap.jsonschema
Erovia fbfd5312b9
CLI: Validate JSON keymap input (#16261)
* Fix schema validator

It should use the passed schema.

* Add required attributes to keymap schema

* Rework subcommands to validate the JSON keymaps

The 'compile', 'flash' and 'json2c' subcommands were reworked to add
JSON keymap validation so error is reported for non-JSON and
non-compliant-JSON inputs.

* Fix required fields in keymap schema

* Add tests

* Fix compiling keymaps directly from keymap directory

* Schema should not require version for now.
2022-02-28 20:02:39 +00:00

62 lines
2.1 KiB
Text

{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "qmk.keymap.v1",
"title": "Keymap Information",
"type": "object",
"properties": {
"author": {"type": "string"},
"host_language": {"$ref": "qmk.definitions.v1#/text_identifier"},
"keyboard": {"$ref": "qmk.definitions.v1#/text_identifier"},
"keymap": {"$ref": "qmk.definitions.v1#/text_identifier"},
"layout": {"$ref": "qmk.definitions.v1#/layout_macro"},
"layers": {
"type": "array",
"items": {
"type": "array",
"items": {"type": "string"}
}
},
"macros": {
"type": "array",
"items": {
"type": "array",
"items": {
"oneOf": [
{
"type": "string"
},
{
"type": "object",
"additionalProperties": false,
"properties": {
"action": {
"type": "string",
"enum": ['beep', 'delay', 'down', 'tap', 'up']
},
"keycodes": {
"type": "array",
"items": {
"$ref": "qmk.definitions.v1#/text_identifier"
}
},
"duration": {
"$ref": "qmk.definitions.v1#/unsigned_int"
}
}
}
]
}
}
},
"config": {"$ref": "qmk.keyboard.v1"},
"notes": {
"type": "string",
"description": "asdf"
}
},
"required": [
"keyboard",
"layout",
"layers"
]
}