From cdff9b8da710df29da2d977da0c6cf2b5ba1bf7b Mon Sep 17 00:00:00 2001 From: Joel Challis Date: Wed, 20 Sep 2023 14:13:51 +0100 Subject: [PATCH] Restrict "feature" and "animation" keys (#21895) --- data/schemas/definitions.jsonschema | 4 ++++ data/schemas/keyboard.jsonschema | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/data/schemas/definitions.jsonschema b/data/schemas/definitions.jsonschema index b9c64a55ec44..441e6395cf6e 100644 --- a/data/schemas/definitions.jsonschema +++ b/data/schemas/definitions.jsonschema @@ -29,6 +29,10 @@ "minLength": 1, "maxLength": 250 }, + "snake_case": { + "type": "string", + "pattern": "^[a-z][a-z0-9_]*$" + }, "layout_macro": { "oneOf": [ { diff --git a/data/schemas/keyboard.jsonschema b/data/schemas/keyboard.jsonschema index 901caa75fee3..4053387f3b42 100644 --- a/data/schemas/keyboard.jsonschema +++ b/data/schemas/keyboard.jsonschema @@ -256,7 +256,11 @@ "enabled": {"type": "boolean"} } }, - "features": {"$ref": "qmk.definitions.v1#/boolean_array"}, + "features": { + "$ref": "qmk.definitions.v1#/boolean_array", + "propertyNames": { "$ref": "qmk.definitions.v1#/snake_case" } + + }, "indicators": { "type": "object", "properties": { @@ -370,6 +374,7 @@ "properties": { "animations": { "type": "object", + "propertyNames": { "$ref": "qmk.definitions.v1#/snake_case" } "additionalProperties": { "type": "boolean" } @@ -419,6 +424,7 @@ "properties": { "animations": { "type": "object", + "propertyNames": { "$ref": "qmk.definitions.v1#/snake_case" } "additionalProperties": { "type": "boolean" } @@ -471,6 +477,7 @@ "properties": { "animations": { "type": "object", + "propertyNames": { "$ref": "qmk.definitions.v1#/snake_case" } "additionalProperties": { "type": "boolean" }