Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
121 commits
Select commit Hold shift + click to select a range
ba570c2
renaming for openapi-generator
wing328 Mar 6, 2018
e4914fb
add helper function to generate openapi yaml/json file
wing328 Mar 31, 2018
e42aaa6
Rename projects from swagger-codegen master branch
jmini Apr 14, 2018
c76706d
Merge commit 'oas3_support2' into 'swagger-codegen_renamed'
jmini Apr 14, 2018
13ce10c
Add OpenAPI spec 3.0 support (beta)
jmini Apr 17, 2018
999847d
Merge commit 'swagger-codegen_renamed' into 'master'
jmini Apr 17, 2018
d055091
Merge branch 'swagger-codegen_renamed' into 'master' (#183)
jmini Apr 22, 2018
b235633
Update go client, fix double body read (#211)
antihax Apr 24, 2018
adddfea
fix parameter naming in go
wing328 Apr 28, 2018
c43cd28
various fix for go petstore
wing328 Apr 28, 2018
9a3954c
update go readme, update pom go dependencies (#274)
wing328 Apr 30, 2018
938ce23
Fix go readme, remove resty install (#280)
wing328 May 1, 2018
21d4c16
update default user agent (#284)
wing328 May 1, 2018
bace6e5
Update wordings (#301)
wing328 May 3, 2018
f6ee3a1
Renamings (#252)
jmini May 4, 2018
1c013ae
Merge 'master' branch of 'swagger-codegen' into 'openapi-generator' (…
jmini May 5, 2018
1a87118
Update Go generators' default value (#362)
wing328 May 8, 2018
87e6163
Rename datatype to dataType in CodegenProperty (#69)
jmini May 18, 2018
22b75b6
[Golang][client] fix RFC-3339 date-time query param (#325)
grokify Jun 15, 2018
8dd582d
Grammar and spelling fixes (#329)
scop Jun 16, 2018
cd1f075
Merge remote-tracking branch 'origin/master' into 3.1.x
jmini Jun 19, 2018
a597822
[go] Fix issue #51, change object mapping from *interface{} to map[st…
ilk Jun 21, 2018
6a7d6f2
Merge remote-tracking branch 'origin/master' into 3.1.x
jmini Jun 25, 2018
6ecf952
[Golang][client] fix undefined: localVarFile (#382)
grokify Jul 1, 2018
6827405
Minor improvement to Go client generator, move test case (#430)
wing328 Jul 2, 2018
56e3a5c
fix cache-expires-ineffassign (#466)
grokify Jul 8, 2018
4df8e22
add RFC-3339 formatting to parameterToString (#502)
grokify Jul 12, 2018
65cebea
[Golang][client] fix `formData` `file` parameter name use (#506)
grokify Jul 12, 2018
391f3c0
[Golang][client] Add option for standard Go generated code comment (#…
grokify Jul 19, 2018
3210833
add xml attr support in go client (#867)
wing328 Aug 23, 2018
bd8f1a1
improve go code format without gofmt (#1173)
wing328 Oct 5, 2018
08fdb63
x-www-form-urlencoded-body-fix (#1187)
beardeddragon5 Oct 10, 2018
d256f9b
Add x-go-custom-tag to go-server generator (#1146)
andrewkav Oct 12, 2018
56b50a4
[Golang][client] fix response decode error handling (#1291)
grokify Oct 26, 2018
83b51a2
Issue 1766 Modified mustache files for Go to support nullable in the …
alex-korobko Feb 15, 2019
c91a5ec
Remove API Key Authentication code for go when cookie is used. (#1601)
dmascialino Feb 18, 2019
b202d8b
[Go] Fix up json check regexp and support vendor-specific mime types …
jimmidyson Mar 14, 2019
439134a
[go] support decoding plain string responses (#2414)
bamarni Mar 15, 2019
3b9e0e6
[#2441] Update documentation mustache templates for proper linting. (…
theWhiteWulfy Mar 25, 2019
4b93589
[go] fix multipart for non-file inputs (#2792)
thiagoarrais May 8, 2019
b2a1c28
[Golang][client] Make it possible to generate go.mod and go.sum files…
bkabrda May 8, 2019
e1cd501
fix(golang): Check error of xml Encode (#3027)
mcristina422 May 30, 2019
339cc0c
refactor(golang): Use http provided constants for http methods (#3028)
mcristina422 Jun 3, 2019
9eca000
[Golang][client] Allow generating go client code as a submodule. (#3012)
Jun 5, 2019
b32cd33
[Go][Client] Use configured Scheme and Host in requests (#3115)
johanbrandhorst Jun 25, 2019
2a090b0
[go] Serialize multipart array of complex objects as JSON (#2965)
thiagoarrais Jun 28, 2019
02a7753
[Golang][Client] Fix collectionFormat=multi request bug (#3390)
grokify Aug 13, 2019
0144510
Import Go package with leading underscore (#3634)
wing328 Aug 14, 2019
3d05187
[Go]URLEncode path parameters (#3643)
kraney Aug 16, 2019
b0fe812
Guarantee a unique name for the constants that represent enum values …
kraney Aug 19, 2019
20efdc5
[Go] add option to use class as enum prefix (#3675)
wing328 Aug 19, 2019
6b496d6
Support custom git repository (#3757)
qmuntal Sep 3, 2019
fc6000c
Better Go code format (#3819)
wing328 Sep 4, 2019
7b8da45
Fix readonly with isReadOnly (#4102)
wing328 Oct 9, 2019
cdeb8a6
fix enum which is not string of Go (#4077)
autopp Oct 9, 2019
18f424a
[Go] Fix go.mod and go.sum for 1.13 (#4084)
urandom2 Oct 10, 2019
60380f7
Do not check status code for default response (#3322)
thiagoarrais Oct 14, 2019
2deac49
Add newline between function signature of operation and summary of op…
zippolyte Oct 15, 2019
b05f9d8
[Go] Upgrade dependencies (#4126)
urandom2 Oct 17, 2019
13a70e2
[Golang] Allow retrieving the underlying configuration for APIClient …
arvindth Oct 21, 2019
6edf5ed
[Go] Bypass object decode in case of empty body (#4546)
dukov Nov 20, 2019
188b674
Add an option to prefix Go struct with the classname (#4564)
wing328 Nov 21, 2019
74ebb96
Add support for dumping request and response in Go generated clients …
dnaeon Nov 28, 2019
949d17a
Add debug flag support for go-experimental generator (#4649)
dnaeon Dec 2, 2019
86fc627
[Go] Add multiple servers support to Go(-experimental) client (#4635)
jirikuncar Dec 4, 2019
cc1b0f4
[go] Fix multi-value path params in go (#4664)
semtexzv Dec 9, 2019
b663730
[REQ][GO] add awsv4 signature support (#4784)
jerome-jutteau Dec 22, 2019
3a12720
[go][client] fix when schema have multiple servers (#4901)
tomi77 Jan 2, 2020
9b1cb50
[go] Fix multiple go compilation errors and enable go integration tes…
sebastien-rosset Jan 24, 2020
1d7e1e9
Switch to predominant use of appDescriptionWithNewLines in README.mus…
Jan 29, 2020
8ed7623
[Golang] Add support allOf inheritance with embedded go structs (#4934)
sebastien-rosset Feb 1, 2020
7229d37
[templates] Update templates vendor ext standards (#5295)
jimschubert Feb 15, 2020
aaee3c7
[go-experimental][go][client] Remove unreachable code in go client AP…
Apr 2, 2020
9b7f711
Sync master to 5.0.x (#5968)
wing328 Apr 22, 2020
2dd2324
Revert "Sync master to 5.0.x (#5968)"
wing328 Apr 22, 2020
da2adb8
Merge branch '5.0-sync-master3' into 5.0.x
wing328 Apr 22, 2020
d51630b
File return type fix (#5644)
May 3, 2020
6344cb8
Merge remote-tracking branch 'origin/5.0.x'
wing328 May 6, 2020
6099e2a
go: use PathEscape instead of QueryEscape to escape path params (#6618)
bendrucker Jun 11, 2020
8b05b12
[Go] support problem details HTTP API (#6793)
houqp Jul 26, 2020
c050e6e
Update to reset httpRepsonse.Body (#6948)
nmische Aug 4, 2020
008f315
fix http bear auth documentation for go clinets (#7312)
Aug 31, 2020
a62f206
[Go]: Interface definitions for api functions (#5914)
arvindth Sep 1, 2020
c6e7f0c
add aws v4 signature support to go-experimental (#7326)
wing328 Sep 2, 2020
c56a1b3
[Go] replace `go` generator with `go-experimental` generator (#7337)
wing328 Sep 4, 2020
b13fdd1
[Go] minor format change, deprecate "withGoCodegenComment" option (#7…
wing328 Sep 12, 2020
a79150b
[go][client] Fix API docs example generation (#7489)
zippolyte Sep 25, 2020
b10d640
fix comment typo (#7605)
bobesa Oct 10, 2020
3791525
Unifies naming for isMap in Schema class properties (#7640)
spacether Oct 12, 2020
9d02b6c
remove github.com/antihax/optional from go.sum (#7692)
wing328 Oct 14, 2020
a8e5095
Unifies naming for isArray in Schema class properties (#7691)
spacether Oct 19, 2020
09fa1ae
update doc to include proxy instruction (#7749)
wing328 Oct 19, 2020
86e53d8
Removes secondaryParam and hasMore (#7882)
spacether Nov 7, 2020
fed0db3
Fix a few issues with go examples generation (#7873)
therve Nov 12, 2020
c342d7c
Fixes to go API documentation generation (#7963)
therve Nov 23, 2020
e6b857c
[Go] Fixes missing return statement (#8072) (#8090)
fuxs Dec 5, 2020
042381f
[GO][Client] return GenericOpenAPIError instead of error in Execute()…
code-lucidal58 Dec 17, 2020
129ae18
Revert "[GO][Client] return GenericOpenAPIError instead of error in E…
wing328 Jan 14, 2021
0bcdff7
[Go] Fix response body (#8439)
wing328 Jan 14, 2021
777a3b5
[Go][Client] Secret key content string in http signing support (#8570)
code-lucidal58 Feb 4, 2021
c895803
Fix generated go client cannot upload file (#8393)
dhontecillas Feb 16, 2021
24b5020
[Go] bug fix (breaking), minor code format enhancement (#8715)
wing328 Feb 20, 2021
685f2ae
Add additional AWS v4 signature parameters to go client generator (#8…
Feb 21, 2021
a3f1532
[GO] use latest available oauth2 version (#8764)
acabarbaye Feb 24, 2021
23c5e71
Add 'templates/' from commit 'a3f15320877fc5e4c89b3cd0670be09ffcb936d4'
therve Mar 22, 2021
d19e878
Apply template-patches/go-experimental-0003-custom-license-header.patch
therve Mar 23, 2021
0d44367
Apply template-patches/go-experimental-0005-unstable-operations.patch
therve Mar 23, 2021
7729a59
Apply template-patches/go-experimental-0006-operation-id-header.patch
therve Mar 23, 2021
a572886
Apply template-patches/go-experimental-0007-user-agent.patch
therve Mar 23, 2021
ad3585c
Apply template-patches/go-experimental-0008-code-example.patch
therve Mar 23, 2021
639d94b
Apply template-patches/go-experimental-0009-export-request-methods.patch
therve Mar 23, 2021
a75fe2c
Apply template-patches/go-experimental-redact-auth-debug-logs.patch
therve Mar 23, 2021
fc7128d
Apply template-patches/go-validate-enum-values.patch
therve Mar 23, 2021
0d55737
Apply template-patches/go-examples-with-dd-site.patch
therve Mar 23, 2021
e16446b
Move templates
therve Mar 23, 2021
0cd5f46
Merge branch 'master' into datadog-api-spec/test/therve/templates
api-clients-generation-pipeline[bot] Mar 23, 2021
622349a
Merge branch 'master' into datadog-api-spec/test/therve/templates
api-clients-generation-pipeline[bot] Mar 23, 2021
fef5db7
Merge branch 'master' into datadog-api-spec/test/therve/templates
api-clients-generation-pipeline[bot] Mar 23, 2021
812f85a
Merge branch 'master' into datadog-api-spec/test/therve/templates
api-clients-generation-pipeline[bot] Mar 23, 2021
faa7baa
Merge branch 'master' into datadog-api-spec/test/therve/templates
api-clients-generation-pipeline[bot] Mar 23, 2021
355631a
Regenerate client from commit 7e667f1 of spec repo
Mar 23, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.4.1.dev6",
"regenerated": "2021-03-23 10:51:41.342590",
"spec_repo_commit": "34cf37f"
"regenerated": "2021-03-23 14:02:27.115937",
"spec_repo_commit": "7e667f1"
},
"v2": {
"apigentools_version": "1.4.1.dev6",
"regenerated": "2021-03-23 10:51:49.967652",
"spec_repo_commit": "34cf37f"
"regenerated": "2021-03-23 14:02:34.801926",
"spec_repo_commit": "7e667f1"
}
}
}
8 changes: 8 additions & 0 deletions .generator/templates/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
language: go

install:
- go get -d -v .

script:
- go build -v ./

221 changes: 221 additions & 0 deletions .generator/templates/README.mustache
Original file line number Diff line number Diff line change
@@ -0,0 +1,221 @@
# Go API client for {{packageName}}

{{#appDescriptionWithNewLines}}
{{{appDescriptionWithNewLines}}}
{{/appDescriptionWithNewLines}}

## Overview
This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client.

- API version: {{appVersion}}
- Package version: {{packageVersion}}
{{^hideGenerationTimestamp}}
- Build date: {{generatedDate}}
{{/hideGenerationTimestamp}}
- Build package: {{generatorClass}}
{{#infoUrl}}
For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}})
{{/infoUrl}}

## Installation

Install the following dependencies:

```shell
go get github.com/stretchr/testify/assert
go get golang.org/x/oauth2
go get golang.org/x/net/context
```

Put the package under your project folder and add the following in import:

```golang
import sw "./{{packageName}}"
```

To use a proxy, set the environment variable `HTTP_PROXY`:

```golang
os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")
```

## Configuration of Server URL

Default configuration comes with `Servers` field that contains server objects as defined in the OpenAPI specification.

### Select Server Configuration

For using other server than the one defined on index 0 set context value `sw.ContextServerIndex` of type `int`.

```golang
ctx := context.WithValue(context.Background(), sw.ContextServerIndex, 1)
```

### Templated Server URL

Templated server URL is formatted using default variables from configuration or from context value `sw.ContextServerVariables` of type `map[string]string`.

```golang
ctx := context.WithValue(context.Background(), sw.ContextServerVariables, map[string]string{
"basePath": "v2",
})
```

Note, enum values are always validated and all unused variables are silently ignored.

### URLs Configuration per Operation

Each operation can use different server URL defined using `OperationServers` map in the `Configuration`.
An operation is uniquely identifield by `"{classname}Service.{nickname}"` string.
Similar rules for overriding default operation server index and variables applies by using `sw.ContextOperationServerIndices` and `sw.ContextOperationServerVariables` context maps.

```
ctx := context.WithValue(context.Background(), sw.ContextOperationServerIndices, map[string]int{
"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), sw.ContextOperationServerVariables, map[string]map[string]string{
"{classname}Service.{nickname}": {
"port": "8443",
},
})
```

## Documentation for API Endpoints

All URIs are relative to *{{basePath}}*

Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}}
{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}

## Documentation For Models

{{#models}}{{#model}} - [{{{classname}}}]({{modelDocPath}}{{{classname}}}.md)
{{/model}}{{/models}}

## Documentation For Authorization

{{^authMethods}} Endpoints do not require authorization.
{{/authMethods}}{{#authMethods}}{{#last}} Authentication schemes defined for the API:{{/last}}{{/authMethods}}
{{#authMethods}}

### {{{name}}}

{{#isApiKey}}
- **Type**: API key
- **API key parameter name**: {{{keyParamName}}}
- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}}

Note, each API key must be added to a map of `map[string]APIKey` where the key is: {{keyParamName}} and passed in as the auth context for each request.

{{/isApiKey}}
{{#isBasic}}
{{#isBasicBearer}}
- **Type**: HTTP Bearer token authentication

Example

```golang
auth := context.WithValue(context.Background(), sw.ContextAccessToken, "BEARERTOKENSTRING")
r, err := client.Service.Operation(auth, args)
```

{{/isBasicBearer}}
{{#isBasicBasic}}
- **Type**: HTTP basic authentication

Example

```golang
auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{
UserName: "username",
Password: "password",
})
r, err := client.Service.Operation(auth, args)
```

{{/isBasicBasic}}
{{#isHttpSignature}}
- **Type**: HTTP signature authentication

Example

```golang
authConfig := sw.HttpSignatureAuth{
KeyId: "my-key-id",
PrivateKeyPath: "rsa.pem",
Passphrase: "my-passphrase",
SigningScheme: sw.HttpSigningSchemeHs2019,
SignedHeaders: []string{
sw.HttpSignatureParameterRequestTarget, // The special (request-target) parameter expresses the HTTP request target.
sw.HttpSignatureParameterCreated, // Time when request was signed, formatted as a Unix timestamp integer value.
"Host", // The Host request header specifies the domain name of the server, and optionally the TCP port number.
"Date", // The date and time at which the message was originated.
"Content-Type", // The Media type of the body of the request.
"Digest", // A cryptographic digest of the request body.
},
SigningAlgorithm: sw.HttpSigningAlgorithmRsaPSS,
SignatureMaxValidity: 5 * time.Minute,
}
var authCtx context.Context
var err error
if authCtx, err = authConfig.ContextWithValue(context.Background()); err != nil {
// Process error
}
r, err = client.Service.Operation(auth, args)

```
{{/isHttpSignature}}
{{/isBasic}}
{{#isOAuth}}

- **Type**: OAuth
- **Flow**: {{{flow}}}
- **Authorization URL**: {{{authorizationUrl}}}
- **Scopes**: {{^scopes}}N/A{{/scopes}}
{{#scopes}} - **{{{scope}}}**: {{{description}}}
{{/scopes}}

Example

```golang
auth := context.WithValue(context.Background(), sw.ContextAccessToken, "ACCESSTOKENSTRING")
r, err := client.Service.Operation(auth, args)
```

Or via OAuth2 module to automatically refresh tokens and perform user authentication.

```golang
import "golang.org/x/oauth2"

/* Perform OAuth2 round trip request and obtain a token */

tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token)
auth := context.WithValue(oauth2.NoContext, sw.ContextOAuth2, tokenSource)
r, err := client.Service.Operation(auth, args)
```

{{/isOAuth}}
{{/authMethods}}

## Documentation for Utility Methods

Due to the fact that model structure members are all pointers, this package contains
a number of utility functions to easily obtain pointers to values of basic types.
Each of these functions takes a value of the given basic type and returns a pointer to it:

* `PtrBool`
* `PtrInt`
* `PtrInt32`
* `PtrInt64`
* `PtrFloat`
* `PtrFloat32`
* `PtrFloat64`
* `PtrString`
* `PtrTime`

## Author

{{#apiInfo}}{{#apis}}{{#-last}}{{infoEmail}}
{{/-last}}{{/apis}}{{/apiInfo}}
Loading