Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions internal/configuration/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ import (

// Node represents a system component
type Node struct {
ID string `yaml:"id"`
Type string `yaml:"type"`
Parent string `yaml:"parent,omitempty"`
Attributes map[string]interface{} `yaml:"attributes,omitempty"`
ID string `yaml:"id"`
Type string `yaml:"type"`
Parent string `yaml:"parent,omitempty"`
Attributes map[string]any `yaml:"attributes,omitempty"`
}

// Link represents an interaction between nodes
type Link struct {
ID string `yaml:"-"`
Source string `yaml:"source"`
Target string `yaml:"target"`
Type string `yaml:"type"`
Attributes map[string]interface{} `yaml:"attributes,omitempty"`
ID string `yaml:"-"`
Source string `yaml:"source"`
Target string `yaml:"target"`
Type string `yaml:"type"`
Attributes map[string]any `yaml:"attributes,omitempty"`
}

// Config holds the aggregated architecture
Expand Down
13 changes: 5 additions & 8 deletions internal/query/execute.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package query

import (
"fmt"
"slices"

"github.com/UnitVectorY-Labs/YAMLtecture/internal/configuration"
)
Expand Down Expand Up @@ -325,10 +326,8 @@ func isChildOf(nodeID string, targetNodeID string, ctx *ConfigContext) (bool, er
}

// Check if nodeID is a direct child of targetNodeID
for _, childID := range ctx.ChildrenMap[targetNodeID] {
if childID == nodeID {
return true, nil
}
if slices.Contains(ctx.ChildrenMap[targetNodeID], nodeID) {
return true, nil
}

// If we get here, nodeID is not a child of targetNodeID
Expand Down Expand Up @@ -365,10 +364,8 @@ func isDescendantOf(nodeID string, targetNodeID string, ctx *ConfigContext) (boo
}

// Check direct children first
for _, childID := range children {
if childID == nodeID {
return true, nil
}
if slices.Contains(children, nodeID) {
return true, nil
}

// If not found in direct children, check deeper descendants
Expand Down
Loading