From 88a7bd9ec60139fb0f8107ebb618e21790721528 Mon Sep 17 00:00:00 2001 From: Cem Aksoylar Date: Thu, 14 Mar 2024 21:13:31 -0700 Subject: [PATCH] fix: Disallow unknown fields in LayoutKey and ComboSpec --- keymap_drawer/keymap.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/keymap_drawer/keymap.py b/keymap_drawer/keymap.py index 8bd9cd8..9aedd66 100644 --- a/keymap_drawer/keymap.py +++ b/keymap_drawer/keymap.py @@ -14,7 +14,7 @@ from .physical_layout import PhysicalLayout, layout_factory -class LayoutKey(BaseModel, populate_by_name=True, coerce_numbers_to_str=True): +class LayoutKey(BaseModel, populate_by_name=True, coerce_numbers_to_str=True, extra="forbid"): """ Represents a binding in the keymap, which has a tap property by default and can optionally have hold or shifted properties, or be "held" or be a "ghost" key. @@ -51,7 +51,7 @@ def full_serializer(self) -> dict[str, str]: return {k: v for k in ("tap", "hold", "shifted", "type") if (v := getattr(self, k))} -class ComboSpec(BaseModel, populate_by_name=True): +class ComboSpec(BaseModel, populate_by_name=True, extra="forbid"): """ Represents a combo in the keymap, with the trigger positions, activated binding (key) and layers that it is present on.