Skip to content

Commit

Permalink
Fix how models get reassigned after normalize
Browse files Browse the repository at this point in the history
  • Loading branch information
godrei committed Jul 30, 2024
1 parent 3e63fb7 commit c5a9596
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions models/models_methods.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ func (workflow *WorkflowModel) Normalize() error {
return err
}

stepListItem[key] = step
stepListItem[key] = *step
workflow.Steps[idx] = stepListItem
} else if t == StepListItemTypeBundle {
bundle, err := stepListItem.GetBundle()
Expand All @@ -202,7 +202,7 @@ func (workflow *WorkflowModel) Normalize() error {
return err
}

stepListItem[key] = bundle
stepListItem[StepListItemStepBundleKeyPrefix+key] = *bundle
workflow.Steps[idx] = stepListItem
} else if t == StepListItemTypeWith {
with, err := stepListItem.GetWith()
Expand All @@ -214,7 +214,7 @@ func (workflow *WorkflowModel) Normalize() error {
return err
}

stepListItem[key] = with
stepListItem[key] = *with
workflow.Steps[idx] = stepListItem
}
}
Expand Down Expand Up @@ -716,7 +716,7 @@ func validateWorkflows(config *BitriseDataModel) ([]string, error) {
}

// TODO: Why is this assignment needed?
stepListItem[stepID] = step
stepListItem[stepID] = *step
} else if t == StepListItemTypeWith {
with, err := stepListItem.GetWith()
if err != nil {
Expand Down Expand Up @@ -1375,14 +1375,6 @@ func (stepListItem *StepListItemModel) GetStep() (*stepmanModels.StepModel, erro
break
}

// StepListItemModel is a map[string]interface{}, when it comes from a JSON/YAML unmarshal
// the StepModel has a pointer type.
sPtr, ok := value.(*stepmanModels.StepModel)
if ok {
stepPtr = sPtr
break
}

break
}

Expand Down

0 comments on commit c5a9596

Please sign in to comment.