mirror of
https://github.com/glanceapp/glance.git
synced 2025-06-21 18:31:24 +02:00
Add support for bool in query params fields
This commit is contained in:
parent
e373eeeed3
commit
c0bdf1551d
@ -231,12 +231,15 @@ func (q *queryParametersField) UnmarshalYAML(node *yaml.Node) error {
|
|||||||
|
|
||||||
*q = make(queryParametersField)
|
*q = make(queryParametersField)
|
||||||
|
|
||||||
|
// TODO: refactor the duplication in the switch cases if any more types get added
|
||||||
for key, value := range decoded {
|
for key, value := range decoded {
|
||||||
switch v := value.(type) {
|
switch v := value.(type) {
|
||||||
case string:
|
case string:
|
||||||
(*q)[key] = []string{v}
|
(*q)[key] = []string{v}
|
||||||
case int, int8, int16, int32, int64, float32, float64:
|
case int, int8, int16, int32, int64, float32, float64:
|
||||||
(*q)[key] = []string{fmt.Sprintf("%v", v)}
|
(*q)[key] = []string{fmt.Sprintf("%v", v)}
|
||||||
|
case bool:
|
||||||
|
(*q)[key] = []string{fmt.Sprintf("%t", v)}
|
||||||
case []string:
|
case []string:
|
||||||
(*q)[key] = append((*q)[key], v...)
|
(*q)[key] = append((*q)[key], v...)
|
||||||
case []any:
|
case []any:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user