aboutsummaryrefslogtreecommitdiffhomepage
path: root/schema
diff options
context:
space:
mode:
authorPeter Johanson <[email protected]>2021-03-27 20:51:04 -0400
committerPete Johanson <[email protected]>2021-09-11 00:50:36 -0400
commit1d69bdda602e5de1339a3b4713cf594e4852fb24 (patch)
treeab4b3904e05c647c32f7510347c2d1ca292db1e4 /schema
parent4a5454b0f9f2cbf755f507ab2a233a2f8c4a2fd3 (diff)
downloadzmk-1d69bdda602e5de1339a3b4713cf594e4852fb24.tar.gz
zmk-1d69bdda602e5de1339a3b4713cf594e4852fb24.zip
feat: Add hardware metadata schema.
* Initial hardware metadata JSON schema. * GH Action to validate all schemas for boards/shields.
Diffstat (limited to 'schema')
-rw-r--r--schema/hardware-metadata.schema.json261
1 files changed, 261 insertions, 0 deletions
diff --git a/schema/hardware-metadata.schema.json b/schema/hardware-metadata.schema.json
new file mode 100644
index 0000000000..a74c6ef141
--- /dev/null
+++ b/schema/hardware-metadata.schema.json
@@ -0,0 +1,261 @@
+{
+ "$id": "https://zmkfirmware.dev/zmk.metadata.json",
+ "title": "HardwareMetadata",
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "oneOf": [
+ {
+ "$ref": "#/$defs/board"
+ },
+ {
+ "$ref": "#/$defs/shield"
+ },
+ {
+ "$ref": "#/$defs/interconnect"
+ }
+ ],
+ "$defs": {
+ "id": {
+ "type": "string",
+ "pattern": "^[a-z0-9_]+$"
+ },
+ "keyboard_siblings": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "variant": {
+ "oneOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "object",
+ "required": [
+ "id",
+ "features"
+ ],
+ "properties": {
+ "id": {
+ "$ref": "#/$defs/id"
+ },
+ "features": {
+ "$ref": "#/$defs/features"
+ }
+ }
+ }
+ ]
+ },
+ "features": {
+ "type": "array",
+ "items": {
+ "type": "string",
+ "enum": [
+ "keys",
+ "display",
+ "encoder",
+ "underglow",
+ "pointer"
+ ]
+ }
+ },
+ "interconnects": {
+ "type": "array",
+ "minItems": 1,
+ "items": {
+ "$ref": "#/$defs/id"
+ }
+ },
+ "sibling_details": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "id": {
+ "$ref": "#/$defs/id"
+ },
+ "features": {
+ "$ref": "#/$defs/features"
+ },
+ "variants": {
+ "type": "array",
+ "items": {
+ "$ref": "#/$defs/variant"
+ }
+ }
+ }
+ },
+ "interconnect": {
+ "title": "Interconnect",
+ "type": "object",
+ "additionalProperties": false,
+ "required": [
+ "file_format",
+ "id",
+ "name",
+ "url",
+ "type"
+ ],
+ "properties": {
+ "file_format": {
+ "type": "string",
+ "const": "1"
+ },
+ "id": {
+ "$ref": "#/$defs/id"
+ },
+ "name": {
+ "type": "string"
+ },
+ "version": {
+ "type": "string"
+ },
+ "url": {
+ "type": "string",
+ "format": "uri"
+ },
+ "description": {
+ "type": "string"
+ },
+ "manufacturer": {
+ "type": "string"
+ },
+ "type": {
+ "type": "string",
+ "const": "interconnect"
+ }
+ }
+ },
+ "board": {
+ "title": "Board",
+ "type": "object",
+ "additionalProperties": false,
+ "required": [
+ "file_format",
+ "id",
+ "name",
+ "url",
+ "arch",
+ "type",
+ "outputs"
+ ],
+ "properties": {
+ "file_format": {
+ "type": "string",
+ "const": "1"
+ },
+ "id": {
+ "$ref": "#/$defs/id"
+ },
+ "name": {
+ "type": "string"
+ },
+ "version": {
+ "type": "string"
+ },
+ "url": {
+ "type": "string",
+ "format": "uri"
+ },
+ "description": {
+ "type": "string"
+ },
+ "manufacturer": {
+ "type": "string"
+ },
+ "arch": {
+ "type": "string",
+ "pattern": "^[a-z0-9_]+$"
+ },
+ "type": {
+ "type": "string",
+ "const": "board"
+ },
+ "siblings": {
+ "$ref": "#/$defs/keyboard_siblings"
+ },
+ "outputs": {
+ "type": "array",
+ "items": {
+ "type": "string",
+ "enum": [
+ "usb",
+ "ble"
+ ]
+ }
+ },
+ "features": {
+ "$ref": "#/$defs/features"
+ },
+ "variants": {
+ "type": "array",
+ "items": {
+ "$ref": "#/$defs/variant"
+ }
+ },
+ "exposes": {
+ "$ref": "#/$defs/interconnects"
+ }
+ }
+ },
+ "shield": {
+ "title": "Shield",
+ "type": "object",
+ "additionalProperties": false,
+ "required": [
+ "file_format",
+ "id",
+ "name",
+ "url",
+ "type",
+ "requires"
+ ],
+ "properties": {
+ "file_format": {
+ "type": "string",
+ "const": "1"
+ },
+ "id": {
+ "$ref": "#/$defs/id"
+ },
+ "name": {
+ "type": "string"
+ },
+ "url": {
+ "type": "string",
+ "format": "uri"
+ },
+ "description": {
+ "type": "string"
+ },
+ "manufacturer": {
+ "type": "string"
+ },
+ "version": {
+ "type": "string"
+ },
+ "type": {
+ "type": "string",
+ "const": "shield"
+ },
+ "features": {
+ "$ref": "#/$defs/features"
+ },
+ "variants": {
+ "type": "array",
+ "items": {
+ "$ref": "#/$defs/variant"
+ }
+ },
+ "siblings": {
+ "$ref": "#/$defs/keyboard_siblings"
+ },
+ "requires": {
+ "$ref": "#/$defs/interconnects"
+ },
+ "exposes": {
+ "$ref": "#/$defs/interconnects"
+ }
+ }
+ }
+ }
+}