diff --git a/modules/openapi-generator/src/main/resources/go/README.mustache b/modules/openapi-generator/src/main/resources/go/README.mustache index 0b2c0bdd42b..0f687049928 100644 --- a/modules/openapi-generator/src/main/resources/go/README.mustache +++ b/modules/openapi-generator/src/main/resources/go/README.mustache @@ -5,7 +5,7 @@ {{/appDescription}} ## Overview -This API client was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the [swagger-spec](https://github.com/swagger-api/swagger-spec) from a remote server, you can easily generate an API client. +This API client was generated by the [openapi-generator](https://github.com/openapitools/openapi-generator) 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}} @@ -18,6 +18,16 @@ For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}) {{/infoUrl}} ## Installation + +Install the following dependencies: +``` +go get github.com/stretchr/testify/assert +go get golang.org/x/oauth2 +go get golang.org/x/net/context +go get gopkg.in/go-resty/resty.v0 +go get github.com/antihax/optional +``` + Put the package under your project folder and add the following in import: ```golang import "./{{packageName}}" diff --git a/samples/client/petstore/go/go-petstore/README.md b/samples/client/petstore/go/go-petstore/README.md index 65b0efd21eb..ebea7ab70d8 100644 --- a/samples/client/petstore/go/go-petstore/README.md +++ b/samples/client/petstore/go/go-petstore/README.md @@ -3,13 +3,23 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ ## Overview -This API client was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the [swagger-spec](https://github.com/swagger-api/swagger-spec) from a remote server, you can easily generate an API client. +This API client was generated by the [openapi-generator](https://github.com/openapitools/openapi-generator) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. - API version: 1.0.0 - Package version: 1.0.0 - Build package: org.openapitools.codegen.languages.GoClientCodegen ## Installation + +Install the following dependencies: +``` +go get github.com/stretchr/testify/assert +go get golang.org/x/oauth2 +go get golang.org/x/net/context +go get gopkg.in/go-resty/resty.v0 +go get github.com/antihax/optional +``` + Put the package under your project folder and add the following in import: ```golang import "./petstore" diff --git a/samples/client/petstore/go/go-petstore/api/openapi.yaml b/samples/client/petstore/go/go-petstore/api/openapi.yaml index f87e7d7a0a7..3b35b5fdfea 100644 --- a/samples/client/petstore/go/go-petstore/api/openapi.yaml +++ b/samples/client/petstore/go/go-petstore/api/openapi.yaml @@ -100,11 +100,11 @@ paths: type: array items: type: string + default: available enum: - available - pending - sold - default: available responses: 200: description: successful operation @@ -613,20 +613,20 @@ paths: type: array items: type: string + default: $ enum: - '>' - $ - default: $ - name: enum_header_string in: header description: Header parameter enum test (string) schema: type: string + default: -efg enum: - _abc - -efg - (xyz) - default: -efg - name: enum_query_string_array in: query description: Query parameter enum test (string array) @@ -635,20 +635,20 @@ paths: type: array items: type: string + default: $ enum: - '>' - $ - default: $ - name: enum_query_string in: query description: Query parameter enum test (string) schema: type: string + default: -efg enum: - _abc - -efg - (xyz) - default: -efg - name: enum_query_integer in: query description: Query parameter enum test (double) @@ -677,18 +677,18 @@ paths: description: Form parameter enum test (string array) items: type: string + default: $ enum: - '>' - $ - default: $ enum_form_string: type: string description: Form parameter enum test (string) + default: -efg enum: - _abc - -efg - (xyz) - default: -efg responses: 400: description: Invalid request @@ -1100,11 +1100,11 @@ components: name: Name EnumClass: type: string + default: -efg enum: - _abc - -efg - (xyz) - default: -efg List: type: object properties: diff --git a/samples/client/petstore/go/go-petstore/api_fake.go b/samples/client/petstore/go/go-petstore/api_fake.go index 45a015703a4..7f2539bebb7 100644 --- a/samples/client/petstore/go/go-petstore/api_fake.go +++ b/samples/client/petstore/go/go-petstore/api_fake.go @@ -32,12 +32,12 @@ FakeApiService Test serialization of outer boolean types * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param optional nil or *FakeOuterBooleanSerializeOpts - Optional Parameters: - * @param "BooleanPostBody" (optional.Bool) - Input boolean as post body + * @param "Body" (optional.Bool) - Input boolean as post body @return bool */ type FakeOuterBooleanSerializeOpts struct { - BooleanPostBody optional.Bool + Body optional.Bool } func (a *FakeApiService) FakeOuterBooleanSerialize(ctx context.Context, localVarOptionals *FakeOuterBooleanSerializeOpts) (bool, *http.Response, error) { @@ -74,8 +74,8 @@ func (a *FakeApiService) FakeOuterBooleanSerialize(ctx context.Context, localVar localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } // body params - if localVarOptionals != nil && localVarOptionals.BooleanPostBody.IsSet() { - localVarPostBody = localVarOptionals.BooleanPostBody.Value() + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + localVarPostBody = localVarOptionals.Body.Value() } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) diff --git a/samples/client/petstore/go/go-petstore/docs/FakeApi.md b/samples/client/petstore/go/go-petstore/docs/FakeApi.md index 70a4f6b7f40..7c1b6d00025 100644 --- a/samples/client/petstore/go/go-petstore/docs/FakeApi.md +++ b/samples/client/petstore/go/go-petstore/docs/FakeApi.md @@ -34,7 +34,7 @@ Optional parameters are passed through a pointer to a FakeOuterBooleanSerializeO Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **booleanPostBody** | **optional.Bool**| Input boolean as post body | + **body** | **optional.Bool**| Input boolean as post body | ### Return type diff --git a/samples/client/petstore/go/pom.xml b/samples/client/petstore/go/pom.xml index b041afa0710..5525ec1e99e 100644 --- a/samples/client/petstore/go/pom.xml +++ b/samples/client/petstore/go/pom.xml @@ -82,6 +82,20 @@ + + go-get-resty + pre-integration-test + + exec + + + go + + get + github.com/antihax/optional + + + go-test integration-test