Component
API Server / GraphQL
Infrahub version
unknown (server unreachable at time of report)
Current Behavior
When loading a directory of schema files with infrahubctl schema load <dir>, the
load fails if:
- One file defines a node with
generate_template: true (e.g. DcimDevice)
- Another file in the same load batch references the auto-generated template node
as a relationship peer (e.g. peer: TemplateDcimDevice)
Error:
Unable to load the schema:
Unable to find the schema 'TemplateDcimDevice' in the registry
The auto-generated TemplateDcimDevice node does not yet exist in the registry at
validation time — it would only be created as a by-product of loading the schema
that carries generate_template: true. The validator checks peer node existence
before that generation step runs, so the two schemas can never be loaded together.
Expected Behavior
When a co-loaded schema defines a node with generate_template: true, the
validator should recognise that Template<Namespace><Name> will exist after
loading, and allow other schemas in the same batch to reference that node as a
relationship peer.
Steps to Reproduce
- Create
schemas/base/dcim.yml with a node that has generate_template: true:
nodes:
- name: Device
namespace: Dcim
generate_template: true
# ... other attributes
- Create
schemas/otn.yml with a node that references the generated template:
nodes:
- name: DesignDeviceEntry
namespace: Otn
relationships:
- name: template
peer: TemplateDcimDevice # auto-generated from DcimDevice
kind: Attribute
cardinality: one
- Run
infrahubctl schema load schemas
- Observe:
Unable to find the schema 'TemplateDcimDevice' in the registry
Additional Information
The generated node name follows the pattern Template<Namespace><NodeName>, so
DcimDevice with generate_template: true produces TemplateDcimDevice. This
naming is documented and expected, but the schema batch loader does not account
for it during peer validation.
Related: #6836 (template creation forces parent template) — same category of
issue where template node generation order creates unexpected constraints.
Environment
- infrahub-sdk: v1.20.1
- Python: 3.12.11
- OS: macOS arm64
Component
API Server / GraphQL
Infrahub version
unknown (server unreachable at time of report)
Current Behavior
When loading a directory of schema files with
infrahubctl schema load <dir>, theload fails if:
generate_template: true(e.g.DcimDevice)as a relationship peer (e.g.
peer: TemplateDcimDevice)Error:
The auto-generated
TemplateDcimDevicenode does not yet exist in the registry atvalidation time — it would only be created as a by-product of loading the schema
that carries
generate_template: true. The validator checks peer node existencebefore that generation step runs, so the two schemas can never be loaded together.
Expected Behavior
When a co-loaded schema defines a node with
generate_template: true, thevalidator should recognise that
Template<Namespace><Name>will exist afterloading, and allow other schemas in the same batch to reference that node as a
relationship peer.
Steps to Reproduce
schemas/base/dcim.ymlwith a node that hasgenerate_template: true:schemas/otn.ymlwith a node that references the generated template:infrahubctl schema load schemasUnable to find the schema 'TemplateDcimDevice' in the registryAdditional Information
The generated node name follows the pattern
Template<Namespace><NodeName>, soDcimDevicewithgenerate_template: trueproducesTemplateDcimDevice. Thisnaming is documented and expected, but the schema batch loader does not account
for it during peer validation.
Related: #6836 (template creation forces parent template) — same category of
issue where template node generation order creates unexpected constraints.
Environment