forked from loafle/openapi-generator-original
[Go] bug fix (breaking), minor code format enhancement (#8715)
* go minor code format enhnacement * fix required vars in the model new * remove comma
This commit is contained in:
@@ -77,8 +77,10 @@ func (r {{#structPrefix}}{{&classname}}{{/structPrefix}}Api{{operationId}}Reques
|
||||
func (a *{{{classname}}}Service) {{{nickname}}}(ctx _context.Context{{#pathParams}}, {{paramName}} {{{dataType}}}{{/pathParams}}) {{#structPrefix}}{{&classname}}{{/structPrefix}}Api{{operationId}}Request {
|
||||
return {{#structPrefix}}{{&classname}}{{/structPrefix}}Api{{operationId}}Request{
|
||||
ApiService: a,
|
||||
ctx: ctx,{{#pathParams}}
|
||||
{{paramName}}: {{paramName}},{{/pathParams}}
|
||||
ctx: ctx,
|
||||
{{#pathParams}}
|
||||
{{paramName}}: {{paramName}},
|
||||
{{/pathParams}}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -169,7 +169,6 @@ func parameterToJson(obj interface{}) (string, error) {
|
||||
return string(jsonBuf), err
|
||||
}
|
||||
|
||||
|
||||
// callAPI do the request.
|
||||
func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) {
|
||||
if c.cfg.Debug {
|
||||
@@ -409,9 +408,9 @@ func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err err
|
||||
return nil
|
||||
}
|
||||
if jsonCheck.MatchString(contentType) {
|
||||
if actualObj, ok := v.(interface{GetActualInstance() interface{}}); ok { // oneOf, anyOf schemas
|
||||
if unmarshalObj, ok := actualObj.(interface{UnmarshalJSON([]byte) error}); ok { // make sure it has UnmarshalJSON defined
|
||||
if err = unmarshalObj.UnmarshalJSON(b); err!= nil {
|
||||
if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas
|
||||
if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined
|
||||
if err = unmarshalObj.UnmarshalJSON(b); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -31,9 +31,9 @@ type _{{{classname}}} {{{classname}}}
|
||||
// This constructor will assign default values to properties that have it defined,
|
||||
// and makes sure properties required by API are set, but the set of arguments
|
||||
// will change when the set of required properties is changed
|
||||
func New{{classname}}({{#vars}}{{#required}}{{nameInCamelCase}} {{dataType}}, {{/required}}{{/vars}}) *{{classname}} {
|
||||
func New{{classname}}({{#requiredVars}}{{nameInCamelCase}} {{dataType}}{{^-last}}, {{/-last}}{{/requiredVars}}) *{{classname}} {
|
||||
this := {{classname}}{}
|
||||
{{#vars}}
|
||||
{{#allVars}}
|
||||
{{#required}}
|
||||
this.{{name}} = {{nameInCamelCase}}
|
||||
{{/required}}
|
||||
@@ -51,7 +51,7 @@ func New{{classname}}({{#vars}}{{#required}}{{nameInCamelCase}} {{dataType}}, {{
|
||||
{{/vendorExtensions.x-golang-is-container}}
|
||||
{{/defaultValue}}
|
||||
{{/required}}
|
||||
{{/vars}}
|
||||
{{/allVars}}
|
||||
return &this
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ func New{{classname}}WithDefaults() *{{classname}} {
|
||||
// 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-go-base-type}} {
|
||||
if o == nil {{#isNullable}}{{^vendorExtensions.x-golang-is-container}}|| o.{{name}}.Get() == nil{{/vendorExtensions.x-golang-is-container}}{{/isNullable}} {
|
||||
if o == nil{{#isNullable}}{{^vendorExtensions.x-golang-is-container}} || o.{{name}}.Get() == nil{{/vendorExtensions.x-golang-is-container}}{{/isNullable}} {
|
||||
var ret {{vendorExtensions.x-go-base-type}}
|
||||
return ret
|
||||
}
|
||||
|
||||
@@ -66,7 +66,6 @@ func (v *NullableBool) UnmarshalJSON(src []byte) error {
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
||||
|
||||
|
||||
type NullableInt struct {
|
||||
value *int
|
||||
isSet bool
|
||||
@@ -103,7 +102,6 @@ func (v *NullableInt) UnmarshalJSON(src []byte) error {
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
||||
|
||||
|
||||
type NullableInt32 struct {
|
||||
value *int32
|
||||
isSet bool
|
||||
@@ -140,7 +138,6 @@ func (v *NullableInt32) UnmarshalJSON(src []byte) error {
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
||||
|
||||
|
||||
type NullableInt64 struct {
|
||||
value *int64
|
||||
isSet bool
|
||||
@@ -177,7 +174,6 @@ func (v *NullableInt64) UnmarshalJSON(src []byte) error {
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
||||
|
||||
|
||||
type NullableFloat32 struct {
|
||||
value *float32
|
||||
isSet bool
|
||||
@@ -214,7 +210,6 @@ func (v *NullableFloat32) UnmarshalJSON(src []byte) error {
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
||||
|
||||
|
||||
type NullableFloat64 struct {
|
||||
value *float64
|
||||
isSet bool
|
||||
@@ -251,7 +246,6 @@ func (v *NullableFloat64) UnmarshalJSON(src []byte) error {
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
||||
|
||||
|
||||
type NullableString struct {
|
||||
value *string
|
||||
isSet bool
|
||||
@@ -288,7 +282,6 @@ func (v *NullableString) UnmarshalJSON(src []byte) error {
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
||||
|
||||
|
||||
type NullableTime struct {
|
||||
value *time.Time
|
||||
isSet bool
|
||||
|
||||
@@ -172,7 +172,6 @@ func parameterToJson(obj interface{}) (string, error) {
|
||||
return string(jsonBuf), err
|
||||
}
|
||||
|
||||
|
||||
// callAPI do the request.
|
||||
func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) {
|
||||
if c.cfg.Debug {
|
||||
@@ -382,9 +381,9 @@ func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err err
|
||||
return nil
|
||||
}
|
||||
if jsonCheck.MatchString(contentType) {
|
||||
if actualObj, ok := v.(interface{GetActualInstance() interface{}}); ok { // oneOf, anyOf schemas
|
||||
if unmarshalObj, ok := actualObj.(interface{UnmarshalJSON([]byte) error}); ok { // make sure it has UnmarshalJSON defined
|
||||
if err = unmarshalObj.UnmarshalJSON(b); err!= nil {
|
||||
if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas
|
||||
if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined
|
||||
if err = unmarshalObj.UnmarshalJSON(b); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -24,7 +24,7 @@ type Animal struct {
|
||||
// This constructor will assign default values to properties that have it defined,
|
||||
// and makes sure properties required by API are set, but the set of arguments
|
||||
// will change when the set of required properties is changed
|
||||
func NewAnimal(className string, ) *Animal {
|
||||
func NewAnimal(className string) *Animal {
|
||||
this := Animal{}
|
||||
this.ClassName = className
|
||||
var color string = "red"
|
||||
@@ -44,7 +44,7 @@ func NewAnimalWithDefaults() *Animal {
|
||||
|
||||
// GetClassName returns the ClassName field value
|
||||
func (o *Animal) GetClassName() string {
|
||||
if o == nil {
|
||||
if o == nil {
|
||||
var ret string
|
||||
return ret
|
||||
}
|
||||
|
||||
@@ -24,8 +24,11 @@ type BigCat struct {
|
||||
// This constructor will assign default values to properties that have it defined,
|
||||
// and makes sure properties required by API are set, but the set of arguments
|
||||
// will change when the set of required properties is changed
|
||||
func NewBigCat() *BigCat {
|
||||
func NewBigCat(className string) *BigCat {
|
||||
this := BigCat{}
|
||||
this.ClassName = className
|
||||
var color string = "red"
|
||||
this.Color = &color
|
||||
return &this
|
||||
}
|
||||
|
||||
|
||||
@@ -24,8 +24,11 @@ type Cat struct {
|
||||
// This constructor will assign default values to properties that have it defined,
|
||||
// and makes sure properties required by API are set, but the set of arguments
|
||||
// will change when the set of required properties is changed
|
||||
func NewCat() *Cat {
|
||||
func NewCat(className string) *Cat {
|
||||
this := Cat{}
|
||||
this.ClassName = className
|
||||
var color string = "red"
|
||||
this.Color = &color
|
||||
return &this
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ type Category struct {
|
||||
// This constructor will assign default values to properties that have it defined,
|
||||
// and makes sure properties required by API are set, but the set of arguments
|
||||
// will change when the set of required properties is changed
|
||||
func NewCategory(name string, ) *Category {
|
||||
func NewCategory(name string) *Category {
|
||||
this := Category{}
|
||||
this.Name = name
|
||||
return &this
|
||||
@@ -74,7 +74,7 @@ func (o *Category) SetId(v int64) {
|
||||
|
||||
// GetName returns the Name field value
|
||||
func (o *Category) GetName() string {
|
||||
if o == nil {
|
||||
if o == nil {
|
||||
var ret string
|
||||
return ret
|
||||
}
|
||||
|
||||
@@ -24,8 +24,11 @@ type Dog struct {
|
||||
// This constructor will assign default values to properties that have it defined,
|
||||
// and makes sure properties required by API are set, but the set of arguments
|
||||
// will change when the set of required properties is changed
|
||||
func NewDog() *Dog {
|
||||
func NewDog(className string) *Dog {
|
||||
this := Dog{}
|
||||
this.ClassName = className
|
||||
var color string = "red"
|
||||
this.Color = &color
|
||||
return &this
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ type EnumTest struct {
|
||||
// This constructor will assign default values to properties that have it defined,
|
||||
// and makes sure properties required by API are set, but the set of arguments
|
||||
// will change when the set of required properties is changed
|
||||
func NewEnumTest(enumStringRequired string, ) *EnumTest {
|
||||
func NewEnumTest(enumStringRequired string) *EnumTest {
|
||||
this := EnumTest{}
|
||||
this.EnumStringRequired = enumStringRequired
|
||||
return &this
|
||||
@@ -75,7 +75,7 @@ func (o *EnumTest) SetEnumString(v string) {
|
||||
|
||||
// GetEnumStringRequired returns the EnumStringRequired field value
|
||||
func (o *EnumTest) GetEnumStringRequired() string {
|
||||
if o == nil {
|
||||
if o == nil {
|
||||
var ret string
|
||||
return ret
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ type FormatTest struct {
|
||||
// This constructor will assign default values to properties that have it defined,
|
||||
// and makes sure properties required by API are set, but the set of arguments
|
||||
// will change when the set of required properties is changed
|
||||
func NewFormatTest(number float32, byte_ string, date string, password string, ) *FormatTest {
|
||||
func NewFormatTest(number float32, byte_ string, date string, password string) *FormatTest {
|
||||
this := FormatTest{}
|
||||
this.Number = number
|
||||
this.Byte = byte_
|
||||
@@ -153,7 +153,7 @@ func (o *FormatTest) SetInt64(v int64) {
|
||||
|
||||
// GetNumber returns the Number field value
|
||||
func (o *FormatTest) GetNumber() float32 {
|
||||
if o == nil {
|
||||
if o == nil {
|
||||
var ret float32
|
||||
return ret
|
||||
}
|
||||
@@ -273,7 +273,7 @@ func (o *FormatTest) SetString(v string) {
|
||||
|
||||
// GetByte returns the Byte field value
|
||||
func (o *FormatTest) GetByte() string {
|
||||
if o == nil {
|
||||
if o == nil {
|
||||
var ret string
|
||||
return ret
|
||||
}
|
||||
@@ -329,7 +329,7 @@ func (o *FormatTest) SetBinary(v *os.File) {
|
||||
|
||||
// GetDate returns the Date field value
|
||||
func (o *FormatTest) GetDate() string {
|
||||
if o == nil {
|
||||
if o == nil {
|
||||
var ret string
|
||||
return ret
|
||||
}
|
||||
@@ -417,7 +417,7 @@ func (o *FormatTest) SetUuid(v string) {
|
||||
|
||||
// GetPassword returns the Password field value
|
||||
func (o *FormatTest) GetPassword() string {
|
||||
if o == nil {
|
||||
if o == nil {
|
||||
var ret string
|
||||
return ret
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ type Name struct {
|
||||
// This constructor will assign default values to properties that have it defined,
|
||||
// and makes sure properties required by API are set, but the set of arguments
|
||||
// will change when the set of required properties is changed
|
||||
func NewName(name int32, ) *Name {
|
||||
func NewName(name int32) *Name {
|
||||
this := Name{}
|
||||
this.Name = name
|
||||
return &this
|
||||
@@ -42,7 +42,7 @@ func NewNameWithDefaults() *Name {
|
||||
|
||||
// GetName returns the Name field value
|
||||
func (o *Name) GetName() int32 {
|
||||
if o == nil {
|
||||
if o == nil {
|
||||
var ret int32
|
||||
return ret
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ type Pet struct {
|
||||
// This constructor will assign default values to properties that have it defined,
|
||||
// and makes sure properties required by API are set, but the set of arguments
|
||||
// will change when the set of required properties is changed
|
||||
func NewPet(name string, photoUrls []string, ) *Pet {
|
||||
func NewPet(name string, photoUrls []string) *Pet {
|
||||
this := Pet{}
|
||||
this.Name = name
|
||||
this.PhotoUrls = photoUrls
|
||||
@@ -110,7 +110,7 @@ func (o *Pet) SetCategory(v Category) {
|
||||
|
||||
// GetName returns the Name field value
|
||||
func (o *Pet) GetName() string {
|
||||
if o == nil {
|
||||
if o == nil {
|
||||
var ret string
|
||||
return ret
|
||||
}
|
||||
@@ -134,7 +134,7 @@ func (o *Pet) SetName(v string) {
|
||||
|
||||
// GetPhotoUrls returns the PhotoUrls field value
|
||||
func (o *Pet) GetPhotoUrls() []string {
|
||||
if o == nil {
|
||||
if o == nil {
|
||||
var ret []string
|
||||
return ret
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ type TypeHolderDefault struct {
|
||||
// This constructor will assign default values to properties that have it defined,
|
||||
// and makes sure properties required by API are set, but the set of arguments
|
||||
// will change when the set of required properties is changed
|
||||
func NewTypeHolderDefault(stringItem string, numberItem float32, integerItem int32, boolItem bool, arrayItem []int32, ) *TypeHolderDefault {
|
||||
func NewTypeHolderDefault(stringItem string, numberItem float32, integerItem int32, boolItem bool, arrayItem []int32) *TypeHolderDefault {
|
||||
this := TypeHolderDefault{}
|
||||
this.StringItem = stringItem
|
||||
this.NumberItem = numberItem
|
||||
@@ -51,7 +51,7 @@ func NewTypeHolderDefaultWithDefaults() *TypeHolderDefault {
|
||||
|
||||
// GetStringItem returns the StringItem field value
|
||||
func (o *TypeHolderDefault) GetStringItem() string {
|
||||
if o == nil {
|
||||
if o == nil {
|
||||
var ret string
|
||||
return ret
|
||||
}
|
||||
@@ -75,7 +75,7 @@ func (o *TypeHolderDefault) SetStringItem(v string) {
|
||||
|
||||
// GetNumberItem returns the NumberItem field value
|
||||
func (o *TypeHolderDefault) GetNumberItem() float32 {
|
||||
if o == nil {
|
||||
if o == nil {
|
||||
var ret float32
|
||||
return ret
|
||||
}
|
||||
@@ -99,7 +99,7 @@ func (o *TypeHolderDefault) SetNumberItem(v float32) {
|
||||
|
||||
// GetIntegerItem returns the IntegerItem field value
|
||||
func (o *TypeHolderDefault) GetIntegerItem() int32 {
|
||||
if o == nil {
|
||||
if o == nil {
|
||||
var ret int32
|
||||
return ret
|
||||
}
|
||||
@@ -123,7 +123,7 @@ func (o *TypeHolderDefault) SetIntegerItem(v int32) {
|
||||
|
||||
// GetBoolItem returns the BoolItem field value
|
||||
func (o *TypeHolderDefault) GetBoolItem() bool {
|
||||
if o == nil {
|
||||
if o == nil {
|
||||
var ret bool
|
||||
return ret
|
||||
}
|
||||
@@ -147,7 +147,7 @@ func (o *TypeHolderDefault) SetBoolItem(v bool) {
|
||||
|
||||
// GetArrayItem returns the ArrayItem field value
|
||||
func (o *TypeHolderDefault) GetArrayItem() []int32 {
|
||||
if o == nil {
|
||||
if o == nil {
|
||||
var ret []int32
|
||||
return ret
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ type TypeHolderExample struct {
|
||||
// This constructor will assign default values to properties that have it defined,
|
||||
// and makes sure properties required by API are set, but the set of arguments
|
||||
// will change when the set of required properties is changed
|
||||
func NewTypeHolderExample(stringItem string, numberItem float32, floatItem float32, integerItem int32, boolItem bool, arrayItem []int32, ) *TypeHolderExample {
|
||||
func NewTypeHolderExample(stringItem string, numberItem float32, floatItem float32, integerItem int32, boolItem bool, arrayItem []int32) *TypeHolderExample {
|
||||
this := TypeHolderExample{}
|
||||
this.StringItem = stringItem
|
||||
this.NumberItem = numberItem
|
||||
@@ -49,7 +49,7 @@ func NewTypeHolderExampleWithDefaults() *TypeHolderExample {
|
||||
|
||||
// GetStringItem returns the StringItem field value
|
||||
func (o *TypeHolderExample) GetStringItem() string {
|
||||
if o == nil {
|
||||
if o == nil {
|
||||
var ret string
|
||||
return ret
|
||||
}
|
||||
@@ -73,7 +73,7 @@ func (o *TypeHolderExample) SetStringItem(v string) {
|
||||
|
||||
// GetNumberItem returns the NumberItem field value
|
||||
func (o *TypeHolderExample) GetNumberItem() float32 {
|
||||
if o == nil {
|
||||
if o == nil {
|
||||
var ret float32
|
||||
return ret
|
||||
}
|
||||
@@ -97,7 +97,7 @@ func (o *TypeHolderExample) SetNumberItem(v float32) {
|
||||
|
||||
// GetFloatItem returns the FloatItem field value
|
||||
func (o *TypeHolderExample) GetFloatItem() float32 {
|
||||
if o == nil {
|
||||
if o == nil {
|
||||
var ret float32
|
||||
return ret
|
||||
}
|
||||
@@ -121,7 +121,7 @@ func (o *TypeHolderExample) SetFloatItem(v float32) {
|
||||
|
||||
// GetIntegerItem returns the IntegerItem field value
|
||||
func (o *TypeHolderExample) GetIntegerItem() int32 {
|
||||
if o == nil {
|
||||
if o == nil {
|
||||
var ret int32
|
||||
return ret
|
||||
}
|
||||
@@ -145,7 +145,7 @@ func (o *TypeHolderExample) SetIntegerItem(v int32) {
|
||||
|
||||
// GetBoolItem returns the BoolItem field value
|
||||
func (o *TypeHolderExample) GetBoolItem() bool {
|
||||
if o == nil {
|
||||
if o == nil {
|
||||
var ret bool
|
||||
return ret
|
||||
}
|
||||
@@ -169,7 +169,7 @@ func (o *TypeHolderExample) SetBoolItem(v bool) {
|
||||
|
||||
// GetArrayItem returns the ArrayItem field value
|
||||
func (o *TypeHolderExample) GetArrayItem() []int32 {
|
||||
if o == nil {
|
||||
if o == nil {
|
||||
var ret []int32
|
||||
return ret
|
||||
}
|
||||
|
||||
@@ -75,7 +75,6 @@ func (v *NullableBool) UnmarshalJSON(src []byte) error {
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
||||
|
||||
|
||||
type NullableInt struct {
|
||||
value *int
|
||||
isSet bool
|
||||
@@ -112,7 +111,6 @@ func (v *NullableInt) UnmarshalJSON(src []byte) error {
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
||||
|
||||
|
||||
type NullableInt32 struct {
|
||||
value *int32
|
||||
isSet bool
|
||||
@@ -149,7 +147,6 @@ func (v *NullableInt32) UnmarshalJSON(src []byte) error {
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
||||
|
||||
|
||||
type NullableInt64 struct {
|
||||
value *int64
|
||||
isSet bool
|
||||
@@ -186,7 +183,6 @@ func (v *NullableInt64) UnmarshalJSON(src []byte) error {
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
||||
|
||||
|
||||
type NullableFloat32 struct {
|
||||
value *float32
|
||||
isSet bool
|
||||
@@ -223,7 +219,6 @@ func (v *NullableFloat32) UnmarshalJSON(src []byte) error {
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
||||
|
||||
|
||||
type NullableFloat64 struct {
|
||||
value *float64
|
||||
isSet bool
|
||||
@@ -260,7 +255,6 @@ func (v *NullableFloat64) UnmarshalJSON(src []byte) error {
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
||||
|
||||
|
||||
type NullableString struct {
|
||||
value *string
|
||||
isSet bool
|
||||
@@ -297,7 +291,6 @@ func (v *NullableString) UnmarshalJSON(src []byte) error {
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
||||
|
||||
|
||||
type NullableTime struct {
|
||||
value *time.Time
|
||||
isSet bool
|
||||
|
||||
@@ -157,7 +157,6 @@ func parameterToJson(obj interface{}) (string, error) {
|
||||
return string(jsonBuf), err
|
||||
}
|
||||
|
||||
|
||||
// callAPI do the request.
|
||||
func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) {
|
||||
if c.cfg.Debug {
|
||||
@@ -367,9 +366,9 @@ func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err err
|
||||
return nil
|
||||
}
|
||||
if jsonCheck.MatchString(contentType) {
|
||||
if actualObj, ok := v.(interface{GetActualInstance() interface{}}); ok { // oneOf, anyOf schemas
|
||||
if unmarshalObj, ok := actualObj.(interface{UnmarshalJSON([]byte) error}); ok { // make sure it has UnmarshalJSON defined
|
||||
if err = unmarshalObj.UnmarshalJSON(b); err!= nil {
|
||||
if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas
|
||||
if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined
|
||||
if err = unmarshalObj.UnmarshalJSON(b); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -75,7 +75,6 @@ func (v *NullableBool) UnmarshalJSON(src []byte) error {
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
||||
|
||||
|
||||
type NullableInt struct {
|
||||
value *int
|
||||
isSet bool
|
||||
@@ -112,7 +111,6 @@ func (v *NullableInt) UnmarshalJSON(src []byte) error {
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
||||
|
||||
|
||||
type NullableInt32 struct {
|
||||
value *int32
|
||||
isSet bool
|
||||
@@ -149,7 +147,6 @@ func (v *NullableInt32) UnmarshalJSON(src []byte) error {
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
||||
|
||||
|
||||
type NullableInt64 struct {
|
||||
value *int64
|
||||
isSet bool
|
||||
@@ -186,7 +183,6 @@ func (v *NullableInt64) UnmarshalJSON(src []byte) error {
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
||||
|
||||
|
||||
type NullableFloat32 struct {
|
||||
value *float32
|
||||
isSet bool
|
||||
@@ -223,7 +219,6 @@ func (v *NullableFloat32) UnmarshalJSON(src []byte) error {
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
||||
|
||||
|
||||
type NullableFloat64 struct {
|
||||
value *float64
|
||||
isSet bool
|
||||
@@ -260,7 +255,6 @@ func (v *NullableFloat64) UnmarshalJSON(src []byte) error {
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
||||
|
||||
|
||||
type NullableString struct {
|
||||
value *string
|
||||
isSet bool
|
||||
@@ -297,7 +291,6 @@ func (v *NullableString) UnmarshalJSON(src []byte) error {
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
||||
|
||||
|
||||
type NullableTime struct {
|
||||
value *time.Time
|
||||
isSet bool
|
||||
|
||||
@@ -175,7 +175,6 @@ func parameterToJson(obj interface{}) (string, error) {
|
||||
return string(jsonBuf), err
|
||||
}
|
||||
|
||||
|
||||
// callAPI do the request.
|
||||
func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) {
|
||||
if c.cfg.Debug {
|
||||
@@ -395,9 +394,9 @@ func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err err
|
||||
return nil
|
||||
}
|
||||
if jsonCheck.MatchString(contentType) {
|
||||
if actualObj, ok := v.(interface{GetActualInstance() interface{}}); ok { // oneOf, anyOf schemas
|
||||
if unmarshalObj, ok := actualObj.(interface{UnmarshalJSON([]byte) error}); ok { // make sure it has UnmarshalJSON defined
|
||||
if err = unmarshalObj.UnmarshalJSON(b); err!= nil {
|
||||
if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas
|
||||
if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined
|
||||
if err = unmarshalObj.UnmarshalJSON(b); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -27,7 +27,7 @@ type _Animal Animal
|
||||
// This constructor will assign default values to properties that have it defined,
|
||||
// and makes sure properties required by API are set, but the set of arguments
|
||||
// will change when the set of required properties is changed
|
||||
func NewAnimal(className string, ) *Animal {
|
||||
func NewAnimal(className string) *Animal {
|
||||
this := Animal{}
|
||||
this.ClassName = className
|
||||
var color string = "red"
|
||||
@@ -47,7 +47,7 @@ func NewAnimalWithDefaults() *Animal {
|
||||
|
||||
// GetClassName returns the ClassName field value
|
||||
func (o *Animal) GetClassName() string {
|
||||
if o == nil {
|
||||
if o == nil {
|
||||
var ret string
|
||||
return ret
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ type _AppleReq AppleReq
|
||||
// This constructor will assign default values to properties that have it defined,
|
||||
// and makes sure properties required by API are set, but the set of arguments
|
||||
// will change when the set of required properties is changed
|
||||
func NewAppleReq(cultivar string, ) *AppleReq {
|
||||
func NewAppleReq(cultivar string) *AppleReq {
|
||||
this := AppleReq{}
|
||||
this.Cultivar = cultivar
|
||||
return &this
|
||||
@@ -43,7 +43,7 @@ func NewAppleReqWithDefaults() *AppleReq {
|
||||
|
||||
// GetCultivar returns the Cultivar field value
|
||||
func (o *AppleReq) GetCultivar() string {
|
||||
if o == nil {
|
||||
if o == nil {
|
||||
var ret string
|
||||
return ret
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ type _BananaReq BananaReq
|
||||
// This constructor will assign default values to properties that have it defined,
|
||||
// and makes sure properties required by API are set, but the set of arguments
|
||||
// will change when the set of required properties is changed
|
||||
func NewBananaReq(lengthCm float32, ) *BananaReq {
|
||||
func NewBananaReq(lengthCm float32) *BananaReq {
|
||||
this := BananaReq{}
|
||||
this.LengthCm = lengthCm
|
||||
return &this
|
||||
@@ -43,7 +43,7 @@ func NewBananaReqWithDefaults() *BananaReq {
|
||||
|
||||
// GetLengthCm returns the LengthCm field value
|
||||
func (o *BananaReq) GetLengthCm() float32 {
|
||||
if o == nil {
|
||||
if o == nil {
|
||||
var ret float32
|
||||
return ret
|
||||
}
|
||||
|
||||
@@ -29,8 +29,11 @@ type _Cat Cat
|
||||
// This constructor will assign default values to properties that have it defined,
|
||||
// and makes sure properties required by API are set, but the set of arguments
|
||||
// will change when the set of required properties is changed
|
||||
func NewCat() *Cat {
|
||||
func NewCat(className string) *Cat {
|
||||
this := Cat{}
|
||||
this.ClassName = className
|
||||
var color string = "red"
|
||||
this.Color = &color
|
||||
return &this
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ type _Category Category
|
||||
// This constructor will assign default values to properties that have it defined,
|
||||
// and makes sure properties required by API are set, but the set of arguments
|
||||
// will change when the set of required properties is changed
|
||||
func NewCategory(name string, ) *Category {
|
||||
func NewCategory(name string) *Category {
|
||||
this := Category{}
|
||||
this.Name = name
|
||||
return &this
|
||||
@@ -77,7 +77,7 @@ func (o *Category) SetId(v int64) {
|
||||
|
||||
// GetName returns the Name field value
|
||||
func (o *Category) GetName() string {
|
||||
if o == nil {
|
||||
if o == nil {
|
||||
var ret string
|
||||
return ret
|
||||
}
|
||||
|
||||
@@ -29,8 +29,11 @@ type _Dog Dog
|
||||
// This constructor will assign default values to properties that have it defined,
|
||||
// and makes sure properties required by API are set, but the set of arguments
|
||||
// will change when the set of required properties is changed
|
||||
func NewDog() *Dog {
|
||||
func NewDog(className string) *Dog {
|
||||
this := Dog{}
|
||||
this.ClassName = className
|
||||
var color string = "red"
|
||||
this.Color = &color
|
||||
return &this
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ type _EnumTest EnumTest
|
||||
// This constructor will assign default values to properties that have it defined,
|
||||
// and makes sure properties required by API are set, but the set of arguments
|
||||
// will change when the set of required properties is changed
|
||||
func NewEnumTest(enumStringRequired string, ) *EnumTest {
|
||||
func NewEnumTest(enumStringRequired string) *EnumTest {
|
||||
this := EnumTest{}
|
||||
this.EnumStringRequired = enumStringRequired
|
||||
var outerEnumDefaultValue OuterEnumDefaultValue = OUTERENUMDEFAULTVALUE_PLACED
|
||||
@@ -89,7 +89,7 @@ func (o *EnumTest) SetEnumString(v string) {
|
||||
|
||||
// GetEnumStringRequired returns the EnumStringRequired field value
|
||||
func (o *EnumTest) GetEnumStringRequired() string {
|
||||
if o == nil {
|
||||
if o == nil {
|
||||
var ret string
|
||||
return ret
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ type _FormatTest FormatTest
|
||||
// This constructor will assign default values to properties that have it defined,
|
||||
// and makes sure properties required by API are set, but the set of arguments
|
||||
// will change when the set of required properties is changed
|
||||
func NewFormatTest(number float32, byte_ string, date string, password string, ) *FormatTest {
|
||||
func NewFormatTest(number float32, byte_ string, date string, password string) *FormatTest {
|
||||
this := FormatTest{}
|
||||
this.Number = number
|
||||
this.Byte = byte_
|
||||
@@ -159,7 +159,7 @@ func (o *FormatTest) SetInt64(v int64) {
|
||||
|
||||
// GetNumber returns the Number field value
|
||||
func (o *FormatTest) GetNumber() float32 {
|
||||
if o == nil {
|
||||
if o == nil {
|
||||
var ret float32
|
||||
return ret
|
||||
}
|
||||
@@ -279,7 +279,7 @@ func (o *FormatTest) SetString(v string) {
|
||||
|
||||
// GetByte returns the Byte field value
|
||||
func (o *FormatTest) GetByte() string {
|
||||
if o == nil {
|
||||
if o == nil {
|
||||
var ret string
|
||||
return ret
|
||||
}
|
||||
@@ -335,7 +335,7 @@ func (o *FormatTest) SetBinary(v *os.File) {
|
||||
|
||||
// GetDate returns the Date field value
|
||||
func (o *FormatTest) GetDate() string {
|
||||
if o == nil {
|
||||
if o == nil {
|
||||
var ret string
|
||||
return ret
|
||||
}
|
||||
@@ -423,7 +423,7 @@ func (o *FormatTest) SetUuid(v string) {
|
||||
|
||||
// GetPassword returns the Password field value
|
||||
func (o *FormatTest) GetPassword() string {
|
||||
if o == nil {
|
||||
if o == nil {
|
||||
var ret string
|
||||
return ret
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ type _Name Name
|
||||
// This constructor will assign default values to properties that have it defined,
|
||||
// and makes sure properties required by API are set, but the set of arguments
|
||||
// will change when the set of required properties is changed
|
||||
func NewName(name int32, ) *Name {
|
||||
func NewName(name int32) *Name {
|
||||
this := Name{}
|
||||
this.Name = name
|
||||
return &this
|
||||
@@ -45,7 +45,7 @@ func NewNameWithDefaults() *Name {
|
||||
|
||||
// GetName returns the Name field value
|
||||
func (o *Name) GetName() int32 {
|
||||
if o == nil {
|
||||
if o == nil {
|
||||
var ret int32
|
||||
return ret
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ type _Pet Pet
|
||||
// This constructor will assign default values to properties that have it defined,
|
||||
// and makes sure properties required by API are set, but the set of arguments
|
||||
// will change when the set of required properties is changed
|
||||
func NewPet(name string, photoUrls []string, ) *Pet {
|
||||
func NewPet(name string, photoUrls []string) *Pet {
|
||||
this := Pet{}
|
||||
this.Name = name
|
||||
this.PhotoUrls = photoUrls
|
||||
@@ -113,7 +113,7 @@ func (o *Pet) SetCategory(v Category) {
|
||||
|
||||
// GetName returns the Name field value
|
||||
func (o *Pet) GetName() string {
|
||||
if o == nil {
|
||||
if o == nil {
|
||||
var ret string
|
||||
return ret
|
||||
}
|
||||
@@ -137,7 +137,7 @@ func (o *Pet) SetName(v string) {
|
||||
|
||||
// GetPhotoUrls returns the PhotoUrls field value
|
||||
func (o *Pet) GetPhotoUrls() []string {
|
||||
if o == nil {
|
||||
if o == nil {
|
||||
var ret []string
|
||||
return ret
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ type _Whale Whale
|
||||
// This constructor will assign default values to properties that have it defined,
|
||||
// and makes sure properties required by API are set, but the set of arguments
|
||||
// will change when the set of required properties is changed
|
||||
func NewWhale(className string, ) *Whale {
|
||||
func NewWhale(className string) *Whale {
|
||||
this := Whale{}
|
||||
this.ClassName = className
|
||||
return &this
|
||||
@@ -108,7 +108,7 @@ func (o *Whale) SetHasTeeth(v bool) {
|
||||
|
||||
// GetClassName returns the ClassName field value
|
||||
func (o *Whale) GetClassName() string {
|
||||
if o == nil {
|
||||
if o == nil {
|
||||
var ret string
|
||||
return ret
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ type _Zebra Zebra
|
||||
// This constructor will assign default values to properties that have it defined,
|
||||
// and makes sure properties required by API are set, but the set of arguments
|
||||
// will change when the set of required properties is changed
|
||||
func NewZebra(className string, ) *Zebra {
|
||||
func NewZebra(className string) *Zebra {
|
||||
this := Zebra{}
|
||||
this.ClassName = className
|
||||
return &this
|
||||
@@ -75,7 +75,7 @@ func (o *Zebra) SetType(v string) {
|
||||
|
||||
// GetClassName returns the ClassName field value
|
||||
func (o *Zebra) GetClassName() string {
|
||||
if o == nil {
|
||||
if o == nil {
|
||||
var ret string
|
||||
return ret
|
||||
}
|
||||
|
||||
@@ -75,7 +75,6 @@ func (v *NullableBool) UnmarshalJSON(src []byte) error {
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
||||
|
||||
|
||||
type NullableInt struct {
|
||||
value *int
|
||||
isSet bool
|
||||
@@ -112,7 +111,6 @@ func (v *NullableInt) UnmarshalJSON(src []byte) error {
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
||||
|
||||
|
||||
type NullableInt32 struct {
|
||||
value *int32
|
||||
isSet bool
|
||||
@@ -149,7 +147,6 @@ func (v *NullableInt32) UnmarshalJSON(src []byte) error {
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
||||
|
||||
|
||||
type NullableInt64 struct {
|
||||
value *int64
|
||||
isSet bool
|
||||
@@ -186,7 +183,6 @@ func (v *NullableInt64) UnmarshalJSON(src []byte) error {
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
||||
|
||||
|
||||
type NullableFloat32 struct {
|
||||
value *float32
|
||||
isSet bool
|
||||
@@ -223,7 +219,6 @@ func (v *NullableFloat32) UnmarshalJSON(src []byte) error {
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
||||
|
||||
|
||||
type NullableFloat64 struct {
|
||||
value *float64
|
||||
isSet bool
|
||||
@@ -260,7 +255,6 @@ func (v *NullableFloat64) UnmarshalJSON(src []byte) error {
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
||||
|
||||
|
||||
type NullableString struct {
|
||||
value *string
|
||||
isSet bool
|
||||
@@ -297,7 +291,6 @@ func (v *NullableString) UnmarshalJSON(src []byte) error {
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
||||
|
||||
|
||||
type NullableTime struct {
|
||||
value *time.Time
|
||||
isSet bool
|
||||
|
||||
Reference in New Issue
Block a user