diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractGoCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractGoCodegen.java index 6b910f446763..24547880a797 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractGoCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractGoCodegen.java @@ -51,6 +51,7 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege public AbstractGoCodegen() { super(); + supportsInheritance = true; hideGenerationTimestamp = Boolean.FALSE; defaultIncludes = new HashSet( @@ -332,6 +333,34 @@ public String getSchemaType(Schema p) { type = openAPIType; return type; } + + /** + * Determines the golang instantiation type of the specified schema. + * + * This function is called when the input schema is a map, and specifically + * when the 'additionalProperties' attribute is present in the OAS specification. + * Codegen invokes this function to resolve the "parent" association to + * 'additionalProperties'. + * + * Note the 'parent' attribute in the codegen model is used in the following scenarios: + * - Indicate a polymorphic association with some other type (e.g. class inheritance). + * - If the specification has a discriminator, cogegen create a “parent” based on the discriminator. + * - Use of the 'additionalProperties' attribute in the OAS specification. + * This is the specific scenario when codegen invokes this function. + * + * @param property the input schema + * + * @return the golang instantiation type of the specified property. + */ + @Override + public String toInstantiationType(Schema property) { + if (ModelUtils.isMapSchema(property)) { + return getTypeDeclaration(property); + } else if (ModelUtils.isArraySchema(property)) { + return getTypeDeclaration(property); + } + return super.toInstantiationType(property); + } @Override public String toOperationId(String operationId) { diff --git a/modules/openapi-generator/src/main/resources/go-experimental/model.mustache b/modules/openapi-generator/src/main/resources/go-experimental/model.mustache index cbffd1fc340f..ac200f650a5a 100644 --- a/modules/openapi-generator/src/main/resources/go-experimental/model.mustache +++ b/modules/openapi-generator/src/main/resources/go-experimental/model.mustache @@ -29,6 +29,11 @@ const ( {{^isEnum}} // {{classname}}{{#description}} {{{description}}}{{/description}}{{^description}} struct for {{{classname}}}{{/description}} type {{classname}} struct { +{{#parent}} +{{^isMapModel}} + {{{parent}}} +{{/isMapModel}} +{{/parent}} {{#vars}} {{^-first}} {{/-first}} diff --git a/modules/openapi-generator/src/main/resources/go/model.mustache b/modules/openapi-generator/src/main/resources/go/model.mustache index 201fd507ff93..f30047a9e216 100644 --- a/modules/openapi-generator/src/main/resources/go/model.mustache +++ b/modules/openapi-generator/src/main/resources/go/model.mustache @@ -29,14 +29,14 @@ const ( {{^isEnum}} // {{classname}}{{#description}} {{{description}}}{{/description}}{{^description}} struct for {{{classname}}}{{/description}} type {{classname}} struct { -{{#vars}} +{{#allVars}} {{^-first}} {{/-first}} {{#description}} // {{{description}}} {{/description}} {{name}} {{#isNullable}}*{{/isNullable}}{{{dataType}}} `json:"{{baseName}}{{^required}},omitempty{{/required}}"{{#withXml}} xml:"{{baseName}}{{#isXmlAttribute}},attr{{/isXmlAttribute}}"{{/withXml}}{{#vendorExtensions.x-go-custom-tag}} {{{.}}}{{/vendorExtensions.x-go-custom-tag}}` -{{/vars}} +{{/allVars}} } {{/isEnum}} {{/model}} diff --git a/modules/openapi-generator/src/main/resources/go/model_doc.mustache b/modules/openapi-generator/src/main/resources/go/model_doc.mustache index e96a7f53257b..ae517d4a75a3 100644 --- a/modules/openapi-generator/src/main/resources/go/model_doc.mustache +++ b/modules/openapi-generator/src/main/resources/go/model_doc.mustache @@ -4,8 +4,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -{{#vars}}**{{name}}** | {{#isNullable}}Pointer to {{/isNullable}}{{#isPrimitiveType}}**{{{dataType}}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{{dataType}}}**]({{complexType}}.md){{/isPrimitiveType}} | {{description}} | {{^required}}[optional] {{/required}}{{#isReadOnly}}[readonly] {{/isReadOnly}}{{#defaultValue}}[default to {{{.}}}]{{/defaultValue}} -{{/vars}} +{{#allVars}}**{{name}}** | {{#isNullable}}Pointer to {{/isNullable}}{{#isPrimitiveType}}**{{{dataType}}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{{dataType}}}**]({{complexType}}.md){{/isPrimitiveType}} | {{description}} | {{^required}}[optional] {{/required}}{{#isReadOnly}}[readonly] {{/isReadOnly}}{{#defaultValue}}[default to {{{.}}}]{{/defaultValue}} +{{/allVars}} [[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-experimental/go-petstore/docs/BigCat.md b/samples/client/petstore/go-experimental/go-petstore/docs/BigCat.md index dd23b6193424..1f1f446d0273 100644 --- a/samples/client/petstore/go-experimental/go-petstore/docs/BigCat.md +++ b/samples/client/petstore/go-experimental/go-petstore/docs/BigCat.md @@ -4,88 +4,10 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**ClassName** | Pointer to **string** | | -**Color** | Pointer to **string** | | [optional] [default to red] -**Declawed** | Pointer to **bool** | | [optional] **Kind** | Pointer to **string** | | [optional] ## Methods -### GetClassName - -`func (o *BigCat) GetClassName() string` - -GetClassName returns the ClassName field if non-nil, zero value otherwise. - -### GetClassNameOk - -`func (o *BigCat) GetClassNameOk() (string, bool)` - -GetClassNameOk returns a tuple with the ClassName field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### HasClassName - -`func (o *BigCat) HasClassName() bool` - -HasClassName returns a boolean if a field has been set. - -### SetClassName - -`func (o *BigCat) SetClassName(v string)` - -SetClassName gets a reference to the given string and assigns it to the ClassName field. - -### GetColor - -`func (o *BigCat) GetColor() string` - -GetColor returns the Color field if non-nil, zero value otherwise. - -### GetColorOk - -`func (o *BigCat) GetColorOk() (string, bool)` - -GetColorOk returns a tuple with the Color field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### HasColor - -`func (o *BigCat) HasColor() bool` - -HasColor returns a boolean if a field has been set. - -### SetColor - -`func (o *BigCat) SetColor(v string)` - -SetColor gets a reference to the given string and assigns it to the Color field. - -### GetDeclawed - -`func (o *BigCat) GetDeclawed() bool` - -GetDeclawed returns the Declawed field if non-nil, zero value otherwise. - -### GetDeclawedOk - -`func (o *BigCat) GetDeclawedOk() (bool, bool)` - -GetDeclawedOk returns a tuple with the Declawed field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### HasDeclawed - -`func (o *BigCat) HasDeclawed() bool` - -HasDeclawed returns a boolean if a field has been set. - -### SetDeclawed - -`func (o *BigCat) SetDeclawed(v bool)` - -SetDeclawed gets a reference to the given bool and assigns it to the Declawed field. - ### GetKind `func (o *BigCat) GetKind() string` diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/Cat.md b/samples/client/petstore/go-experimental/go-petstore/docs/Cat.md index 0f2fe5a1f1f8..c7ea3b3adfb2 100644 --- a/samples/client/petstore/go-experimental/go-petstore/docs/Cat.md +++ b/samples/client/petstore/go-experimental/go-petstore/docs/Cat.md @@ -4,62 +4,10 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**ClassName** | Pointer to **string** | | -**Color** | Pointer to **string** | | [optional] [default to red] **Declawed** | Pointer to **bool** | | [optional] ## Methods -### GetClassName - -`func (o *Cat) GetClassName() string` - -GetClassName returns the ClassName field if non-nil, zero value otherwise. - -### GetClassNameOk - -`func (o *Cat) GetClassNameOk() (string, bool)` - -GetClassNameOk returns a tuple with the ClassName field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### HasClassName - -`func (o *Cat) HasClassName() bool` - -HasClassName returns a boolean if a field has been set. - -### SetClassName - -`func (o *Cat) SetClassName(v string)` - -SetClassName gets a reference to the given string and assigns it to the ClassName field. - -### GetColor - -`func (o *Cat) GetColor() string` - -GetColor returns the Color field if non-nil, zero value otherwise. - -### GetColorOk - -`func (o *Cat) GetColorOk() (string, bool)` - -GetColorOk returns a tuple with the Color field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### HasColor - -`func (o *Cat) HasColor() bool` - -HasColor returns a boolean if a field has been set. - -### SetColor - -`func (o *Cat) SetColor(v string)` - -SetColor gets a reference to the given string and assigns it to the Color field. - ### GetDeclawed `func (o *Cat) GetDeclawed() bool` diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/Dog.md b/samples/client/petstore/go-experimental/go-petstore/docs/Dog.md index 4b5c332d8e14..ddc5be776dc4 100644 --- a/samples/client/petstore/go-experimental/go-petstore/docs/Dog.md +++ b/samples/client/petstore/go-experimental/go-petstore/docs/Dog.md @@ -4,62 +4,10 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**ClassName** | Pointer to **string** | | -**Color** | Pointer to **string** | | [optional] [default to red] **Breed** | Pointer to **string** | | [optional] ## Methods -### GetClassName - -`func (o *Dog) GetClassName() string` - -GetClassName returns the ClassName field if non-nil, zero value otherwise. - -### GetClassNameOk - -`func (o *Dog) GetClassNameOk() (string, bool)` - -GetClassNameOk returns a tuple with the ClassName field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### HasClassName - -`func (o *Dog) HasClassName() bool` - -HasClassName returns a boolean if a field has been set. - -### SetClassName - -`func (o *Dog) SetClassName(v string)` - -SetClassName gets a reference to the given string and assigns it to the ClassName field. - -### GetColor - -`func (o *Dog) GetColor() string` - -GetColor returns the Color field if non-nil, zero value otherwise. - -### GetColorOk - -`func (o *Dog) GetColorOk() (string, bool)` - -GetColorOk returns a tuple with the Color field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### HasColor - -`func (o *Dog) HasColor() bool` - -HasColor returns a boolean if a field has been set. - -### SetColor - -`func (o *Dog) SetColor(v string)` - -SetColor gets a reference to the given string and assigns it to the Color field. - ### GetBreed `func (o *Dog) GetBreed() string` diff --git a/samples/client/petstore/go-experimental/go-petstore/model_big_cat.go b/samples/client/petstore/go-experimental/go-petstore/model_big_cat.go index c9a0a1b69780..1960c5f32f6e 100644 --- a/samples/client/petstore/go-experimental/go-petstore/model_big_cat.go +++ b/samples/client/petstore/go-experimental/go-petstore/model_big_cat.go @@ -16,93 +16,10 @@ import ( // BigCat struct for BigCat type BigCat struct { - ClassName string `json:"className"` - Color *string `json:"color,omitempty"` - Declawed *bool `json:"declawed,omitempty"` + Cat Kind *string `json:"kind,omitempty"` } -// GetClassName returns the ClassName field value -func (o *BigCat) GetClassName() string { - if o == nil { - var ret string - return ret - } - - return o.ClassName -} - -// SetClassName sets field value -func (o *BigCat) SetClassName(v string) { - o.ClassName = v -} - -// GetColor returns the Color field value if set, zero value otherwise. -func (o *BigCat) GetColor() string { - if o == nil || o.Color == nil { - var ret string - return ret - } - return *o.Color -} - -// GetColorOk returns a tuple with the Color field value if set, zero value otherwise -// and a boolean to check if the value has been set. -func (o *BigCat) GetColorOk() (string, bool) { - if o == nil || o.Color == nil { - var ret string - return ret, false - } - return *o.Color, true -} - -// HasColor returns a boolean if a field has been set. -func (o *BigCat) HasColor() bool { - if o != nil && o.Color != nil { - return true - } - - return false -} - -// SetColor gets a reference to the given string and assigns it to the Color field. -func (o *BigCat) SetColor(v string) { - o.Color = &v -} - -// GetDeclawed returns the Declawed field value if set, zero value otherwise. -func (o *BigCat) GetDeclawed() bool { - if o == nil || o.Declawed == nil { - var ret bool - return ret - } - return *o.Declawed -} - -// GetDeclawedOk returns a tuple with the Declawed field value if set, zero value otherwise -// and a boolean to check if the value has been set. -func (o *BigCat) GetDeclawedOk() (bool, bool) { - if o == nil || o.Declawed == nil { - var ret bool - return ret, false - } - return *o.Declawed, true -} - -// HasDeclawed returns a boolean if a field has been set. -func (o *BigCat) HasDeclawed() bool { - if o != nil && o.Declawed != nil { - return true - } - - return false -} - -// SetDeclawed gets a reference to the given bool and assigns it to the Declawed field. -func (o *BigCat) SetDeclawed(v bool) { - o.Declawed = &v -} - // GetKind returns the Kind field value if set, zero value otherwise. func (o *BigCat) GetKind() string { if o == nil || o.Kind == nil { diff --git a/samples/client/petstore/go-experimental/go-petstore/model_cat.go b/samples/client/petstore/go-experimental/go-petstore/model_cat.go index a9f83cc8c408..0303bc0826aa 100644 --- a/samples/client/petstore/go-experimental/go-petstore/model_cat.go +++ b/samples/client/petstore/go-experimental/go-petstore/model_cat.go @@ -16,59 +16,10 @@ import ( // Cat struct for Cat type Cat struct { - ClassName string `json:"className"` - Color *string `json:"color,omitempty"` + Animal Declawed *bool `json:"declawed,omitempty"` } -// GetClassName returns the ClassName field value -func (o *Cat) GetClassName() string { - if o == nil { - var ret string - return ret - } - - return o.ClassName -} - -// SetClassName sets field value -func (o *Cat) SetClassName(v string) { - o.ClassName = v -} - -// GetColor returns the Color field value if set, zero value otherwise. -func (o *Cat) GetColor() string { - if o == nil || o.Color == nil { - var ret string - return ret - } - return *o.Color -} - -// GetColorOk returns a tuple with the Color field value if set, zero value otherwise -// and a boolean to check if the value has been set. -func (o *Cat) GetColorOk() (string, bool) { - if o == nil || o.Color == nil { - var ret string - return ret, false - } - return *o.Color, true -} - -// HasColor returns a boolean if a field has been set. -func (o *Cat) HasColor() bool { - if o != nil && o.Color != nil { - return true - } - - return false -} - -// SetColor gets a reference to the given string and assigns it to the Color field. -func (o *Cat) SetColor(v string) { - o.Color = &v -} - // GetDeclawed returns the Declawed field value if set, zero value otherwise. func (o *Cat) GetDeclawed() bool { if o == nil || o.Declawed == nil { diff --git a/samples/client/petstore/go-experimental/go-petstore/model_dog.go b/samples/client/petstore/go-experimental/go-petstore/model_dog.go index eb2d7f05d41a..176820573897 100644 --- a/samples/client/petstore/go-experimental/go-petstore/model_dog.go +++ b/samples/client/petstore/go-experimental/go-petstore/model_dog.go @@ -16,59 +16,10 @@ import ( // Dog struct for Dog type Dog struct { - ClassName string `json:"className"` - Color *string `json:"color,omitempty"` + Animal Breed *string `json:"breed,omitempty"` } -// GetClassName returns the ClassName field value -func (o *Dog) GetClassName() string { - if o == nil { - var ret string - return ret - } - - return o.ClassName -} - -// SetClassName sets field value -func (o *Dog) SetClassName(v string) { - o.ClassName = v -} - -// GetColor returns the Color field value if set, zero value otherwise. -func (o *Dog) GetColor() string { - if o == nil || o.Color == nil { - var ret string - return ret - } - return *o.Color -} - -// GetColorOk returns a tuple with the Color field value if set, zero value otherwise -// and a boolean to check if the value has been set. -func (o *Dog) GetColorOk() (string, bool) { - if o == nil || o.Color == nil { - var ret string - return ret, false - } - return *o.Color, true -} - -// HasColor returns a boolean if a field has been set. -func (o *Dog) HasColor() bool { - if o != nil && o.Color != nil { - return true - } - - return false -} - -// SetColor gets a reference to the given string and assigns it to the Color field. -func (o *Dog) SetColor(v string) { - o.Color = &v -} - // GetBreed returns the Breed field value if set, zero value otherwise. func (o *Dog) GetBreed() string { if o == nil || o.Breed == nil { diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/Cat.md b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/Cat.md index 0f2fe5a1f1f8..c7ea3b3adfb2 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/Cat.md +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/Cat.md @@ -4,62 +4,10 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**ClassName** | Pointer to **string** | | -**Color** | Pointer to **string** | | [optional] [default to red] **Declawed** | Pointer to **bool** | | [optional] ## Methods -### GetClassName - -`func (o *Cat) GetClassName() string` - -GetClassName returns the ClassName field if non-nil, zero value otherwise. - -### GetClassNameOk - -`func (o *Cat) GetClassNameOk() (string, bool)` - -GetClassNameOk returns a tuple with the ClassName field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### HasClassName - -`func (o *Cat) HasClassName() bool` - -HasClassName returns a boolean if a field has been set. - -### SetClassName - -`func (o *Cat) SetClassName(v string)` - -SetClassName gets a reference to the given string and assigns it to the ClassName field. - -### GetColor - -`func (o *Cat) GetColor() string` - -GetColor returns the Color field if non-nil, zero value otherwise. - -### GetColorOk - -`func (o *Cat) GetColorOk() (string, bool)` - -GetColorOk returns a tuple with the Color field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### HasColor - -`func (o *Cat) HasColor() bool` - -HasColor returns a boolean if a field has been set. - -### SetColor - -`func (o *Cat) SetColor(v string)` - -SetColor gets a reference to the given string and assigns it to the Color field. - ### GetDeclawed `func (o *Cat) GetDeclawed() bool` diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/Dog.md b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/Dog.md index 4b5c332d8e14..ddc5be776dc4 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/Dog.md +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/Dog.md @@ -4,62 +4,10 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**ClassName** | Pointer to **string** | | -**Color** | Pointer to **string** | | [optional] [default to red] **Breed** | Pointer to **string** | | [optional] ## Methods -### GetClassName - -`func (o *Dog) GetClassName() string` - -GetClassName returns the ClassName field if non-nil, zero value otherwise. - -### GetClassNameOk - -`func (o *Dog) GetClassNameOk() (string, bool)` - -GetClassNameOk returns a tuple with the ClassName field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### HasClassName - -`func (o *Dog) HasClassName() bool` - -HasClassName returns a boolean if a field has been set. - -### SetClassName - -`func (o *Dog) SetClassName(v string)` - -SetClassName gets a reference to the given string and assigns it to the ClassName field. - -### GetColor - -`func (o *Dog) GetColor() string` - -GetColor returns the Color field if non-nil, zero value otherwise. - -### GetColorOk - -`func (o *Dog) GetColorOk() (string, bool)` - -GetColorOk returns a tuple with the Color field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### HasColor - -`func (o *Dog) HasColor() bool` - -HasColor returns a boolean if a field has been set. - -### SetColor - -`func (o *Dog) SetColor(v string)` - -SetColor gets a reference to the given string and assigns it to the Color field. - ### GetBreed `func (o *Dog) GetBreed() string` diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_cat.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_cat.go index a9f83cc8c408..0303bc0826aa 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_cat.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_cat.go @@ -16,59 +16,10 @@ import ( // Cat struct for Cat type Cat struct { - ClassName string `json:"className"` - Color *string `json:"color,omitempty"` + Animal Declawed *bool `json:"declawed,omitempty"` } -// GetClassName returns the ClassName field value -func (o *Cat) GetClassName() string { - if o == nil { - var ret string - return ret - } - - return o.ClassName -} - -// SetClassName sets field value -func (o *Cat) SetClassName(v string) { - o.ClassName = v -} - -// GetColor returns the Color field value if set, zero value otherwise. -func (o *Cat) GetColor() string { - if o == nil || o.Color == nil { - var ret string - return ret - } - return *o.Color -} - -// GetColorOk returns a tuple with the Color field value if set, zero value otherwise -// and a boolean to check if the value has been set. -func (o *Cat) GetColorOk() (string, bool) { - if o == nil || o.Color == nil { - var ret string - return ret, false - } - return *o.Color, true -} - -// HasColor returns a boolean if a field has been set. -func (o *Cat) HasColor() bool { - if o != nil && o.Color != nil { - return true - } - - return false -} - -// SetColor gets a reference to the given string and assigns it to the Color field. -func (o *Cat) SetColor(v string) { - o.Color = &v -} - // GetDeclawed returns the Declawed field value if set, zero value otherwise. func (o *Cat) GetDeclawed() bool { if o == nil || o.Declawed == nil { diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_dog.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_dog.go index eb2d7f05d41a..176820573897 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_dog.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_dog.go @@ -16,59 +16,10 @@ import ( // Dog struct for Dog type Dog struct { - ClassName string `json:"className"` - Color *string `json:"color,omitempty"` + Animal Breed *string `json:"breed,omitempty"` } -// GetClassName returns the ClassName field value -func (o *Dog) GetClassName() string { - if o == nil { - var ret string - return ret - } - - return o.ClassName -} - -// SetClassName sets field value -func (o *Dog) SetClassName(v string) { - o.ClassName = v -} - -// GetColor returns the Color field value if set, zero value otherwise. -func (o *Dog) GetColor() string { - if o == nil || o.Color == nil { - var ret string - return ret - } - return *o.Color -} - -// GetColorOk returns a tuple with the Color field value if set, zero value otherwise -// and a boolean to check if the value has been set. -func (o *Dog) GetColorOk() (string, bool) { - if o == nil || o.Color == nil { - var ret string - return ret, false - } - return *o.Color, true -} - -// HasColor returns a boolean if a field has been set. -func (o *Dog) HasColor() bool { - if o != nil && o.Color != nil { - return true - } - - return false -} - -// SetColor gets a reference to the given string and assigns it to the Color field. -func (o *Dog) SetColor(v string) { - o.Color = &v -} - // GetBreed returns the Breed field value if set, zero value otherwise. func (o *Dog) GetBreed() string { if o == nil || o.Breed == nil {