Skip to content

Commit

Permalink
fix: Handle unaliased fields breaking zmk_combos
Browse files Browse the repository at this point in the history
Pydantic now returns None for field.alias if it doesn't
exist. This breaks `parse_config.zmk_combos` when you use
e.g. `draw_separate` which isn't aliased.

Fixes #77.
  • Loading branch information
caksoylar committed Mar 15, 2024
1 parent 88a7bd9 commit 2d2e0b4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion keymap_drawer/keymap.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def normalize_fields(cls, spec_dict: dict) -> dict:
"""Normalize spec_dict so that each field uses its alias and key is parsed to LayoutKey."""
for name, field in cls.model_fields.items():
if name in spec_dict:
spec_dict[field.alias] = spec_dict.pop(name)
spec_dict[field.alias or name] = spec_dict.pop(name)
if key_spec := spec_dict.get("k"):
spec_dict["k"] = LayoutKey.from_key_spec(key_spec)
return spec_dict
Expand Down

0 comments on commit 2d2e0b4

Please sign in to comment.