26 Commits

Author SHA1 Message Date
Dragos Vingarzan
c2884b7b1a
[BUG][Go-server] attempt to fix the controller-api mustache template for a nullable bodyParam (#20478)
* go-server: attempt  to fix the controller-api mustache template for a nullable bodyParam

* added to petstore an example to trigger the issue which this PR fixes
2025-02-19 17:09:32 +08:00
William Cheng
4c73faf737
[go-server] Add tests for primitive types in request/response (#20474)
* add test for primitive request/response

* add new files
2025-01-15 16:56:16 +08:00
Beppe Catanese
243f501aef
[GO] Go Server: preserve order of the routes as defined in the OpenAPI file (#19550)
* Add skipSortingOperations configuration option

* Skip sorting operations for go-server

* Add test verifyOrder

* Regenerate samples
2024-09-16 16:52:01 +08:00
Ween Jiann
cefbf62060
[go-server] Fix: missing quotes for string default value (#18546)
* Update controller mustache

* Add tests to openapi doc

* Regen
2024-05-06 14:17:44 +08:00
William Cheng
494d74ab82
remove duplicated (#18320) 2024-04-07 22:25:03 +08:00
Viswajith Venugopal
650e119f22
Update go-server template to include the conventional generated code line (#18304)
* Update go-server template to include the conventional generated code line

Follow the convention from https://pkg.go.dev/cmd/go#hdr-Generate_Go_files_by_processing_source.

The generated go client code already follows this: f357be480e/modules/openapi-generator/src/main/resources/go/partial_header.mustache (L18)

* gen files

* Move to top
2024-04-07 21:23:24 +08:00
Ween Jiann
bf4c98a82a
[go-server] Add ability to handle nullable query param (#17321)
* Update

* Regen
2023-12-21 19:13:05 +08:00
Ween Jiann
b7f31ddda4
Regenerate (#17389) 2023-12-13 22:17:15 +08:00
Ian Cubbon
2f655f1a9c
Time parameters in the path resulted in code that would not compile (#17021)
This is probably a pretty rare case as it just seems weird to have a time
path parameter, but it's good to fix.
2023-11-13 10:01:32 +08:00
Ian Cubbon
291ce353ce
[Go][Server] FormParams - Generic Array Type Handling (#17001)
* If a form param is an array and isn't caught in the previous checks, treat it as a slice of strings.

* Add an example of a FormParam that is an array
2023-11-08 14:09:12 +08:00
Ian Cubbon
677b6e64c1
If parsing a boolean fails, return a ParsingError instead of a straight 500 (#16910)
Add an example endpoint that covers Required, Default, and Not Required cases
2023-10-28 20:32:04 +08:00
Ian Cubbon
bf9fae641e
[Go-Server] Add support for DateTime Query Parameters (#16749)
* Add support for DateTime objects in the Path, Query Params, and as a List

* Fix indentation

* Add an exaple that has dateTimes
Move the date parsing into a common util in the routers.go file.

* Fix compilation issue and regen

* Use the `RequiredError` to handle this case

* Only split on a "," and not an extra 'space' after the ",".
2023-10-22 21:07:13 +08:00
Ian Cubbon
e0738a6e42
[Go-Server] Support for an endpoint returning a file to the client - #15206 (#16748)
* Support for an endpoint returning a file to a client.

* Spaces to tabs conversion

* Add an example endpoint for download a file

* Regenerate after merging main
2023-10-17 11:42:27 +08:00
Ian Cubbon
1dd9590064
[Go-server] - Support for Enums in the Path and Query (#16781)
* Add support for Enums to be part of the Path and Query
Supports optional Query Enums and Lists of Enums as well
Add an example endpoint that covers the added scenarios
Added an import mapping for the GoServerCodegen for "fmt"
    when a model is an enum.
Expanded the Enum Model for the Go Server to have validation.
    Copied this logic from the Go Client Enum Model.

* Fix identation of examples

* Pre-allocate the capacity of the slice of Enums to be
the correct size.

* Formatting and updated examples

* Empty-Commit

* Switch to using a map to store the valid enum values

* Fixed pointer derefs missed from previous change in PR

* More fixing of pointer to not pointer

* Create a map for validation and a list of enums for messaging
2023-10-17 11:35:39 +08:00
William Cheng
ba367e60e8
[go-server] Add tests, minor format change (#16805)
* add tests for #16787, minor format change

* revert

* fix typo

* use pet instead of fake

* update samples
2023-10-12 19:23:02 +08:00
William Cheng
54c8bf8733
[go-server] Add tests for boolean query parameter (#15563)
* add tests for boolean query parameter

* fix test
2023-05-18 15:39:43 +08:00
Ween Jiann
78bffff8f3
[Go] Update API naming to follow Golang standard pkg (1 line change) (#15331)
* Add apiNameSuffix to AbstractGoCodegen

* Regenerate files

* Update tests

* Regenerate files

* Update test files

* Regenerate for CI test

* Regenerate for CI test

* Remove some docs

* Add files back
2023-05-13 09:40:26 +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
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
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
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
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