Skip to content

Commit

Permalink
fix: Disallow unknown fields in LayoutKey and ComboSpec
Browse files Browse the repository at this point in the history
  • Loading branch information
caksoylar committed Mar 15, 2024
1 parent 18e8d72 commit 88a7bd9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions keymap_drawer/keymap.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 88a7bd9

Please sign in to comment.