Skip to content

Commit

Permalink
fix(GO): fix type mismatch for nested args (#515)
Browse files Browse the repository at this point in the history
In a previous PR the assumed type of nested arg was a map with string keys and interface typed values which raised mismatch error. This PR fixes it by asserting keys to be of type interface as well.

fix(GO): fix type mismatch error

fix(CLI): retrigger release for GO
  • Loading branch information
hahmed-dev authored Jan 2, 2024
1 parent 8ec6595 commit fca7edb
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion clients/go/test/api_uploads_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion openapi-generator/templates/cli/api.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ func init{{{nickname}}}() {
{{/required~}}
{{/allParams~}}

// trigger API request using phrase-go client
data, api_response, err := client.{{classname}}.{{{nickname}}}(auth{{#hasParams}}, {{/hasParams}}{{#allParams}}{{#required}}{{paramName}}{{#unless @last}}, {{/unless}}{{/required}}{{/allParams}}{{#hasOptionalParams}}&localVarOptionals{{/hasOptionalParams}})

if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion openapi-generator/templates/go/client.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ func parameterToJson(obj interface{}) (string, error) {
// helper for serializing and setting mapped parameters request body
func serializeMapParams(key string, value interface{}, localParams url.Values) url.Values {
if reflect.TypeOf(value).Kind() == reflect.Map {
for k, v := range value.(map[string]interface{}) {
for k, v := range value.(map[interface{}]interface{}) {
paramKeyName := fmt.Sprintf("%s[%s]", key, k)
serializeMapParams(paramKeyName, v, localParams)
}
Expand Down

0 comments on commit fca7edb

Please sign in to comment.