update docstring in go client, better code format (#19268)

* update docstring in go client, better code format

* update samples
This commit is contained in:
William Cheng 2024-07-30 21:17:21 +08:00 committed by GitHub
parent 5d48d224d9
commit 9a18fc1857
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
19 changed files with 4 additions and 46 deletions

View File

@ -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}}.

View File

@ -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) {

View File

@ -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) {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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) {

View File

@ -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 {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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 {

View File

@ -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 {

View File

@ -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) {

View File

@ -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"
}

View File

@ -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"
}