Skip to content

Commit a17da1a

Browse files
committed
Refactor ActionGroup to use oid as the primary identifier and remove redundant id field
1 parent d8cffb5 commit a17da1a

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

pyoverkiz/models.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -511,17 +511,16 @@ class ActionGroup:
511511
notification_text: str | None = None
512512
notification_title: str | None = None
513513
oid: str | None = field(repr=obfuscate_id, default=None)
514-
id: str | None = field(repr=obfuscate_id, default=None)
515514

516515
def __attrs_post_init__(self) -> None:
517-
"""Resolve id/oid fallback."""
516+
"""Default label to empty string when None."""
518517
if self.label is None:
519518
self.label = ""
520-
if self.oid is None and self.id is None:
521-
raise ValueError("Either 'oid' or 'id' must be provided")
522-
resolved = cast(str, self.oid or self.id)
523-
self.id = resolved
524-
self.oid = resolved
519+
520+
@property
521+
def id(self) -> str | None:
522+
"""Alias for oid."""
523+
return self.oid
525524

526525

527526
@define(kw_only=True)

0 commit comments

Comments
 (0)