diff --git a/pkg/microservice/aslan/core/workflow/service/workflow/controller/job/utils.go b/pkg/microservice/aslan/core/workflow/service/workflow/controller/job/utils.go index 03f6f8bad7..5c8d84d4dd 100644 --- a/pkg/microservice/aslan/core/workflow/service/workflow/controller/job/utils.go +++ b/pkg/microservice/aslan/core/workflow/service/workflow/controller/job/utils.go @@ -196,12 +196,13 @@ func applyKeyVals(base, input commonmodels.RuntimeKeyValList, useInputKVSource b if (item.Source != config.ParamSourceFixed && item.Source != config.ParamSourceReference) || useInputKVSource { if item.Type == commonmodels.MultiSelectType { item.ChoiceValue = inputKV.ChoiceValue - // TODO: move this logic to somewhere else - if inputKV.Value == "" { - item.Value = strings.Join(item.ChoiceValue, ",") - } else { - item.Value = inputKV.Value + // ChoiceValue is the canonical multi-select value. Keep Value as its + // comma-separated runtime representation so older consumers remain compatible. + if item.ChoiceValue == nil && inputKV.Value != "" { + // Older callers may only send Value, so backfill ChoiceValue before normalizing. + item.ChoiceValue = strings.Split(inputKV.Value, ",") } + item.Value = strings.Join(item.ChoiceValue, ",") } else if item.Type == commonmodels.FileType { item.FileID = inputKV.FileID item.FilePath = inputKV.FilePath diff --git a/pkg/microservice/aslan/core/workflow/service/workflow/types.go b/pkg/microservice/aslan/core/workflow/service/workflow/types.go index 41ebaeb377..e73862dadd 100644 --- a/pkg/microservice/aslan/core/workflow/service/workflow/types.go +++ b/pkg/microservice/aslan/core/workflow/service/workflow/types.go @@ -19,6 +19,7 @@ package workflow import ( "errors" "fmt" + "strings" "github.com/koderover/zadig/v2/pkg/microservice/aslan/config" commonmodels "github.com/koderover/zadig/v2/pkg/microservice/aslan/core/common/repository/models" @@ -325,6 +326,13 @@ func OpenAPIKVInputToKeyValList(originalKvs commonmodels.RuntimeKeyValList, kvIn if kvInput, ok := kvMap[kv.Key]; ok { kv.Value = kvInput.Value + if kv.Type == commonmodels.MultiSelectType { + // OpenAPI only sends Value, so keep ChoiceValue in sync for multi-select consumers. + kv.ChoiceValue = nil + if kvInput.Value != "" { + kv.ChoiceValue = strings.Split(kvInput.Value, ",") + } + } } }