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,14 +127,16 @@ 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)
for i := 0; i < s.Len(); i++ {
localVarQueryParams.Add("{{baseName}}", parameterToString(s.Index(i), "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}"))
{
t := *r.{{paramName}}
if reflect.TypeOf(t).Kind() == reflect.Slice {
s := reflect.ValueOf(t)
for i := 0; i < s.Len(); i++ {
localVarQueryParams.Add("{{baseName}}", parameterToString(s.Index(i), "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}"))
}
} else {
localVarQueryParams.Add("{{baseName}}", parameterToString(t, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}"))
}
} else {
localVarQueryParams.Add("{{baseName}}", parameterToString(t, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}"))
}
{{/isCollectionFormatMulti}}
{{^isCollectionFormatMulti}}

View File

@ -1757,14 +1757,16 @@ 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)
for i := 0; i < s.Len(); i++ {
localVarQueryParams.Add("context", parameterToString(s.Index(i), "multi"))
{
t := *r.context
if reflect.TypeOf(t).Kind() == reflect.Slice {
s := reflect.ValueOf(t)
for i := 0; i < s.Len(); i++ {
localVarQueryParams.Add("context", parameterToString(s.Index(i), "multi"))
}
} else {
localVarQueryParams.Add("context", parameterToString(t, "multi"))
}
} else {
localVarQueryParams.Add("context", parameterToString(t, "multi"))
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}