diff --git a/modules/openapi-generator/src/main/resources/go/model_simple.mustache b/modules/openapi-generator/src/main/resources/go/model_simple.mustache index b8287e592bb5..b49e1e1ad032 100644 --- a/modules/openapi-generator/src/main/resources/go/model_simple.mustache +++ b/modules/openapi-generator/src/main/resources/go/model_simple.mustache @@ -171,15 +171,14 @@ func (o *{{classname}}) Set{{name}}(v {{vendorExtensions.x-go-base-type}}) { {{#useDefaultValuesForRequiredVars}} {{^isReadOnly}} {{#defaultValue}} -// GetDefault{{baseName}} function assigns the default value {{defaultValue}} to the {{name}} field -// of the {{classname}} struct and returns the {{{defaultValue}}}. +// GetDefault{{{nameInPascalCase}}} returns the default value {{{defaultValue}}} of the {{{name}}} field. func (o *{{classname}}) GetDefault{{nameInPascalCase}}() interface{} { return {{{defaultValue}}} } {{/defaultValue}} {{/isReadOnly}} -{{/useDefaultValuesForRequiredVars}} +{{/useDefaultValuesForRequiredVars}} {{/required}} {{^required}} // Get{{name}} returns the {{name}} field value if set, zero value otherwise{{#isNullable}} (both if not set or set to explicit null){{/isNullable}}. diff --git a/samples/client/echo_api/go-external-refs/model_pet.go b/samples/client/echo_api/go-external-refs/model_pet.go index 50af7c6d33e9..13f24706dfd5 100644 --- a/samples/client/echo_api/go-external-refs/model_pet.go +++ b/samples/client/echo_api/go-external-refs/model_pet.go @@ -108,7 +108,6 @@ func (o *Pet) SetName(v string) { o.Name = v } - // GetCategory returns the Category field value if set, zero value otherwise. func (o *Pet) GetCategory() Category { if o == nil || IsNil(o.Category) { @@ -165,7 +164,6 @@ func (o *Pet) SetPhotoUrls(v []string) { o.PhotoUrls = v } - // GetTags returns the Tags field value if set, zero value otherwise. func (o *Pet) GetTags() []Tag { if o == nil || IsNil(o.Tags) { diff --git a/samples/client/echo_api/go/model_pet.go b/samples/client/echo_api/go/model_pet.go index 50af7c6d33e9..13f24706dfd5 100644 --- a/samples/client/echo_api/go/model_pet.go +++ b/samples/client/echo_api/go/model_pet.go @@ -108,7 +108,6 @@ func (o *Pet) SetName(v string) { o.Name = v } - // GetCategory returns the Category field value if set, zero value otherwise. func (o *Pet) GetCategory() Category { if o == nil || IsNil(o.Category) { @@ -165,7 +164,6 @@ func (o *Pet) SetPhotoUrls(v []string) { o.PhotoUrls = v } - // GetTags returns the Tags field value if set, zero value otherwise. func (o *Pet) GetTags() []Tag { if o == nil || IsNil(o.Tags) { diff --git a/samples/client/others/go/allof_multiple_ref_and_discriminator/model_additional_data.go b/samples/client/others/go/allof_multiple_ref_and_discriminator/model_additional_data.go index 65f35a2f3dc9..a7186d87f51f 100644 --- a/samples/client/others/go/allof_multiple_ref_and_discriminator/model_additional_data.go +++ b/samples/client/others/go/allof_multiple_ref_and_discriminator/model_additional_data.go @@ -74,7 +74,6 @@ func (o *AdditionalData) SetProp1(v string) { o.Prop1 = v } - // GetQuantity returns the Quantity field value func (o *AdditionalData) GetQuantity() int32 { if o == nil { @@ -99,7 +98,6 @@ func (o *AdditionalData) SetQuantity(v int32) { o.Quantity = v } - // GetUnitPrice returns the UnitPrice field value func (o *AdditionalData) GetUnitPrice() float64 { if o == nil { @@ -124,7 +122,6 @@ func (o *AdditionalData) SetUnitPrice(v float64) { o.UnitPrice = v } - // GetTotalPrice returns the TotalPrice field value func (o *AdditionalData) GetTotalPrice() float64 { if o == nil { @@ -149,7 +146,6 @@ func (o *AdditionalData) SetTotalPrice(v float64) { o.TotalPrice = v } - func (o AdditionalData) MarshalJSON() ([]byte, error) { toSerialize,err := o.ToMap() if err != nil { diff --git a/samples/client/others/go/allof_multiple_ref_and_discriminator/model_base_item.go b/samples/client/others/go/allof_multiple_ref_and_discriminator/model_base_item.go index 9c40caf779de..96d4179808c9 100644 --- a/samples/client/others/go/allof_multiple_ref_and_discriminator/model_base_item.go +++ b/samples/client/others/go/allof_multiple_ref_and_discriminator/model_base_item.go @@ -70,7 +70,6 @@ func (o *BaseItem) SetTitle(v string) { o.Title = v } - // GetType returns the Type field value func (o *BaseItem) GetType() string { if o == nil { @@ -95,7 +94,6 @@ func (o *BaseItem) SetType(v string) { o.Type = v } - func (o BaseItem) MarshalJSON() ([]byte, error) { toSerialize,err := o.ToMap() if err != nil { diff --git a/samples/client/others/go/allof_multiple_ref_and_discriminator/model_final_item.go b/samples/client/others/go/allof_multiple_ref_and_discriminator/model_final_item.go index 21c16e930d78..d3845f84998f 100644 --- a/samples/client/others/go/allof_multiple_ref_and_discriminator/model_final_item.go +++ b/samples/client/others/go/allof_multiple_ref_and_discriminator/model_final_item.go @@ -77,7 +77,6 @@ func (o *FinalItem) SetProp1(v string) { o.Prop1 = v } - // GetQuantity returns the Quantity field value func (o *FinalItem) GetQuantity() int32 { if o == nil { @@ -102,7 +101,6 @@ func (o *FinalItem) SetQuantity(v int32) { o.Quantity = v } - // GetUnitPrice returns the UnitPrice field value func (o *FinalItem) GetUnitPrice() float64 { if o == nil { @@ -127,7 +125,6 @@ func (o *FinalItem) SetUnitPrice(v float64) { o.UnitPrice = v } - // GetTotalPrice returns the TotalPrice field value func (o *FinalItem) GetTotalPrice() float64 { if o == nil { @@ -152,7 +149,6 @@ func (o *FinalItem) SetTotalPrice(v float64) { o.TotalPrice = v } - func (o FinalItem) MarshalJSON() ([]byte, error) { toSerialize,err := o.ToMap() if err != nil { diff --git a/samples/client/others/go/oneof-anyof-required/model_nested_object1.go b/samples/client/others/go/oneof-anyof-required/model_nested_object1.go index 824b2634b3a9..f403748a8968 100644 --- a/samples/client/others/go/oneof-anyof-required/model_nested_object1.go +++ b/samples/client/others/go/oneof-anyof-required/model_nested_object1.go @@ -69,7 +69,6 @@ func (o *NestedObject1) SetField1(v string) { o.Field1 = v } - func (o NestedObject1) MarshalJSON() ([]byte, error) { toSerialize,err := o.ToMap() if err != nil { diff --git a/samples/client/others/go/oneof-anyof-required/model_nested_object2.go b/samples/client/others/go/oneof-anyof-required/model_nested_object2.go index 697e295e8a59..c3f9468bc15c 100644 --- a/samples/client/others/go/oneof-anyof-required/model_nested_object2.go +++ b/samples/client/others/go/oneof-anyof-required/model_nested_object2.go @@ -69,7 +69,6 @@ func (o *NestedObject2) SetField2(v string) { o.Field2 = v } - func (o NestedObject2) MarshalJSON() ([]byte, error) { toSerialize,err := o.ToMap() if err != nil { diff --git a/samples/client/petstore/go/go-petstore/model_animal.go b/samples/client/petstore/go/go-petstore/model_animal.go index 028564cf4da9..e23baa88fcc6 100644 --- a/samples/client/petstore/go/go-petstore/model_animal.go +++ b/samples/client/petstore/go/go-petstore/model_animal.go @@ -73,7 +73,6 @@ func (o *Animal) SetClassName(v string) { o.ClassName = v } - // GetColor returns the Color field value if set, zero value otherwise. func (o *Animal) GetColor() string { if o == nil || IsNil(o.Color) { diff --git a/samples/client/petstore/go/go-petstore/model_category.go b/samples/client/petstore/go/go-petstore/model_category.go index 5babac8835c2..d19362640391 100644 --- a/samples/client/petstore/go/go-petstore/model_category.go +++ b/samples/client/petstore/go/go-petstore/model_category.go @@ -103,7 +103,6 @@ func (o *Category) SetName(v string) { o.Name = v } - func (o Category) MarshalJSON() ([]byte, error) { toSerialize,err := o.ToMap() if err != nil { diff --git a/samples/client/petstore/go/go-petstore/model_enum_test_.go b/samples/client/petstore/go/go-petstore/model_enum_test_.go index f660e91a0ee8..cf858376f48b 100644 --- a/samples/client/petstore/go/go-petstore/model_enum_test_.go +++ b/samples/client/petstore/go/go-petstore/model_enum_test_.go @@ -104,7 +104,6 @@ func (o *EnumTest) SetEnumStringRequired(v string) { o.EnumStringRequired = v } - // GetEnumInteger returns the EnumInteger field value if set, zero value otherwise. func (o *EnumTest) GetEnumInteger() int32 { if o == nil || IsNil(o.EnumInteger) { diff --git a/samples/client/petstore/go/go-petstore/model_format_test_.go b/samples/client/petstore/go/go-petstore/model_format_test_.go index 4c921cb01ae0..d2cb7e88a331 100644 --- a/samples/client/petstore/go/go-petstore/model_format_test_.go +++ b/samples/client/petstore/go/go-petstore/model_format_test_.go @@ -182,7 +182,6 @@ func (o *FormatTest) SetNumber(v float32) { o.Number = v } - // GetFloat returns the Float field value if set, zero value otherwise. func (o *FormatTest) GetFloat() float32 { if o == nil || IsNil(o.Float) { @@ -303,7 +302,6 @@ func (o *FormatTest) SetByte(v string) { o.Byte = v } - // GetBinary returns the Binary field value if set, zero value otherwise. func (o *FormatTest) GetBinary() *os.File { if o == nil || IsNil(o.Binary) { @@ -360,7 +358,6 @@ func (o *FormatTest) SetDate(v string) { o.Date = v } - // GetDateTime returns the DateTime field value if set, zero value otherwise. func (o *FormatTest) GetDateTime() time.Time { if o == nil || IsNil(o.DateTime) { @@ -449,7 +446,6 @@ func (o *FormatTest) SetPassword(v string) { o.Password = v } - // GetBigDecimal returns the BigDecimal field value if set, zero value otherwise. func (o *FormatTest) GetBigDecimal() float64 { if o == nil || IsNil(o.BigDecimal) { diff --git a/samples/client/petstore/go/go-petstore/model_name.go b/samples/client/petstore/go/go-petstore/model_name.go index e6c1650b489d..7e009e1cf0b5 100644 --- a/samples/client/petstore/go/go-petstore/model_name.go +++ b/samples/client/petstore/go/go-petstore/model_name.go @@ -71,7 +71,6 @@ func (o *Name) SetName(v int32) { o.Name = v } - // GetSnakeCase returns the SnakeCase field value if set, zero value otherwise. func (o *Name) GetSnakeCase() int32 { if o == nil || IsNil(o.SnakeCase) { diff --git a/samples/client/petstore/go/go-petstore/model_pet.go b/samples/client/petstore/go/go-petstore/model_pet.go index 3fe806e7bafd..de782511daa3 100644 --- a/samples/client/petstore/go/go-petstore/model_pet.go +++ b/samples/client/petstore/go/go-petstore/model_pet.go @@ -139,7 +139,6 @@ func (o *Pet) SetName(v string) { o.Name = v } - // GetPhotoUrls returns the PhotoUrls field value func (o *Pet) GetPhotoUrls() []string { if o == nil { @@ -164,7 +163,6 @@ func (o *Pet) SetPhotoUrls(v []string) { o.PhotoUrls = v } - // GetTags returns the Tags field value if set, zero value otherwise. func (o *Pet) GetTags() []Tag { if o == nil || IsNil(o.Tags) { diff --git a/samples/client/petstore/go/go-petstore/model_type_holder_default.go b/samples/client/petstore/go/go-petstore/model_type_holder_default.go index ded93fd71f96..8a67e9f7a2df 100644 --- a/samples/client/petstore/go/go-petstore/model_type_holder_default.go +++ b/samples/client/petstore/go/go-petstore/model_type_holder_default.go @@ -80,7 +80,6 @@ func (o *TypeHolderDefault) SetStringItem(v string) { o.StringItem = v } - // GetNumberItem returns the NumberItem field value func (o *TypeHolderDefault) GetNumberItem() float32 { if o == nil { @@ -105,7 +104,6 @@ func (o *TypeHolderDefault) SetNumberItem(v float32) { o.NumberItem = v } - // GetIntegerItem returns the IntegerItem field value func (o *TypeHolderDefault) GetIntegerItem() int32 { if o == nil { @@ -130,7 +128,6 @@ func (o *TypeHolderDefault) SetIntegerItem(v int32) { o.IntegerItem = v } - // GetBoolItem returns the BoolItem field value func (o *TypeHolderDefault) GetBoolItem() bool { if o == nil { @@ -155,7 +152,6 @@ func (o *TypeHolderDefault) SetBoolItem(v bool) { o.BoolItem = v } - // GetArrayItem returns the ArrayItem field value func (o *TypeHolderDefault) GetArrayItem() []int32 { if o == nil { @@ -180,7 +176,6 @@ func (o *TypeHolderDefault) SetArrayItem(v []int32) { o.ArrayItem = v } - func (o TypeHolderDefault) MarshalJSON() ([]byte, error) { toSerialize,err := o.ToMap() if err != nil { diff --git a/samples/client/petstore/go/go-petstore/model_type_holder_example.go b/samples/client/petstore/go/go-petstore/model_type_holder_example.go index 532049a81f3b..a08223070828 100644 --- a/samples/client/petstore/go/go-petstore/model_type_holder_example.go +++ b/samples/client/petstore/go/go-petstore/model_type_holder_example.go @@ -78,7 +78,6 @@ func (o *TypeHolderExample) SetStringItem(v string) { o.StringItem = v } - // GetNumberItem returns the NumberItem field value func (o *TypeHolderExample) GetNumberItem() float32 { if o == nil { @@ -103,7 +102,6 @@ func (o *TypeHolderExample) SetNumberItem(v float32) { o.NumberItem = v } - // GetFloatItem returns the FloatItem field value func (o *TypeHolderExample) GetFloatItem() float32 { if o == nil { @@ -128,7 +126,6 @@ func (o *TypeHolderExample) SetFloatItem(v float32) { o.FloatItem = v } - // GetIntegerItem returns the IntegerItem field value func (o *TypeHolderExample) GetIntegerItem() int32 { if o == nil { @@ -153,7 +150,6 @@ func (o *TypeHolderExample) SetIntegerItem(v int32) { o.IntegerItem = v } - // GetBoolItem returns the BoolItem field value func (o *TypeHolderExample) GetBoolItem() bool { if o == nil { @@ -178,7 +174,6 @@ func (o *TypeHolderExample) SetBoolItem(v bool) { o.BoolItem = v } - // GetArrayItem returns the ArrayItem field value func (o *TypeHolderExample) GetArrayItem() []int32 { if o == nil { @@ -203,7 +198,6 @@ func (o *TypeHolderExample) SetArrayItem(v []int32) { o.ArrayItem = v } - func (o TypeHolderExample) MarshalJSON() ([]byte, error) { toSerialize,err := o.ToMap() if err != nil { diff --git a/samples/openapi3/client/petstore/go-petstore-generateMarshalJSON-false/model_pet.go b/samples/openapi3/client/petstore/go-petstore-generateMarshalJSON-false/model_pet.go index b4271c201c97..77983744402d 100644 --- a/samples/openapi3/client/petstore/go-petstore-generateMarshalJSON-false/model_pet.go +++ b/samples/openapi3/client/petstore/go-petstore-generateMarshalJSON-false/model_pet.go @@ -140,7 +140,6 @@ func (o *Pet) SetName(v string) { o.Name = v } - // GetPhotoUrls returns the PhotoUrls field value func (o *Pet) GetPhotoUrls() []string { if o == nil { @@ -165,7 +164,6 @@ func (o *Pet) SetPhotoUrls(v []string) { o.PhotoUrls = v } - // GetTags returns the Tags field value if set, zero value otherwise. func (o *Pet) GetTags() []Tag { if o == nil || IsNil(o.Tags) { diff --git a/samples/openapi3/client/petstore/go/go-petstore/model_category.go b/samples/openapi3/client/petstore/go/go-petstore/model_category.go index 174ecab638b6..a98870474a16 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/model_category.go +++ b/samples/openapi3/client/petstore/go/go-petstore/model_category.go @@ -103,8 +103,7 @@ func (o *Category) SetName(v string) { o.Name = v } -// GetDefaultname function assigns the default value "default-name" to the Name field -// of the Category struct and returns the "default-name". +// GetDefaultName returns the default value "default-name" of the Name field. func (o *Category) GetDefaultName() interface{} { return "default-name" } diff --git a/samples/openapi3/client/petstore/go/go-petstore/model_foo.go b/samples/openapi3/client/petstore/go/go-petstore/model_foo.go index 79d4c43e8d39..d73faa236ad4 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/model_foo.go +++ b/samples/openapi3/client/petstore/go/go-petstore/model_foo.go @@ -72,8 +72,7 @@ func (o *Foo) SetBar(v string) { o.Bar = v } -// GetDefaultbar function assigns the default value "bar" to the Bar field -// of the Foo struct and returns the "bar". +// GetDefaultBar returns the default value "bar" of the Bar field. func (o *Foo) GetDefaultBar() interface{} { return "bar" }