mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-07 17:48:29 +08:00
fix: process null value in yaml (#37418)
issue: #34298 fix key: null defined in the yaml file. viper will parse it as "", and yaml v3 will parse it as "null". Signed-off-by: xianliang.li <xianliang.li@zilliz.com>
This commit is contained in:
parent
9fe90bf357
commit
1b98bb423a
@ -96,9 +96,15 @@ func flattenNode(node *yaml.Node, parentKey string, result map[string]string) {
|
|||||||
|
|
||||||
switch valueNode.Kind {
|
switch valueNode.Kind {
|
||||||
case yaml.ScalarNode:
|
case yaml.ScalarNode:
|
||||||
// Scalar value, store it as a string
|
// handle null value
|
||||||
result[lowerKey(fullKey)] = valueNode.Value
|
if valueNode.Tag == "!!null" {
|
||||||
result[formatKey(fullKey)] = valueNode.Value
|
result[lowerKey(fullKey)] = ""
|
||||||
|
result[formatKey(fullKey)] = ""
|
||||||
|
} else {
|
||||||
|
// Scalar value, store it as a string
|
||||||
|
result[lowerKey(fullKey)] = valueNode.Value
|
||||||
|
result[formatKey(fullKey)] = valueNode.Value
|
||||||
|
}
|
||||||
case yaml.MappingNode:
|
case yaml.MappingNode:
|
||||||
// Nested map, process recursively
|
// Nested map, process recursively
|
||||||
flattenNode(valueNode, fullKey, result)
|
flattenNode(valueNode, fullKey, result)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user