fix compilation error in generated go code (#5061)

This commit is contained in:
Sebastien Rosset 2020-01-21 01:32:38 -08:00 committed by William Cheng
parent 6f5f16aaee
commit ff7203875f
2 changed files with 18 additions and 14 deletions

View File

@ -127,6 +127,7 @@ func (r api{{operationId}}Request) Execute() ({{#returnType}}{{{.}}}, {{/returnT
{{#queryParams}}
{{#required}}
{{#isCollectionFormatMulti}}
{
t := *r.{{paramName}}
if reflect.TypeOf(t).Kind() == reflect.Slice {
s := reflect.ValueOf(t)
@ -136,6 +137,7 @@ func (r api{{operationId}}Request) Execute() ({{#returnType}}{{{.}}}, {{/returnT
} else {
localVarQueryParams.Add("{{baseName}}", parameterToString(t, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}"))
}
}
{{/isCollectionFormatMulti}}
{{^isCollectionFormatMulti}}
localVarQueryParams.Add("{{baseName}}", parameterToString(*r.{{paramName}}, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}"))

View File

@ -1757,6 +1757,7 @@ func (r apiTestQueryParameterCollectionFormatRequest) Execute() (*_nethttp.Respo
localVarQueryParams.Add("ioutil", parameterToString(*r.ioutil, "csv"))
localVarQueryParams.Add("http", parameterToString(*r.http, "space"))
localVarQueryParams.Add("url", parameterToString(*r.url, "csv"))
{
t := *r.context
if reflect.TypeOf(t).Kind() == reflect.Slice {
s := reflect.ValueOf(t)
@ -1766,6 +1767,7 @@ func (r apiTestQueryParameterCollectionFormatRequest) Execute() (*_nethttp.Respo
} else {
localVarQueryParams.Add("context", parameterToString(t, "multi"))
}
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}