Skip to content

Commit

Permalink
download file patch v17
Browse files Browse the repository at this point in the history
  • Loading branch information
dlnilsson committed Jul 18, 2022
1 parent 98572a5 commit f884266
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions spec/config/config_template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ languages:
- template-patches/go/configuration_context.patch
- template-patches/go/identity_providers.patch
- template-patches/go/utils_big_int.patch
- template-patches/go/download_file.patch
commands:
- commandline:
- docker-entrypoint.sh
Expand Down
26 changes: 26 additions & 0 deletions spec/template-patches/go/download_file.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
diff --git a/go/client.mustache b/go/client.mustache
index bceb7fc..2b12e9e 100644
--- a/go/client.mustache
+++ b/go/client.mustache
@@ -472,6 +472,21 @@ func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err err
_, err = (*f).Seek(0, io.SeekStart)
return
}
+ // https://github.com/OpenAPITools/openapi-generator/issues/11965
+ if file, ok := v.(***os.File); ok {
+ var tmp *os.File
+ tmp, err = ioutil.TempFile("", "HttpClientFile")
+ if err != nil {
+ return
+ }
+ _, err = tmp.Write(b)
+ if err != nil {
+ return
+ }
+ _, err = tmp.Seek(0, io.SeekStart)
+ *file = &tmp
+ return
+ }
if xmlCheck.MatchString(contentType) {
if err = xml.Unmarshal(b, v); err != nil {
return err

0 comments on commit f884266

Please sign in to comment.