48 Commits

Author SHA1 Message Date
William Cheng
7968349991
go server - use tabs instead of spaces (#14740) 2023-02-18 00:37:53 +08:00
Rodrigo Cebrián González
612dc4dbcb
[BUG][Go] Remove "null" body value when body is empty #13927 (#13934)
* only write reponse body if not nil

* update go samples

* golang style convention
2023-02-18 00:29:12 +08:00
Sebastian Cevallos
8540c82d30
Add handling for parsing optional bool params & regenerate samples (#14550) 2023-01-30 16:35:19 +08:00
Ian Cubbon
74073df27c
[GO][Client] Use a *os.File for the API Client when uploading and downloading (#14340)
* Change the return type of a file back to a pointer

* Change the api template to handle not double pointer-ing return types of os.File

* Fix unit tests

* Couple more unit test fixes
2023-01-16 16:51:04 +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
Aliaksei Zhuk
9c3d4ef2a6
Parse integer array query parameters. Fix typos (#11105) 2022-01-04 17:55:18 +08:00
Nathan Baulch
5d68bd6a03
Fix thousands of spelling typos (#10272) 2021-08-28 22:58:24 +08:00
Ween Jiann
3b8f66cd1f
[go-server] Fix: param names clash with variables, added suffix (#10243)
* Postfix "Param" to param names in controller

* Regen samples
2021-08-27 13:07:31 +08:00
William Cheng
0204bf4ae2 Squashed commit of the following:
commit c5a0d0f7394aa742fa336fff7e7c1d3049761868
Merge: 8c4991ba3ed f8ff8c87609
Author: William Cheng <wing328hk@gmail.com>
Date:   Tue Aug 17 18:28:12 2021 +0800

    Merge branch 'mustache-linting' of https://github.com/NathanBaulch/openapi-generator into NathanBaulch-mustache-linting

commit f8ff8c87609b1ca36fa26fb8474806999638195e
Author: Nathan Baulch <nathan.baulch@gmail.com>
Date:   Thu Aug 5 14:12:47 2021 +1000

    Reorder tags that handle missing values

commit f5d8a33709d6a3f846a9fe4520b78c3d637051d9
Author: Nathan Baulch <nathan.baulch@gmail.com>
Date:   Thu Aug 5 14:08:59 2021 +1000

    Use dot notation where possible

commit 493d14921e2333f3ae19ef6fc89318b7e263a80c
Author: Nathan Baulch <nathan.baulch@gmail.com>
Date:   Thu Aug 5 14:10:49 2021 +1000

    Remove empty tags

commit 32480dc53f48227d55531b94e307d72671373737
Author: Nathan Baulch <nathan.baulch@gmail.com>
Date:   Thu Aug 5 10:41:58 2021 +1000

    Remove redundant sections

commit a8edabd722c34aa094b4aeb11c22664529c3a219
Author: Nathan Baulch <nathan.baulch@gmail.com>
Date:   Wed Aug 4 22:02:22 2021 +1000

    Trim extra EOF new lines

commit e89bd7458e3594bf0d30e580bc9408e45b018a57
Author: Nathan Baulch <nathan.baulch@gmail.com>
Date:   Wed Aug 4 21:59:26 2021 +1000

    Trim trailing whitespace
2021-08-17 18:37:51 +08:00
Ween Jiann
11d29eb22b
[go-server] Feat: add required assertions to models (#10068)
* Add RequiredError

* Add IsZeroValue helper

* Add AssertRequired method to all models

* Add AssertRequired call for body param

* Regenerate files

* Add DisallowUnknownFields

* Regenerate samples

* Use hasRequired in model to remove unnecessary code

* Revert disallowUnknownFields

* Use isAdditionalPropertiesTrue for disallowing unknown fields

* Updated samples

* Fix indent

* Add require checks for nested slices

* Add new tests

* Regenerate samples

* Regenerate samples after merging
2021-08-07 21:29:14 +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
Ween Jiann
870ef3a87a
[go-server] Allow user to specify how errors are handled (#9764)
* Added error.go

* Updated controller to use error

* Fix redeclared func

* Add generated files

* Merge

* Added docs

* Remove variadic

* Regenerate files

* Updated go doc to meet standard

* Updated doc to meet go standard

* Updated
2021-07-28 17:19:47 +08:00
Max Goltzsche
2e85ccdec8
[go-server] fix addResponseHeaders tpl option typo (#9814)
According to the [documentation](https://openapi-generator.tech/docs/generators/go-server) the go-server generator should support an `addResponseHeaders` option but a template uses an `addResponseHeader` option in some places which this PR fixes.

Closes #9795

Signed-off-by: Max Goltzsche <max.goltzsche@gmail.com>
2021-06-21 11:46:51 +08:00
Aliaksei Zhuk
53e5986800
[Go] Parse int arrays and respect the 'required' property (#9120)
* Added int arrays parsing in parameters. Respect the 'required' property.

* Replaced spaces with tabs

* Generate samples with new spacing

* Removed unused import

* Merged with latest master
2021-04-11 23:43:53 +08:00
William Cheng
5dae270c3e
[Go][server] parse bool in query parameter (#9171)
* Add bool query in example

* Add parseBoolParameter

* test with boolean parameter

* add endpiont for testing boolean

* remove bool parameter test

Co-authored-by: Stéphane Guillemot <gmtstephane@gmail.com>
2021-04-05 16:45:38 +08:00
William Cheng
c79d056935
Allow to specify response headers (needed for redirecting clients) (#9170)
* Allow to specify response headers (needed for redirecting clients) (#8148)

Co-authored-by: Bernardo Pastorelli <13519917+randomswdev@users.noreply.github.com>

* add addResponseHeaders option

* enable addResponseHeaders

* fix comma

Co-authored-by: randomswdev <randomswdev@users.noreply.github.com>
Co-authored-by: Bernardo Pastorelli <13519917+randomswdev@users.noreply.github.com>
2021-04-05 16:27:41 +08:00
Yannick Schutz
85b2b3c2e4
Add mime/multipart missing import in go server (#8790) 2021-02-27 14:50:16 +08:00
randomswdev
d1dcdad3d5
[Go][Server] Use the correct parameter name (#8144)
* Use the correct parameter name

* Minor changes

Co-authored-by: Bernardo Pastorelli <13519917-randomswdev@users.noreply.github.com>
2020-12-20 15:32:57 +08:00
Aliaksei Zhuk
9e5610488f
[Go] Fix for 'Invalid code for files array in multipart/form-data request'… (#8103)
* Fix for 'Invalid code for files array in multipart/form-data request' (OpenAPITools#8093)

* Executed ensure-up-to-date

* Replaced spaces with tabs.
2020-12-10 18:48:45 +08:00
William Cheng
c44865279a
replace spaces with tabs (#7421) 2020-09-15 18:13:07 +08:00
Gmtstephane
4e05912ae7
[GO][SERVER] Implement response code (#7397)
* Feature(template) add response with status code generation

* Generate Samples

* update samples

Co-authored-by: William Cheng <wing328hk@gmail.com>
2020-09-14 23:14:53 +08:00
ryutah
b3b4526bf7
[go-server] Modified go-server templates to allow services to receive http request's context. (#7214)
* adds context arguments to go-server templates (#6657)

* updates go-api-server samples (#6657)
2020-08-15 00:11:44 +08:00
debugman
742b8bd650
added int32 support for go-server (#7123) 2020-08-06 17:17:07 +08:00
William Cheng
52fcdd5974
Migrate Go server samples to OAS 3 only (#6471)
* migrate go server samples to oas3

* add back pom.xml
2020-05-29 11:42:07 +08:00
William Cheng
db729be7df
[Go][Server] minor enhancement to the template (#4417)
* minor enhancement to the go server template

* update samples
2019-11-09 11:24:12 +08:00
Jesse Michael
00c6e0a64b Return Router interface from controller constructor. (#4196)
Update the go server api controller template to return the Router interface instead of the api specific router.
The Router interface type has the Routes function, which is what the generated `NewRouter` function needs. (not the api specific interface).
2019-10-22 15:27:08 +08:00
William Cheng
f43c720b08
replace 4-space with tab (#4188) 2019-10-20 00:46:25 +08:00
Jesse Michael
0abb910dbc [go-server] Enhance Go API server with interfaces router binding and services (#4038)
* Enhance go api server with interfaces router binding and services

Enhance the default go api server generation to define interfaces for an API's routes and services. Handle an endpoint's http binding in the generated router and the skeleton for the service logic in an API service.

* Include interface documentation in Go Server generation.
2019-10-19 23:32:52 +08:00
Akira Tanimura
08613691e8 fix enum which is not string of Go (#4077) 2019-10-09 18:35:56 +08:00
Jochen Scheib
c918d7ad64 go-server: Support additional properties as command line arguments (#1555)
* Support additionalPorperties as command line arguments

* Move Readme into main dir

* Update Mustache

* Update sample

* Test coverage

* Move cli options

* Revert options

* Remove tabs

* openapi 3 examples

* Update readme

* serverPort to int

* Move package version cli option to AbstractGoCodegen

* Update samples

* Tab to spaces

* Update docs and sample with xml

* Manual update doc

* Another doc try

* Regenerate go-gin-server doc
2019-03-25 21:19:06 +08:00
kemokemo
243ec9aa8e [Go] Add a process to delete old files for the sample update scripts (#2410)
* chore: add removing old files function to the scripts.

chore: add removing old files function to the scripts.

* docs: update by ./bin/go-gin-petstore-server.sh

* docs: update by ./bin/go-petstore-server.sh

* docs: update by ./bin/go-petstore-withxml.sh

* docs: update by ./bin/openapi3/go-petstore-server.sh

* docs: update by ./bin/security/go-petstore.sh
2019-03-15 22:14:20 +08:00
alex-korobko
42544b8234 Issue 1766 Modified mustache files for Go to support nullable in the … (#1869)
* Issue 1766 Modified mustache files for Go to support nullable in the spec v3.0+; Updated model files running .sh scripts for Go.

* Add "nullable" to fake yaml

* Add sample script for OAS3

* Fix output folder (openapi3)

* Run bin/openapi3/go-petstore.sh

* Update samples

* Update jaxrs-jersey

* Update python and php samples

* Add bin/openapi3/go-gin-petstore-server.sh

* Run bin/openapi3/go-gin-petstore-server.sh

* Update bin/openapi3/go-petstore-server.sh to generate "nullable" samples

* Run bin/openapi3/go-petstore-server.sh

* Fix duplicated `import`
2019-02-15 11:08:52 +09:00
William Cheng
e5244e8c3d
Add postProcessFile, implement in Go generators to run gofmt (#929)
* add postProcessFile, implement in Go generators to run gofmt

* minor fix to docstring

* update parallel job to 3
2018-09-01 21:02:28 +08:00
Ben Wells
c51986d657 Go server clean up (#328) 2018-06-18 01:09:48 +08:00
sunn
299527370e [go-server] Add dockerfile for building and run petstore service (#274)
* Add possibility to build and run go service in a container

* Remove tabs

* Update Pet Store server sample

* Add {{{packageName}}} instead of petstore
2018-06-13 16:55:04 +08:00
William Cheng
0dbb6dcaa6
Update Go generators' default value (#362)
* udpate go client default value

* update go generators' default value
2018-05-08 10:16:38 +08:00
antihax
72abb20f2e [Go] Fix operation files clobbering model files. [2.4.0] (#7337)
* Prevent operation files clobbering model files.

* Update Tests
2018-01-14 17:00:17 +08:00
Ben Wells
7479fc5361 Generate swagger yaml for go client (#7281) 2018-01-07 11:37:40 +08:00
Ben Wells
83fb107749 Create abstract go codegen base class (#7197)
Remove tabs
2017-12-19 23:41:02 +08:00
Ben Wells
d25341d58d Output models for go-server #3851 (#7188)
* Output swagger models.

Fix route verbs and formatting

* Remove backup files

* Make postProcessOperations consistent with go client
2017-12-17 21:55:20 +08:00
Ben Wells
2e348b27f7 [Go-server] Fix formatting of go-server generated code (#7162)
* Add missing go-server petstore batch script

* Make go-server confirm to gofmt
2017-12-15 00:04:48 +08:00
antihax
3ed1aa8e79 Rewrite of Go Client #2 (#5037)
* Rewrite of Go Client

* Revert to older version of context.Context

* Clean and bulk up concurrency test.

* Correct {{path}} to {{{path}}}

* change custom date type to string.

* Add APIKey authentication

* Correct missing line from resolving conflicts.

Correct missing line from resolving conflicts.
2017-04-22 01:17:18 +08:00
Paŭlo Ebermann
f0b9c2b761 [Go] #3084: remove timestamps from go server (#5218)
* Issue #3084: add hideGenerationTimestamp option to Go server generator.

* Issue #3084: use hideGenerationTimestamp in go server sample script.

* Update Go server samples.
2017-03-27 11:47:15 +08:00
Paŭlo Ebermann
a91cbbe387 Update samples after 2.2.2 (#4901)
* Update petstore samples for Groovy.

* Update samples for JaxRS.

* Update samples for cpprest.

* Update samples for dart.

* Update samples for flash.

* Update samples for go.

* Update samples for html2.

* Update samples for lumen.

* Update samples for nancxfx.

* Update samples for objc.

* Update samples for sinatra.

* Update samples for tizen.

* Update samples for java-inflector.
2017-03-06 00:33:57 +08:00
guohuang
f6c523bcd6 fixed all routing to v2 (#3428) 2016-07-21 11:44:43 +08:00
Guo Huang
6415018c8f removed tab in logger, added warnings for import 2016-05-27 09:42:08 -07:00
Guo Huang
4b41877419 updated read me and removed extra space 2016-05-27 09:18:23 -07:00
Guo Huang
db9684ff19 issue#2970, [Go] add go server codeine template 2016-05-26 22:34:18 -07:00