Skip to content

Commit

Permalink
Ugly, needs heavy refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
sourishkrout committed Nov 5, 2024
1 parent 002fb9f commit bab5aa7
Showing 1 changed file with 28 additions and 8 deletions.
36 changes: 28 additions & 8 deletions internal/owl/graph.go
Original file line number Diff line number Diff line change
Expand Up @@ -747,8 +747,15 @@ func init() {
opSet = specOpSet.OperationSet
case *ResolveOperationSet:
resolveOpSet = p.Source.(*ResolveOperationSet)
specOpSet = resolveOpSet.SpecOperationSet
opSet = specOpSet.OperationSet
if resolveOpSet.OperationSet != nil {
opSet = resolveOpSet.OperationSet
}
if resolveOpSet.SpecOperationSet != nil {
specOpSet = resolveOpSet.SpecOperationSet
}
if specOpSet != nil && specOpSet.OperationSet != nil {
opSet = specOpSet.OperationSet
}
default:
return nil, errors.New("source does not contain an OperationSet")
}
Expand Down Expand Up @@ -795,12 +802,19 @@ func init() {
return nil, errors.New("missing specDefs in context")
}

_, aitem, err := specOpSet.GetAtomic(spec, specDefs)
if err != nil {
return nil, err
specName := spec.Spec.Name
specRequired := spec.Spec.Required

if specOpSet != nil {
_, aitem, err := specOpSet.GetAtomic(spec, specDefs)
if err != nil {
return nil, err
}
specName = aitem.Spec.Name
specRequired = aitem.Spec.Required
}

if aitem.Spec.Name != AtomicNameSecret && aitem.Spec.Name != AtomicNamePassword && !aitem.Spec.Required {
if specName != AtomicNameSecret && specName != AtomicNamePassword && !specRequired {
v.Value.Status = "DELETED"
continue
}
Expand Down Expand Up @@ -881,8 +895,14 @@ func init() {
opSet = specOpSet.OperationSet
case *ResolveOperationSet:
resolveOpSet = p.Source.(*ResolveOperationSet)
specOpSet = resolveOpSet.SpecOperationSet
opSet = specOpSet.OperationSet
if resolveOpSet.OperationSet != nil {
specOpSet = resolveOpSet.SpecOperationSet
}
if specOpSet != nil && specOpSet.OperationSet != nil {
opSet = specOpSet.OperationSet
} else {
opSet = resolveOpSet.OperationSet
}
default:
return nil, errors.New("source does not contain an OperationSet")
}
Expand Down

0 comments on commit bab5aa7

Please sign in to comment.