I'm trying to use the zero value of a map as a tag-map query parameter type. This is producing an unexpected encoding, tags[]=null -- if there aren't any tags in the tag-map, no tags[] query parameters should be produced. Here's a reproduction case:
var nilTags map[string]string
result, _ := runtime.StyleParamWithOptions(
"deepObject", true, "tags", nilTags,
runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery},
)
fmt.Println("unexpected", result) // "tags[]=null"
(https://go.dev/play/p/Xa-sVpopeE_K)
This behavior is due to the json-marshalling-and-unmarshalling step in deepobject.go's MarshalDeepObject function, which obscures that the input is a nil map, not another type of nil.
I'm trying to use the zero value of a map as a tag-map query parameter type. This is producing an unexpected encoding,
tags[]=null-- if there aren't any tags in the tag-map, notags[]query parameters should be produced. Here's a reproduction case:(https://go.dev/play/p/Xa-sVpopeE_K)
This behavior is due to the json-marshalling-and-unmarshalling step in deepobject.go's MarshalDeepObject function, which obscures that the input is a nil map, not another type of nil.