Skip to content

Commit e42bc86

Browse files
committed
Fix: missing entity context for mirrored attributes
1 parent 52e2515 commit e42bc86

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

dp3/common/config.py

+8-7
Original file line numberDiff line numberDiff line change
@@ -353,13 +353,14 @@ def _fill_and_validate_mirrors(self):
353353
linked_entity = attr_spec.relation_to
354354
linked_attr = attr_spec.mirror_as
355355

356-
mirror_attr = AttrSpecReadOnly(
357-
id=linked_attr,
358-
name=linked_attr,
359-
data_type=f"set<link<{entity}>>",
360-
type="plain",
361-
description=f"Read-only mirror attribute of {entity}.{attr}",
362-
)
356+
with entity_context(self.entities[entity], self.entities):
357+
mirror_attr = AttrSpecReadOnly(
358+
id=linked_attr,
359+
name=linked_attr,
360+
data_type=f"set<link<{entity}>>",
361+
type="plain",
362+
description=f"Read-only mirror attribute of {entity}.{attr}",
363+
)
363364

364365
# We will accept correct definitions of mirrored attributes to fix errors when
365366
# a `ModelSpec` instance is validated again (e.g. when passed to `PlatformConfig`)

0 commit comments

Comments
 (0)