Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Go][Experimental] Rename extensions from x-basetype to x-go-base-type #5691

Merged
merged 2 commits into from
Mar 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public CodegenProperty fromProperty(String name, Schema p) {
public Map<String, Object> postProcessModels(Map<String, Object> objs) {
// The superclass determines the list of required golang imports. The actual list of imports
// depends on which types are used, some of which are changed in the code below (but then preserved
// and used through x-basetype in templates). So super.postProcessModels
// and used through x-go-base-type in templates). So super.postProcessModels
// must be invoked at the beginning of this method.
objs = super.postProcessModels(objs);

Expand All @@ -167,7 +167,7 @@ public Map<String, Object> postProcessModels(Map<String, Object> objs) {
}

for (CodegenProperty param : model.vars) {
param.vendorExtensions.put("x-basetype", param.dataType);
param.vendorExtensions.put("x-go-base-type", param.dataType);
if (!param.isNullable || param.isMapContainer || param.isListContainer) {
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,11 @@ func New{{classname}}WithDefaults() *{{classname}} {
{{#required}}
// Get{{name}} returns the {{name}} field value
{{#isNullable}}
// If the value is explicit nil, the zero value for {{vendorExtensions.x-basetype}} will be returned
// If the value is explicit nil, the zero value for {{vendorExtensions.x-go-base-type}} will be returned
{{/isNullable}}
func (o *{{classname}}) Get{{name}}() {{vendorExtensions.x-basetype}} {
func (o *{{classname}}) Get{{name}}() {{vendorExtensions.x-go-base-type}} {
if o == nil {{#isNullable}}{{^isContainer}}|| o.{{name}}.Get() == nil{{/isContainer}}{{/isNullable}} {
var ret {{vendorExtensions.x-basetype}}
var ret {{vendorExtensions.x-go-base-type}}
return ret
}

Expand All @@ -138,7 +138,7 @@ func (o *{{classname}}) Get{{name}}() {{vendorExtensions.x-basetype}} {
{{#isNullable}}
// NOTE: If the value is an explicit nil, `nil, true` will be returned
{{/isNullable}}
func (o *{{classname}}) Get{{name}}Ok() (*{{vendorExtensions.x-basetype}}, bool) {
func (o *{{classname}}) Get{{name}}Ok() (*{{vendorExtensions.x-go-base-type}}, bool) {
if o == nil {{#isNullable}}{{#isContainer}}|| o.{{name}} == nil{{/isContainer}}{{/isNullable}} {
return nil, false
}
Expand All @@ -156,7 +156,7 @@ func (o *{{classname}}) Get{{name}}Ok() (*{{vendorExtensions.x-basetype}}, bool)
}

// Set{{name}} sets field value
func (o *{{classname}}) Set{{name}}(v {{vendorExtensions.x-basetype}}) {
func (o *{{classname}}) Set{{name}}(v {{vendorExtensions.x-go-base-type}}) {
{{#isNullable}}
{{#isContainer}}
o.{{name}} = v
Expand All @@ -173,9 +173,9 @@ func (o *{{classname}}) Set{{name}}(v {{vendorExtensions.x-basetype}}) {
{{/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}}.
func (o *{{classname}}) Get{{name}}() {{vendorExtensions.x-basetype}} {
func (o *{{classname}}) Get{{name}}() {{vendorExtensions.x-go-base-type}} {
if o == nil {{^isNullable}}|| o.{{name}} == nil{{/isNullable}}{{#isNullable}}{{^isContainer}}|| o.{{name}}.Get() == nil{{/isContainer}}{{/isNullable}} {
var ret {{vendorExtensions.x-basetype}}
var ret {{vendorExtensions.x-go-base-type}}
return ret
}
{{#isNullable}}
Expand All @@ -196,7 +196,7 @@ func (o *{{classname}}) Get{{name}}() {{vendorExtensions.x-basetype}} {
{{#isNullable}}
// NOTE: If the value is an explicit nil, `nil, true` will be returned
{{/isNullable}}
func (o *{{classname}}) Get{{name}}Ok() (*{{vendorExtensions.x-basetype}}, bool) {
func (o *{{classname}}) Get{{name}}Ok() (*{{vendorExtensions.x-go-base-type}}, bool) {
if o == nil {{^isNullable}}|| o.{{name}} == nil{{/isNullable}}{{#isNullable}}{{#isContainer}}|| o.{{name}} == nil{{/isContainer}}{{/isNullable}} {
return nil, false
}
Expand All @@ -223,7 +223,7 @@ func (o *{{classname}}) Has{{name}}() bool {
}

// Set{{name}} gets a reference to the given {{dataType}} and assigns it to the {{name}} field.
func (o *{{classname}}) Set{{name}}(v {{vendorExtensions.x-basetype}}) {
func (o *{{classname}}) Set{{name}}(v {{vendorExtensions.x-go-base-type}}) {
{{#isNullable}}
{{#isContainer}}
o.{{name}} = v
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,20 @@ but it doesn't guarantee that properties required by API are set
{{#vars}}
### Get{{name}}

`func (o *{{classname}}) Get{{name}}() {{vendorExtensions.x-basetype}}`
`func (o *{{classname}}) Get{{name}}() {{vendorExtensions.x-go-base-type}}`

Get{{name}} returns the {{name}} field if non-nil, zero value otherwise.

### Get{{name}}Ok

`func (o *{{classname}}) Get{{name}}Ok() (*{{vendorExtensions.x-basetype}}, bool)`
`func (o *{{classname}}) Get{{name}}Ok() (*{{vendorExtensions.x-go-base-type}}, bool)`

Get{{name}}Ok returns a tuple with the {{name}} field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.

### Set{{name}}

`func (o *{{classname}}) Set{{name}}(v {{vendorExtensions.x-basetype}})`
`func (o *{{classname}}) Set{{name}}(v {{vendorExtensions.x-go-base-type}})`

Set{{name}} sets {{name}} field to given value.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,22 @@ GetCultivar returns the Cultivar field if non-nil, zero value otherwise.

### GetCultivarOk

`func (o *Apple) GetCultivarOk() (string, bool)`
`func (o *Apple) GetCultivarOk() (*string, bool)`

GetCultivarOk returns a tuple with the Cultivar field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.

### HasCultivar
### SetCultivar

`func (o *Apple) HasCultivar() bool`
`func (o *Apple) SetCultivar(v string)`

HasCultivar returns a boolean if a field has been set.
SetCultivar sets Cultivar field to given value.

### SetCultivar
### HasCultivar

`func (o *Apple) SetCultivar(v string)`
`func (o *Apple) HasCultivar() bool`

SetCultivar gets a reference to the given string and assigns it to the Cultivar field.
HasCultivar returns a boolean if a field has been set.

### GetColor

Expand All @@ -59,22 +59,22 @@ GetColor returns the Color field if non-nil, zero value otherwise.

### GetColorOk

`func (o *Apple) GetColorOk() (string, bool)`
`func (o *Apple) 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
### SetColor

`func (o *Apple) HasColor() bool`
`func (o *Apple) SetColor(v string)`

HasColor returns a boolean if a field has been set.
SetColor sets Color field to given value.

### SetColor
### HasColor

`func (o *Apple) SetColor(v string)`
`func (o *Apple) HasColor() bool`

SetColor gets a reference to the given string and assigns it to the Color field.
HasColor returns a boolean if a field has been set.


### AsFruit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,17 @@ GetCultivar returns the Cultivar field if non-nil, zero value otherwise.

### GetCultivarOk

`func (o *AppleReq) GetCultivarOk() (string, bool)`
`func (o *AppleReq) GetCultivarOk() (*string, bool)`

GetCultivarOk returns a tuple with the Cultivar field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.

### HasCultivar

`func (o *AppleReq) HasCultivar() bool`

HasCultivar returns a boolean if a field has been set.

### SetCultivar

`func (o *AppleReq) SetCultivar(v string)`

SetCultivar gets a reference to the given string and assigns it to the Cultivar field.
SetCultivar sets Cultivar field to given value.


### GetMealy

Expand All @@ -59,22 +54,22 @@ GetMealy returns the Mealy field if non-nil, zero value otherwise.

### GetMealyOk

`func (o *AppleReq) GetMealyOk() (bool, bool)`
`func (o *AppleReq) GetMealyOk() (*bool, bool)`

GetMealyOk returns a tuple with the Mealy field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.

### HasMealy
### SetMealy

`func (o *AppleReq) HasMealy() bool`
`func (o *AppleReq) SetMealy(v bool)`

HasMealy returns a boolean if a field has been set.
SetMealy sets Mealy field to given value.

### SetMealy
### HasMealy

`func (o *AppleReq) SetMealy(v bool)`
`func (o *AppleReq) HasMealy() bool`

SetMealy gets a reference to the given bool and assigns it to the Mealy field.
HasMealy returns a boolean if a field has been set.


### AsFruitReq
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,22 @@ GetLengthCm returns the LengthCm field if non-nil, zero value otherwise.

### GetLengthCmOk

`func (o *Banana) GetLengthCmOk() (float32, bool)`
`func (o *Banana) GetLengthCmOk() (*float32, bool)`

GetLengthCmOk returns a tuple with the LengthCm field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.

### HasLengthCm
### SetLengthCm

`func (o *Banana) HasLengthCm() bool`
`func (o *Banana) SetLengthCm(v float32)`

HasLengthCm returns a boolean if a field has been set.
SetLengthCm sets LengthCm field to given value.

### SetLengthCm
### HasLengthCm

`func (o *Banana) SetLengthCm(v float32)`
`func (o *Banana) HasLengthCm() bool`

SetLengthCm gets a reference to the given float32 and assigns it to the LengthCm field.
HasLengthCm returns a boolean if a field has been set.

### GetColor

Expand All @@ -59,22 +59,22 @@ GetColor returns the Color field if non-nil, zero value otherwise.

### GetColorOk

`func (o *Banana) GetColorOk() (string, bool)`
`func (o *Banana) 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
### SetColor

`func (o *Banana) HasColor() bool`
`func (o *Banana) SetColor(v string)`

HasColor returns a boolean if a field has been set.
SetColor sets Color field to given value.

### SetColor
### HasColor

`func (o *Banana) SetColor(v string)`
`func (o *Banana) HasColor() bool`

SetColor gets a reference to the given string and assigns it to the Color field.
HasColor returns a boolean if a field has been set.


### AsFruit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,17 @@ GetLengthCm returns the LengthCm field if non-nil, zero value otherwise.

### GetLengthCmOk

`func (o *BananaReq) GetLengthCmOk() (float32, bool)`
`func (o *BananaReq) GetLengthCmOk() (*float32, bool)`

GetLengthCmOk returns a tuple with the LengthCm field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.

### HasLengthCm

`func (o *BananaReq) HasLengthCm() bool`

HasLengthCm returns a boolean if a field has been set.

### SetLengthCm

`func (o *BananaReq) SetLengthCm(v float32)`

SetLengthCm gets a reference to the given float32 and assigns it to the LengthCm field.
SetLengthCm sets LengthCm field to given value.


### GetSweet

Expand All @@ -59,22 +54,22 @@ GetSweet returns the Sweet field if non-nil, zero value otherwise.

### GetSweetOk

`func (o *BananaReq) GetSweetOk() (bool, bool)`
`func (o *BananaReq) GetSweetOk() (*bool, bool)`

GetSweetOk returns a tuple with the Sweet field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.

### HasSweet
### SetSweet

`func (o *BananaReq) HasSweet() bool`
`func (o *BananaReq) SetSweet(v bool)`

HasSweet returns a boolean if a field has been set.
SetSweet sets Sweet field to given value.

### SetSweet
### HasSweet

`func (o *BananaReq) SetSweet(v bool)`
`func (o *BananaReq) HasSweet() bool`

SetSweet gets a reference to the given bool and assigns it to the Sweet field.
HasSweet returns a boolean if a field has been set.


### AsFruitReq
Expand Down
Loading