Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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, ",")
}
}
}
}

Expand Down
Loading