diff --git a/modules/swagger-codegen/src/main/resources/go/model.mustache b/modules/swagger-codegen/src/main/resources/go/model.mustache index 7cc53fabbce..3f075f5683e 100644 --- a/modules/swagger-codegen/src/main/resources/go/model.mustache +++ b/modules/swagger-codegen/src/main/resources/go/model.mustache @@ -9,7 +9,7 @@ import ({{/imports}}{{#imports}} type {{classname}} struct { {{#vars}}{{#description}} // {{{description}}}{{/description}} - {{name}} {{{datatype}}} `json:"{{baseName}},omitempty"` + {{name}} {{^isPrimitiveType}}{{^isContainer}}{{^isDate}}{{^isDateTime}}*{{/isDateTime}}{{/isDate}}{{/isContainer}}{{/isPrimitiveType}}{{{datatype}}} `json:"{{baseName}}{{^required}},omitempty{{/required}}"` {{/vars}} } {{/model}}{{/models}} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/go/model_doc.mustache b/modules/swagger-codegen/src/main/resources/go/model_doc.mustache index 569550df372..a158fd4707f 100644 --- a/modules/swagger-codegen/src/main/resources/go/model_doc.mustache +++ b/modules/swagger-codegen/src/main/resources/go/model_doc.mustache @@ -3,7 +3,7 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -{{#vars}}**{{name}}** | {{#isPrimitiveType}}**{{datatype}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{datatype}}**]({{complexType}}.md){{/isPrimitiveType}} | {{description}} | {{^required}}[optional] {{/required}}{{#readOnly}}[readonly] {{/readOnly}}{{#defaultValue}}[default to {{{.}}}]{{/defaultValue}} +{{#vars}}**{{name}}** | {{#isPrimitiveType}}**{{datatype}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{^isContainer}}{{^isDate}}{{^isDateTime}}*{{/isDateTime}}{{/isDate}}{{/isContainer}}{{datatype}}**]({{complexType}}.md){{/isPrimitiveType}} | {{description}} | {{^required}}[optional] {{/required}}{{#readOnly}}[readonly] {{/readOnly}}{{#defaultValue}}[default to {{{.}}}]{{/defaultValue}} {{/vars}} [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/go/go-petstore/animal.go b/samples/client/petstore/go/go-petstore/animal.go index f385f78a41c..0b14ac8d2c0 100644 --- a/samples/client/petstore/go/go-petstore/animal.go +++ b/samples/client/petstore/go/go-petstore/animal.go @@ -12,7 +12,7 @@ package petstore type Animal struct { - ClassName string `json:"className,omitempty"` + ClassName string `json:"className"` Color string `json:"color,omitempty"` } diff --git a/samples/client/petstore/go/go-petstore/cat.go b/samples/client/petstore/go/go-petstore/cat.go index 6469034b1fc..72f3a77fd18 100644 --- a/samples/client/petstore/go/go-petstore/cat.go +++ b/samples/client/petstore/go/go-petstore/cat.go @@ -12,7 +12,7 @@ package petstore type Cat struct { - ClassName string `json:"className,omitempty"` + ClassName string `json:"className"` Color string `json:"color,omitempty"` diff --git a/samples/client/petstore/go/go-petstore/configuration.go b/samples/client/petstore/go/go-petstore/configuration.go index 5311b72fa18..0c512912fa5 100644 --- a/samples/client/petstore/go/go-petstore/configuration.go +++ b/samples/client/petstore/go/go-petstore/configuration.go @@ -18,7 +18,7 @@ import ( type Configuration struct { - UserName string `json:"userName,omitempty"` + Username string `json:"userName,omitempty"` Password string `json:"password,omitempty"` APIKeyPrefix map[string]string `json:"APIKeyPrefix,omitempty"` APIKey map[string]string `json:"APIKey,omitempty"` @@ -51,7 +51,7 @@ func NewConfiguration() *Configuration { } func (c *Configuration) GetBasicAuthEncodedString() string { - return base64.StdEncoding.EncodeToString([]byte(c.UserName + ":" + c.Password)) + return base64.StdEncoding.EncodeToString([]byte(c.Username + ":" + c.Password)) } func (c *Configuration) AddDefaultHeader(key string, value string) { diff --git a/samples/client/petstore/go/go-petstore/docs/EnumTest.md b/samples/client/petstore/go/go-petstore/docs/EnumTest.md index 2e67672188e..d51101dd40b 100644 --- a/samples/client/petstore/go/go-petstore/docs/EnumTest.md +++ b/samples/client/petstore/go/go-petstore/docs/EnumTest.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes **EnumString** | **string** | | [optional] [default to null] **EnumInteger** | **int32** | | [optional] [default to null] **EnumNumber** | **float64** | | [optional] [default to null] -**OuterEnum** | [**OuterEnum**](OuterEnum.md) | | [optional] [default to null] +**OuterEnum** | [***OuterEnum**](OuterEnum.md) | | [optional] [default to null] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/go/go-petstore/docs/FakeApi.md b/samples/client/petstore/go/go-petstore/docs/FakeApi.md index 915750589e4..ccf43185182 100644 --- a/samples/client/petstore/go/go-petstore/docs/FakeApi.md +++ b/samples/client/petstore/go/go-petstore/docs/FakeApi.md @@ -1,6 +1,6 @@ # \FakeApi -All URIs are relative to ** +All URIs are relative to *http://petstore.swagger.io/v2* Method | HTTP request | Description ------------- | ------------- | ------------- @@ -14,6 +14,8 @@ Method | HTTP request | Description To test \"client\" model +To test \"client\" model + ### Parameters @@ -83,6 +85,8 @@ void (empty response body) To test enum parameters +To test enum parameters + ### Parameters @@ -94,7 +98,7 @@ Name | Type | Description | Notes **enumHeaderString** | **string**| Header parameter enum test (string) | [optional] [default to -efg] **enumQueryStringArray** | [**[]string**](string.md)| Query parameter enum test (string array) | [optional] **enumQueryString** | **string**| Query parameter enum test (string) | [optional] [default to -efg] - **enumQueryInteger** | **float32**| Query parameter enum test (double) | [optional] + **enumQueryInteger** | **int32**| Query parameter enum test (double) | [optional] **enumQueryDouble** | **float64**| Query parameter enum test (double) | [optional] ### Return type diff --git a/samples/client/petstore/go/go-petstore/docs/Pet.md b/samples/client/petstore/go/go-petstore/docs/Pet.md index d53855396cd..8579e3d3fb9 100644 --- a/samples/client/petstore/go/go-petstore/docs/Pet.md +++ b/samples/client/petstore/go/go-petstore/docs/Pet.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Id** | **int64** | | [optional] [default to null] -**Category** | [**Category**](Category.md) | | [optional] [default to null] +**Category** | [***Category**](Category.md) | | [optional] [default to null] **Name** | **string** | | [default to null] **PhotoUrls** | **[]string** | | [default to null] **Tags** | [**[]Tag**](Tag.md) | | [optional] [default to null] diff --git a/samples/client/petstore/go/go-petstore/docs/PetApi.md b/samples/client/petstore/go/go-petstore/docs/PetApi.md index 2bccb81cd2b..e96bdc1a15e 100644 --- a/samples/client/petstore/go/go-petstore/docs/PetApi.md +++ b/samples/client/petstore/go/go-petstore/docs/PetApi.md @@ -1,6 +1,6 @@ # \PetApi -All URIs are relative to ** +All URIs are relative to *http://petstore.swagger.io/v2* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/samples/client/petstore/go/go-petstore/docs/StoreApi.md b/samples/client/petstore/go/go-petstore/docs/StoreApi.md index 83841e3f350..1ee858d2e30 100644 --- a/samples/client/petstore/go/go-petstore/docs/StoreApi.md +++ b/samples/client/petstore/go/go-petstore/docs/StoreApi.md @@ -1,6 +1,6 @@ # \StoreApi -All URIs are relative to ** +All URIs are relative to *http://petstore.swagger.io/v2* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/samples/client/petstore/go/go-petstore/docs/UserApi.md b/samples/client/petstore/go/go-petstore/docs/UserApi.md index 88b825bb148..4950105ca86 100644 --- a/samples/client/petstore/go/go-petstore/docs/UserApi.md +++ b/samples/client/petstore/go/go-petstore/docs/UserApi.md @@ -1,6 +1,6 @@ # \UserApi -All URIs are relative to ** +All URIs are relative to *http://petstore.swagger.io/v2* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/samples/client/petstore/go/go-petstore/dog.go b/samples/client/petstore/go/go-petstore/dog.go index 5b404801abb..a2d91c6e6a1 100644 --- a/samples/client/petstore/go/go-petstore/dog.go +++ b/samples/client/petstore/go/go-petstore/dog.go @@ -12,7 +12,7 @@ package petstore type Dog struct { - ClassName string `json:"className,omitempty"` + ClassName string `json:"className"` Color string `json:"color,omitempty"` diff --git a/samples/client/petstore/go/go-petstore/enum_test.go b/samples/client/petstore/go/go-petstore/enum_test.go index 086c239379b..c138ae5c3bd 100644 --- a/samples/client/petstore/go/go-petstore/enum_test.go +++ b/samples/client/petstore/go/go-petstore/enum_test.go @@ -18,5 +18,5 @@ type EnumTest struct { EnumNumber float64 `json:"enum_number,omitempty"` - OuterEnum OuterEnum `json:"outerEnum,omitempty"` + OuterEnum *OuterEnum `json:"outerEnum,omitempty"` } diff --git a/samples/client/petstore/go/go-petstore/fake_api.go b/samples/client/petstore/go/go-petstore/fake_api.go index 2170fe29f08..b407199cd27 100644 --- a/samples/client/petstore/go/go-petstore/fake_api.go +++ b/samples/client/petstore/go/go-petstore/fake_api.go @@ -38,6 +38,7 @@ func NewFakeApiWithBasePath(basePath string) *FakeApi { } /** + * To test \"client\" model * To test \"client\" model * * @param body client model @@ -132,7 +133,7 @@ func (a FakeApi) TestEndpointParameters(number float32, double float64, patternW var localVarFileBytes []byte // authentication '(http_basic_test)' required // http basic authentication required - if a.Configuration.UserName != "" || a.Configuration.Password != ""{ + if a.Configuration.Username != "" || a.Configuration.Password != ""{ localVarHeaderParams["Authorization"] = "Basic " + a.Configuration.GetBasicAuthEncodedString() } // add default headers if any @@ -190,6 +191,7 @@ func (a FakeApi) TestEndpointParameters(number float32, double float64, patternW } /** + * To test enum parameters * To test enum parameters * * @param enumFormStringArray Form parameter enum test (string array) @@ -202,7 +204,7 @@ func (a FakeApi) TestEndpointParameters(number float32, double float64, patternW * @param enumQueryDouble Query parameter enum test (double) * @return void */ -func (a FakeApi) TestEnumParameters(enumFormStringArray []string, enumFormString string, enumHeaderStringArray []string, enumHeaderString string, enumQueryStringArray []string, enumQueryString string, enumQueryInteger float32, enumQueryDouble float64) (*APIResponse, error) { +func (a FakeApi) TestEnumParameters(enumFormStringArray []string, enumFormString string, enumHeaderStringArray []string, enumHeaderString string, enumQueryStringArray []string, enumQueryString string, enumQueryInteger int32, enumQueryDouble float64) (*APIResponse, error) { var localVarHttpMethod = strings.ToUpper("Get") // create path and map variables diff --git a/samples/client/petstore/go/go-petstore/format_test.go b/samples/client/petstore/go/go-petstore/format_test.go index a4c8b307443..43125b9df34 100644 --- a/samples/client/petstore/go/go-petstore/format_test.go +++ b/samples/client/petstore/go/go-petstore/format_test.go @@ -22,7 +22,7 @@ type FormatTest struct { Int64_ int64 `json:"int64,omitempty"` - Number float32 `json:"number,omitempty"` + Number float32 `json:"number"` Float float32 `json:"float,omitempty"` @@ -30,15 +30,15 @@ type FormatTest struct { String_ string `json:"string,omitempty"` - Byte_ string `json:"byte,omitempty"` + Byte_ string `json:"byte"` Binary string `json:"binary,omitempty"` - Date time.Time `json:"date,omitempty"` + Date time.Time `json:"date"` DateTime time.Time `json:"dateTime,omitempty"` Uuid string `json:"uuid,omitempty"` - Password string `json:"password,omitempty"` + Password string `json:"password"` } diff --git a/samples/client/petstore/go/go-petstore/name.go b/samples/client/petstore/go/go-petstore/name.go index c29919ccb18..cd427f8a861 100644 --- a/samples/client/petstore/go/go-petstore/name.go +++ b/samples/client/petstore/go/go-petstore/name.go @@ -13,7 +13,7 @@ package petstore // Model for testing model name same as property name type Name struct { - Name int32 `json:"name,omitempty"` + Name int32 `json:"name"` SnakeCase int32 `json:"snake_case,omitempty"` diff --git a/samples/client/petstore/go/go-petstore/pet.go b/samples/client/petstore/go/go-petstore/pet.go index 7e44791e180..b1ff5ffc869 100644 --- a/samples/client/petstore/go/go-petstore/pet.go +++ b/samples/client/petstore/go/go-petstore/pet.go @@ -14,11 +14,11 @@ type Pet struct { Id int64 `json:"id,omitempty"` - Category Category `json:"category,omitempty"` + Category *Category `json:"category,omitempty"` - Name string `json:"name,omitempty"` + Name string `json:"name"` - PhotoUrls []string `json:"photoUrls,omitempty"` + PhotoUrls []string `json:"photoUrls"` Tags []Tag `json:"tags,omitempty"`