diff --git a/backend/infrahub/core/schema/schema_branch.py b/backend/infrahub/core/schema/schema_branch.py index e433383cd4..44a27f200d 100644 --- a/backend/infrahub/core/schema/schema_branch.py +++ b/backend/infrahub/core/schema/schema_branch.py @@ -2051,8 +2051,6 @@ def add_relationships_to_template(self, node: NodeSchema | GenericSchema) -> Non template_schema.relationships = [ r for r in template_schema.relationships if r.kind == RelationshipKind.TEMPLATE ] - # Tell if the user explicitely requested this template - is_autogenerated_subtemplate = node.generate_template is False for relationship in node.relationships: if relationship.peer in [InfrahubKind.GENERICGROUP, InfrahubKind.PROFILE] or relationship.kind not in [ @@ -2068,10 +2066,6 @@ def add_relationships_to_template(self, node: NodeSchema | GenericSchema) -> Non if relationship.kind not in [RelationshipKind.ATTRIBUTE, RelationshipKind.GENERIC] else relationship.peer ) - - is_optional = ( - relationship.optional if is_autogenerated_subtemplate else relationship.kind != RelationshipKind.PARENT - ) identifier = ( f"template_{relationship.identifier}" if relationship.identifier @@ -2088,7 +2082,7 @@ def add_relationships_to_template(self, node: NodeSchema | GenericSchema) -> Non name=relationship.name, peer=rel_template_peer, kind=relationship.kind, - optional=is_optional, + optional=True, cardinality=relationship.cardinality, direction=relationship.direction, branch=relationship.branch,