Skip to content

Commit b362ae1

Browse files
authored
Fix template generation for generics (#5840)
The previous logic was missing bits to identify required templates for relationships of kind component/parent.
1 parent 504b8f1 commit b362ae1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

backend/infrahub/core/schema/schema_branch.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1899,7 +1899,7 @@ def generate_object_template_from_node(self, node: NodeSchema) -> TemplateSchema
18991899
return template
19001900

19011901
def identify_required_object_templates(
1902-
self, node_schema: NodeSchema, identified: set[NodeSchema]
1902+
self, node_schema: NodeSchema | GenericSchema, identified: set[NodeSchema | GenericSchema]
19031903
) -> set[NodeSchema]:
19041904
"""Identify all templates required to turn a given node into a template."""
19051905
if node_schema in identified:
@@ -1915,15 +1915,15 @@ def identify_required_object_templates(
19151915
continue
19161916

19171917
peer_schema = self.get(name=relationship.peer, duplicate=False)
1918-
if not isinstance(peer_schema, NodeSchema) or peer_schema in identified:
1918+
if not isinstance(peer_schema, NodeSchema | GenericSchema) or peer_schema in identified:
19191919
continue
19201920

19211921
identified |= self.identify_required_object_templates(node_schema=peer_schema, identified=identified)
19221922

19231923
return identified
19241924

19251925
def manage_object_template_schemas(self) -> None:
1926-
need_templates: set[NodeSchema] = set()
1926+
need_templates: set[NodeSchema | GenericSchema] = set()
19271927
template_schema_kinds: set[str] = set()
19281928

19291929
for node_name in self.node_names + self.generic_names:

0 commit comments

Comments
 (0)