Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IFC-1348 Make templates for generics generics #5938

Draft
wants to merge 2 commits into
base: release-1.2
Choose a base branch
from

Conversation

gmazoyer
Copy link
Contributor

@gmazoyer gmazoyer commented Mar 5, 2025

A generic cannot be created as an object until we decide which implementation of the generic should be used. This also applies to templates, a generic cannot be used to create an object when the instantiation happends through templating.

To avoid issues where a user would use a relationships pointing to a generic, templates for each implementation of the generic are now computed. This means that if we have a relationship setup like:

relationships:
- name: interfaces
  peer: DcimInterface
  optional: true
  cardinality: many
  kind: Component

With inheritance layout setup like:

DcimInterface
  |
  +--> DcimPhysicalInterface
  |
  +--> DcimVirtualInterface

We will generate 1 generic called TemplateDcimInterface and 2 templates called TemplateDcimPhysicalInterface and TemplateDcimVirtualInterface. Both templates will inherit from TemplateDcimInterface.

The relationship mentioned above, in the corresponding template, will be represented as:

relationships:
- name: interfaces
  peer: TemplateDcimInterface
  optional: true
  cardinality: many
  kind: Component

This will allow us to create and attach either TemplateDcimPhysicalInterface or TemplateDcimVirtualInterface to the template node.

@github-actions github-actions bot added the group/backend Issue related to the backend (API Server, Git Agent) label Mar 5, 2025
Copy link

codspeed-hq bot commented Mar 5, 2025

CodSpeed Performance Report

Merging #5938 will not alter performance

Comparing gma-20250305-ifc1348 (3cf2578) with release-1.2 (5d9fbae)

Summary

✅ 10 untouched benchmarks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
group/backend Issue related to the backend (API Server, Git Agent)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant