30 Commits

Author SHA1 Message Date
William Cheng
cda3517891
[Go] properly set header parameters on api clients (#14637)
* [Go] properly set header parameters on api clients

* update samples

* update samples

---------

Co-authored-by: Paul Sokolik <paul.sokolik@gmail.com>
2023-02-07 21:45:24 +08:00
Gonzalo Gomez
68b41eeeea
[GO][Client] Don't import io/ioutil package that has been deprecated as of Go 1.16 (#14476)
* io/ioutil has been deprecated ass of Go 1.16, the same functionality is now provided by package io or package os

* run pr checklist

* Bump go version to 1.16.

* Run pr checklist

* Bump version to 1.18

* Run pr check list
2023-02-03 15:50:12 +08:00
Ian Cubbon
92775ceffc
[Go] [Client] Don't Explode Query Params (#14447)
* If the collection type is csv, that means 'dont explode the query params'.

* Simplify the logic just a tad

* url.Values -> Has was added in go1.17 but there are CI tests running at 1.16
2023-01-14 00:48:27 +08:00
William Cheng
811e0de1be
replace spaces with tabs in go client (#14189) 2022-12-06 13:04:58 +08:00
Ian Cubbon
63629ad51c
[Go] File Download Fix Return Type (#14046)
* Changes manually cherry-picked (for the most part) from https://github.com/OpenAPITools/openapi-generator/pull/12685/files

* Examples updated post changes

* Missed a change in the mustache template

* Update examples after last fix

* Missed dereference for required files

* Update unit tests

* Missed another test case update

* `f := *f` isn't quite the same as `*f, err = ...`
2022-12-06 12:21:39 +08:00
Andrei Matei
c62ebc377e
[Go] Add authentication methods only if referenced in input spec (#14138)
* Add conditions for auth methods

* Add extra auth method validations

* Regenerate example SDK

* Clean-up tests

* Fix indentation and go.sum
2022-12-01 15:29:59 +08:00
Ian Cubbon
903ff0ba47
Trim any space when we format the error message sent back to the client. (#14066)
A trailing whitespace gets included if the error is not a RFC7807 model.
2022-11-20 22:35:21 +08:00
Vittorio Parrella
4487042f0d
Issue 11401 - report correctly the parameters with the deep object specification (#13909)
* issue #11401 - Go client generator doesn't support deepObject in query

* samples generation

* fix generation

* fix generation

* generated samples

# Conflicts:
#	samples/client/petstore/go/go-petstore/model_200_response.go
#	samples/client/petstore/go/go-petstore/model_additional_properties_any_type.go
#	samples/client/petstore/go/go-petstore/model_client.go

* Fixed unit tests

* revert to http connection for tests

* fix model_simple generation

* Fix parameter encoding issue

* simplified routine

* fix test url

* adapted for latest master, necessary generation

* samples generation

* sync with new master, regenerate samples

* added api client test
2022-11-20 15:09:33 +08:00
William Cheng
6a7b8fcebe
[Go][client] better code format, regenerate go client tests (#13940)
* go client regenerate test

* replace 4-space with tabs, regenerate tests
2022-11-08 10:40:28 +08:00
Beppe Catanese
1de28c8a72
Improve error message (rfc7807) (#13680)
* Add func formatErrorMessage

* Add unit test

* Commit generated code

* Fix indentation

* Using tabs

* Set error before model

* Commit generated code

* Fix tabs

* Commit generated code

* Fix tabs

* Fix tabs

* Commit generated code
2022-10-31 22:35:16 +08:00
Maëlick
41255c1f18
Fix staticcheck ST1005 errors in generated Go client (#13633)
* Fix staticcheck ST1005 errors in go client

* Samples updated

* sample test fix for openapiv3 petstore go client
2022-10-18 22:46:49 +08:00
William Cheng
c982421495
[Go] use EqualFold instead instead of comparing strings in lower case (#12741)
* use EqualFold instead in the go client

* update samples
2022-06-30 23:09:10 +08:00
William Cheng
3bc4416554 update go samples 2022-06-11 09:24:50 +08:00
Beppe Catanese
aeb40ab0ae
[Go] Address Gosec vulnerabilities in Go client mustache template (#12540)
* Fix potential file inclusion via variable

* Fix deferring unsafe method "Close" on type "*os.File"

* Update samples

* Correction to use existing variable

* Correction generated samples
2022-06-11 09:10:48 +08:00
hackerman
93488f4195
Resolve several issues in generated Go code (#8491)
* [go] use regular stdlib import names

* [go] support primitive oneOf types

See #8489

* [go] improve pbv/pbr handling

Improves the way pass-by-value and pass-by-reference variables are used.

Closes #8489

* [go] improve generated documentation

* [go] adopt pointer changes in interface

* [go] regenerate sample

* [go] resolve pointer issues

* [go] regenerate clients and avoid pointers on primitive return values

* [go] improve Exec() return value handling

* [go] regernate files

* [go] use go modules

* [go] properly handle polymorph decode

If polymorphism without discriminator was used, the previous code was unable to properly decode the vaules. By using a strict decoder, which rejects unknown fields, type guessing now works.

* [go] make GetActualInstance not panic on nil

* [go] return GenericOpenAPIError as pointer

* [go] clarify helper function godoc

* [go] address test regression error type

* [go] regenerate go samples

* [go] resolve go mod issues and test regressions

* [go] resolve merge conflicts and regenerate

* [go] resolve merge conflicts

* [go] Replace spaces with tabs

Co-authored-by: Jiri Kuncar <jiri.kuncar@gmail.com>

* [go] Replace spaces with tabs

Co-authored-by: Jiri Kuncar <jiri.kuncar@gmail.com>

Co-authored-by: Jiri Kuncar <jiri.kuncar@gmail.com>
2022-01-21 16:54:09 +08:00
Ian Cubbon
6779c33b9d
[GO][Client] Multipart/form-data Request Support More Than One File (#10843)
* Instead of limiting a request to a single file when
performing an upload, use a slice of files so an
arbitrary number of files can be used in the form.

* Remove commented out line of code

* Update examples for multi-form file fix for multiple files

* Convert spaces to tabs for indentation

* Updated examples to have tabs instead of spaces

* Add an example of a multipart/form-data OA3 schema
that contains two files to be uploaded
2021-11-22 16:27:43 +08:00
Andrew
d91ff3a150
[GO] dont canonize headers (#10779)
* [GO]: dont canonize headers

* [GO]: update unit tests
2021-11-14 10:36:49 +08:00
William Cheng
acdf357b76
Revert "Accept header forces application/json type even if server (#10337)" (#10440)
This reverts commit 18301d00112e064d80d94f1ca5d6ca6032808ddd.
2021-09-21 18:17:05 +08:00
Wojciech Trocki
18301d0011
Accept header forces application/json type even if server (#10337)
* fix!: accept should not force application JSON 

Generated code offen provides range of accept methods.
This method improperly takes JSON as preferred

Example:
	localVarHTTPHeaderAccepts := []string{"application/zip", "application/json"}

* chore: generated changes
2021-09-21 12:04:00 +08:00
William Cheng
808e6af94d update go petstore samples 2021-08-27 13:37:05 +08:00
Nathan Baulch
c1c5775271
[go] More idiomatic godoc comments (#10044)
* [go] More idiomatic godoc comments

* [go] Mark deprecated fields and functions

* [go] Minor mustache readability/consistency fixes

* [go] Mark deprecated operation parameters

* [go] Deprecate a petstore component property for testing

* [go] Apply deprecated godoc in Go servers also
2021-08-03 17:11:16 +08:00
William Cheng
c5405aa59a
[Go-client] Fix inability to download files (#9812)
* Revert a change to the Go Client code that broke
the ability to download files. This reverts the change
from 14d41310b9

* Missed import for "io/ioutil"

* update samples

Co-authored-by: icubbon <icubbon@gmail.com>
2021-06-19 11:23:05 +08:00
mazrean
01ff635139
[Go] Fix golang comment typos (#9207)
* fix go comment typo insensitive

* fix go comment typo response

* update samples
2021-04-08 09:59:31 +08:00
William Cheng
ba4aae5074
[Go] bug fix (breaking), minor code format enhancement (#8715)
* go minor code format enhnacement

* fix required vars in the model new

* remove comma
2021-02-20 11:50:27 +08:00
William Cheng
53285e5aa5 update samples 2021-02-16 08:15:04 +08:00
David Hontecillas
51c8fd1520
Fix generated go client cannot upload file (#8393)
* go client send **io.File body

* run generate-samples for Go upload fix
2021-02-16 08:08:27 +08:00
fuxs
38dbcdd752
[Go] Fixes missing return statement (#8072) (#8090) 2020-12-05 18:24:22 +08:00
William Cheng
8fad36c898
[Go] minor format change, deprecate "withGoCodegenComment" option (#7375)
* use tab in comment, remove withGoCodegenComment

* deprecated option
2020-09-12 22:05:10 +08:00
William Cheng
966b87e66c
add aws v4 signature support to go-experimental (#7326) 2020-09-02 15:28:22 +08:00
Jiri Kuncar
d5a680e85f
[Extensions][Go][Java] Test x-auth-id-alias (#6642)
Co-authored-by: Jim Schubert <james.schubert@gmail.com>
2020-08-30 21:46:55 -04:00