mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-07-08 16:40:56 +00:00
[Go] return errors that happen while unmarshalling objects (#16525)
* [Go] return errors that happen while unmarshalling objects * Update model samples * More updates to samples * Update failing Go store API test to match the one that passes
This commit is contained in:
parent
9c4f6c46f7
commit
5b4d97016a
@ -404,10 +404,14 @@ func (o *{{{classname}}}) UnmarshalJSON(bytes []byte) (err error) {
|
||||
{{#isMap}}
|
||||
var{{{classname}}} := _{{{classname}}}{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &var{{{classname}}}); err == nil {
|
||||
*o = {{{classname}}}(var{{{classname}}})
|
||||
err = json.Unmarshal(bytes, &var{{{classname}}})
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*o = {{{classname}}}(var{{{classname}}})
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
@ -423,10 +427,14 @@ func (o *{{{classname}}}) UnmarshalJSON(bytes []byte) (err error) {
|
||||
{{^parent}}
|
||||
var{{{classname}}} := _{{{classname}}}{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &var{{{classname}}}); err == nil {
|
||||
*o = {{{classname}}}(var{{{classname}}})
|
||||
err = json.Unmarshal(bytes, &var{{{classname}}})
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*o = {{{classname}}}(var{{{classname}}})
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
|
@ -98,10 +98,14 @@ func (o AdditionalPropertiesAnyType) ToMap() (map[string]interface{}, error) {
|
||||
func (o *AdditionalPropertiesAnyType) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varAdditionalPropertiesAnyType := _AdditionalPropertiesAnyType{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varAdditionalPropertiesAnyType); err == nil {
|
||||
*o = AdditionalPropertiesAnyType(varAdditionalPropertiesAnyType)
|
||||
err = json.Unmarshal(bytes, &varAdditionalPropertiesAnyType)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*o = AdditionalPropertiesAnyType(varAdditionalPropertiesAnyType)
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
|
@ -98,10 +98,14 @@ func (o AdditionalPropertiesArray) ToMap() (map[string]interface{}, error) {
|
||||
func (o *AdditionalPropertiesArray) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varAdditionalPropertiesArray := _AdditionalPropertiesArray{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varAdditionalPropertiesArray); err == nil {
|
||||
*o = AdditionalPropertiesArray(varAdditionalPropertiesArray)
|
||||
err = json.Unmarshal(bytes, &varAdditionalPropertiesArray)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*o = AdditionalPropertiesArray(varAdditionalPropertiesArray)
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
|
@ -98,10 +98,14 @@ func (o AdditionalPropertiesBoolean) ToMap() (map[string]interface{}, error) {
|
||||
func (o *AdditionalPropertiesBoolean) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varAdditionalPropertiesBoolean := _AdditionalPropertiesBoolean{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varAdditionalPropertiesBoolean); err == nil {
|
||||
*o = AdditionalPropertiesBoolean(varAdditionalPropertiesBoolean)
|
||||
err = json.Unmarshal(bytes, &varAdditionalPropertiesBoolean)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*o = AdditionalPropertiesBoolean(varAdditionalPropertiesBoolean)
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
|
@ -98,10 +98,14 @@ func (o AdditionalPropertiesInteger) ToMap() (map[string]interface{}, error) {
|
||||
func (o *AdditionalPropertiesInteger) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varAdditionalPropertiesInteger := _AdditionalPropertiesInteger{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varAdditionalPropertiesInteger); err == nil {
|
||||
*o = AdditionalPropertiesInteger(varAdditionalPropertiesInteger)
|
||||
err = json.Unmarshal(bytes, &varAdditionalPropertiesInteger)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*o = AdditionalPropertiesInteger(varAdditionalPropertiesInteger)
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
|
@ -98,10 +98,14 @@ func (o AdditionalPropertiesNumber) ToMap() (map[string]interface{}, error) {
|
||||
func (o *AdditionalPropertiesNumber) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varAdditionalPropertiesNumber := _AdditionalPropertiesNumber{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varAdditionalPropertiesNumber); err == nil {
|
||||
*o = AdditionalPropertiesNumber(varAdditionalPropertiesNumber)
|
||||
err = json.Unmarshal(bytes, &varAdditionalPropertiesNumber)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*o = AdditionalPropertiesNumber(varAdditionalPropertiesNumber)
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
|
@ -98,10 +98,14 @@ func (o AdditionalPropertiesObject) ToMap() (map[string]interface{}, error) {
|
||||
func (o *AdditionalPropertiesObject) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varAdditionalPropertiesObject := _AdditionalPropertiesObject{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varAdditionalPropertiesObject); err == nil {
|
||||
*o = AdditionalPropertiesObject(varAdditionalPropertiesObject)
|
||||
err = json.Unmarshal(bytes, &varAdditionalPropertiesObject)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*o = AdditionalPropertiesObject(varAdditionalPropertiesObject)
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
|
@ -98,10 +98,14 @@ func (o AdditionalPropertiesString) ToMap() (map[string]interface{}, error) {
|
||||
func (o *AdditionalPropertiesString) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varAdditionalPropertiesString := _AdditionalPropertiesString{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varAdditionalPropertiesString); err == nil {
|
||||
*o = AdditionalPropertiesString(varAdditionalPropertiesString)
|
||||
err = json.Unmarshal(bytes, &varAdditionalPropertiesString)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*o = AdditionalPropertiesString(varAdditionalPropertiesString)
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
|
@ -134,10 +134,14 @@ func (o Model200Response) ToMap() (map[string]interface{}, error) {
|
||||
func (o *Model200Response) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varModel200Response := _Model200Response{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varModel200Response); err == nil {
|
||||
*o = Model200Response(varModel200Response)
|
||||
err = json.Unmarshal(bytes, &varModel200Response)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*o = Model200Response(varModel200Response)
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
|
@ -98,10 +98,14 @@ func (o FooGetDefaultResponse) ToMap() (map[string]interface{}, error) {
|
||||
func (o *FooGetDefaultResponse) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varFooGetDefaultResponse := _FooGetDefaultResponse{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varFooGetDefaultResponse); err == nil {
|
||||
*o = FooGetDefaultResponse(varFooGetDefaultResponse)
|
||||
err = json.Unmarshal(bytes, &varFooGetDefaultResponse)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*o = FooGetDefaultResponse(varFooGetDefaultResponse)
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
|
@ -98,10 +98,14 @@ func (o SpecialModelName) ToMap() (map[string]interface{}, error) {
|
||||
func (o *SpecialModelName) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varSpecialModelName := _SpecialModelName{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varSpecialModelName); err == nil {
|
||||
*o = SpecialModelName(varSpecialModelName)
|
||||
err = json.Unmarshal(bytes, &varSpecialModelName)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*o = SpecialModelName(varSpecialModelName)
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
|
@ -134,10 +134,14 @@ func (o AdditionalPropertiesClass) ToMap() (map[string]interface{}, error) {
|
||||
func (o *AdditionalPropertiesClass) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varAdditionalPropertiesClass := _AdditionalPropertiesClass{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varAdditionalPropertiesClass); err == nil {
|
||||
*o = AdditionalPropertiesClass(varAdditionalPropertiesClass)
|
||||
err = json.Unmarshal(bytes, &varAdditionalPropertiesClass)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*o = AdditionalPropertiesClass(varAdditionalPropertiesClass)
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
|
@ -99,10 +99,14 @@ func (o AllOfPrimitiveTypes) ToMap() (map[string]interface{}, error) {
|
||||
func (o *AllOfPrimitiveTypes) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varAllOfPrimitiveTypes := _AllOfPrimitiveTypes{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varAllOfPrimitiveTypes); err == nil {
|
||||
*o = AllOfPrimitiveTypes(varAllOfPrimitiveTypes)
|
||||
err = json.Unmarshal(bytes, &varAllOfPrimitiveTypes)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*o = AllOfPrimitiveTypes(varAllOfPrimitiveTypes)
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
|
@ -129,10 +129,14 @@ func (o Animal) ToMap() (map[string]interface{}, error) {
|
||||
func (o *Animal) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varAnimal := _Animal{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varAnimal); err == nil {
|
||||
*o = Animal(varAnimal)
|
||||
err = json.Unmarshal(bytes, &varAnimal)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*o = Animal(varAnimal)
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
|
@ -170,10 +170,14 @@ func (o ApiResponse) ToMap() (map[string]interface{}, error) {
|
||||
func (o *ApiResponse) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varApiResponse := _ApiResponse{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varApiResponse); err == nil {
|
||||
*o = ApiResponse(varApiResponse)
|
||||
err = json.Unmarshal(bytes, &varApiResponse)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*o = ApiResponse(varApiResponse)
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
|
@ -98,10 +98,14 @@ func (o Apple) ToMap() (map[string]interface{}, error) {
|
||||
func (o *Apple) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varApple := _Apple{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varApple); err == nil {
|
||||
*o = Apple(varApple)
|
||||
err = json.Unmarshal(bytes, &varApple)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*o = Apple(varApple)
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
|
@ -125,10 +125,14 @@ func (o AppleReq) ToMap() (map[string]interface{}, error) {
|
||||
func (o *AppleReq) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varAppleReq := _AppleReq{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varAppleReq); err == nil {
|
||||
*o = AppleReq(varAppleReq)
|
||||
err = json.Unmarshal(bytes, &varAppleReq)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*o = AppleReq(varAppleReq)
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
|
@ -98,10 +98,14 @@ func (o ArrayOfArrayOfNumberOnly) ToMap() (map[string]interface{}, error) {
|
||||
func (o *ArrayOfArrayOfNumberOnly) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varArrayOfArrayOfNumberOnly := _ArrayOfArrayOfNumberOnly{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varArrayOfArrayOfNumberOnly); err == nil {
|
||||
*o = ArrayOfArrayOfNumberOnly(varArrayOfArrayOfNumberOnly)
|
||||
err = json.Unmarshal(bytes, &varArrayOfArrayOfNumberOnly)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*o = ArrayOfArrayOfNumberOnly(varArrayOfArrayOfNumberOnly)
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
|
@ -98,10 +98,14 @@ func (o ArrayOfNumberOnly) ToMap() (map[string]interface{}, error) {
|
||||
func (o *ArrayOfNumberOnly) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varArrayOfNumberOnly := _ArrayOfNumberOnly{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varArrayOfNumberOnly); err == nil {
|
||||
*o = ArrayOfNumberOnly(varArrayOfNumberOnly)
|
||||
err = json.Unmarshal(bytes, &varArrayOfNumberOnly)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*o = ArrayOfNumberOnly(varArrayOfNumberOnly)
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
|
@ -170,10 +170,14 @@ func (o ArrayTest) ToMap() (map[string]interface{}, error) {
|
||||
func (o *ArrayTest) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varArrayTest := _ArrayTest{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varArrayTest); err == nil {
|
||||
*o = ArrayTest(varArrayTest)
|
||||
err = json.Unmarshal(bytes, &varArrayTest)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*o = ArrayTest(varArrayTest)
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
|
@ -98,10 +98,14 @@ func (o Banana) ToMap() (map[string]interface{}, error) {
|
||||
func (o *Banana) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varBanana := _Banana{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varBanana); err == nil {
|
||||
*o = Banana(varBanana)
|
||||
err = json.Unmarshal(bytes, &varBanana)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*o = Banana(varBanana)
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
|
@ -125,10 +125,14 @@ func (o BananaReq) ToMap() (map[string]interface{}, error) {
|
||||
func (o *BananaReq) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varBananaReq := _BananaReq{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varBananaReq); err == nil {
|
||||
*o = BananaReq(varBananaReq)
|
||||
err = json.Unmarshal(bytes, &varBananaReq)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*o = BananaReq(varBananaReq)
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
|
@ -279,10 +279,14 @@ func (o Capitalization) ToMap() (map[string]interface{}, error) {
|
||||
func (o *Capitalization) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varCapitalization := _Capitalization{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varCapitalization); err == nil {
|
||||
*o = Capitalization(varCapitalization)
|
||||
err = json.Unmarshal(bytes, &varCapitalization)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*o = Capitalization(varCapitalization)
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
|
@ -127,10 +127,14 @@ func (o Category) ToMap() (map[string]interface{}, error) {
|
||||
func (o *Category) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varCategory := _Category{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varCategory); err == nil {
|
||||
*o = Category(varCategory)
|
||||
err = json.Unmarshal(bytes, &varCategory)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*o = Category(varCategory)
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
|
@ -98,10 +98,14 @@ func (o ClassModel) ToMap() (map[string]interface{}, error) {
|
||||
func (o *ClassModel) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varClassModel := _ClassModel{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varClassModel); err == nil {
|
||||
*o = ClassModel(varClassModel)
|
||||
err = json.Unmarshal(bytes, &varClassModel)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*o = ClassModel(varClassModel)
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
|
@ -98,10 +98,14 @@ func (o Client) ToMap() (map[string]interface{}, error) {
|
||||
func (o *Client) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varClient := _Client{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varClient); err == nil {
|
||||
*o = Client(varClient)
|
||||
err = json.Unmarshal(bytes, &varClient)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*o = Client(varClient)
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
|
@ -90,10 +90,14 @@ func (o DuplicatedPropParent) ToMap() (map[string]interface{}, error) {
|
||||
func (o *DuplicatedPropParent) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varDuplicatedPropParent := _DuplicatedPropParent{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varDuplicatedPropParent); err == nil {
|
||||
*o = DuplicatedPropParent(varDuplicatedPropParent)
|
||||
err = json.Unmarshal(bytes, &varDuplicatedPropParent)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*o = DuplicatedPropParent(varDuplicatedPropParent)
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
|
@ -134,10 +134,14 @@ func (o EnumArrays) ToMap() (map[string]interface{}, error) {
|
||||
func (o *EnumArrays) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varEnumArrays := _EnumArrays{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varEnumArrays); err == nil {
|
||||
*o = EnumArrays(varEnumArrays)
|
||||
err = json.Unmarshal(bytes, &varEnumArrays)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*o = EnumArrays(varEnumArrays)
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
|
@ -359,10 +359,14 @@ func (o EnumTest) ToMap() (map[string]interface{}, error) {
|
||||
func (o *EnumTest) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varEnumTest := _EnumTest{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varEnumTest); err == nil {
|
||||
*o = EnumTest(varEnumTest)
|
||||
err = json.Unmarshal(bytes, &varEnumTest)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*o = EnumTest(varEnumTest)
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
|
@ -99,10 +99,14 @@ func (o File) ToMap() (map[string]interface{}, error) {
|
||||
func (o *File) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varFile := _File{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varFile); err == nil {
|
||||
*o = File(varFile)
|
||||
err = json.Unmarshal(bytes, &varFile)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*o = File(varFile)
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
|
@ -134,10 +134,14 @@ func (o FileSchemaTestClass) ToMap() (map[string]interface{}, error) {
|
||||
func (o *FileSchemaTestClass) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varFileSchemaTestClass := _FileSchemaTestClass{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varFileSchemaTestClass); err == nil {
|
||||
*o = FileSchemaTestClass(varFileSchemaTestClass)
|
||||
err = json.Unmarshal(bytes, &varFileSchemaTestClass)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*o = FileSchemaTestClass(varFileSchemaTestClass)
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
|
@ -102,10 +102,14 @@ func (o Foo) ToMap() (map[string]interface{}, error) {
|
||||
func (o *Foo) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varFoo := _Foo{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varFoo); err == nil {
|
||||
*o = Foo(varFoo)
|
||||
err = json.Unmarshal(bytes, &varFoo)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*o = Foo(varFoo)
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
|
@ -570,10 +570,14 @@ func (o FormatTest) ToMap() (map[string]interface{}, error) {
|
||||
func (o *FormatTest) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varFormatTest := _FormatTest{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varFormatTest); err == nil {
|
||||
*o = FormatTest(varFormatTest)
|
||||
err = json.Unmarshal(bytes, &varFormatTest)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*o = FormatTest(varFormatTest)
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
|
@ -134,10 +134,14 @@ func (o HasOnlyReadOnly) ToMap() (map[string]interface{}, error) {
|
||||
func (o *HasOnlyReadOnly) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varHasOnlyReadOnly := _HasOnlyReadOnly{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varHasOnlyReadOnly); err == nil {
|
||||
*o = HasOnlyReadOnly(varHasOnlyReadOnly)
|
||||
err = json.Unmarshal(bytes, &varHasOnlyReadOnly)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*o = HasOnlyReadOnly(varHasOnlyReadOnly)
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
|
@ -108,10 +108,14 @@ func (o HealthCheckResult) ToMap() (map[string]interface{}, error) {
|
||||
func (o *HealthCheckResult) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varHealthCheckResult := _HealthCheckResult{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varHealthCheckResult); err == nil {
|
||||
*o = HealthCheckResult(varHealthCheckResult)
|
||||
err = json.Unmarshal(bytes, &varHealthCheckResult)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*o = HealthCheckResult(varHealthCheckResult)
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
|
@ -98,10 +98,14 @@ func (o List) ToMap() (map[string]interface{}, error) {
|
||||
func (o *List) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varList := _List{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varList); err == nil {
|
||||
*o = List(varList)
|
||||
err = json.Unmarshal(bytes, &varList)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*o = List(varList)
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
|
@ -100,10 +100,14 @@ func (o MapOfFileTest) ToMap() (map[string]interface{}, error) {
|
||||
func (o *MapOfFileTest) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varMapOfFileTest := _MapOfFileTest{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varMapOfFileTest); err == nil {
|
||||
*o = MapOfFileTest(varMapOfFileTest)
|
||||
err = json.Unmarshal(bytes, &varMapOfFileTest)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*o = MapOfFileTest(varMapOfFileTest)
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
|
@ -206,10 +206,14 @@ func (o MapTest) ToMap() (map[string]interface{}, error) {
|
||||
func (o *MapTest) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varMapTest := _MapTest{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varMapTest); err == nil {
|
||||
*o = MapTest(varMapTest)
|
||||
err = json.Unmarshal(bytes, &varMapTest)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*o = MapTest(varMapTest)
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
|
@ -171,10 +171,14 @@ func (o MixedPropertiesAndAdditionalPropertiesClass) ToMap() (map[string]interfa
|
||||
func (o *MixedPropertiesAndAdditionalPropertiesClass) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varMixedPropertiesAndAdditionalPropertiesClass := _MixedPropertiesAndAdditionalPropertiesClass{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varMixedPropertiesAndAdditionalPropertiesClass); err == nil {
|
||||
*o = MixedPropertiesAndAdditionalPropertiesClass(varMixedPropertiesAndAdditionalPropertiesClass)
|
||||
err = json.Unmarshal(bytes, &varMixedPropertiesAndAdditionalPropertiesClass)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*o = MixedPropertiesAndAdditionalPropertiesClass(varMixedPropertiesAndAdditionalPropertiesClass)
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
|
@ -197,10 +197,14 @@ func (o Name) ToMap() (map[string]interface{}, error) {
|
||||
func (o *Name) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varName := _Name{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varName); err == nil {
|
||||
*o = Name(varName)
|
||||
err = json.Unmarshal(bytes, &varName)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*o = Name(varName)
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
|
@ -108,10 +108,14 @@ func (o NullableAllOf) ToMap() (map[string]interface{}, error) {
|
||||
func (o *NullableAllOf) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varNullableAllOf := _NullableAllOf{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varNullableAllOf); err == nil {
|
||||
*o = NullableAllOf(varNullableAllOf)
|
||||
err = json.Unmarshal(bytes, &varNullableAllOf)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*o = NullableAllOf(varNullableAllOf)
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
|
@ -98,10 +98,14 @@ func (o NullableAllOfChild) ToMap() (map[string]interface{}, error) {
|
||||
func (o *NullableAllOfChild) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varNullableAllOfChild := _NullableAllOfChild{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varNullableAllOfChild); err == nil {
|
||||
*o = NullableAllOfChild(varNullableAllOfChild)
|
||||
err = json.Unmarshal(bytes, &varNullableAllOfChild)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*o = NullableAllOfChild(varNullableAllOfChild)
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
|
@ -563,10 +563,14 @@ func (o NullableClass) ToMap() (map[string]interface{}, error) {
|
||||
func (o *NullableClass) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varNullableClass := _NullableClass{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varNullableClass); err == nil {
|
||||
*o = NullableClass(varNullableClass)
|
||||
err = json.Unmarshal(bytes, &varNullableClass)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*o = NullableClass(varNullableClass)
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
|
@ -98,10 +98,14 @@ func (o NumberOnly) ToMap() (map[string]interface{}, error) {
|
||||
func (o *NumberOnly) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varNumberOnly := _NumberOnly{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varNumberOnly); err == nil {
|
||||
*o = NumberOnly(varNumberOnly)
|
||||
err = json.Unmarshal(bytes, &varNumberOnly)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*o = NumberOnly(varNumberOnly)
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
|
@ -98,10 +98,14 @@ func (o OneOfPrimitiveTypeChild) ToMap() (map[string]interface{}, error) {
|
||||
func (o *OneOfPrimitiveTypeChild) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varOneOfPrimitiveTypeChild := _OneOfPrimitiveTypeChild{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varOneOfPrimitiveTypeChild); err == nil {
|
||||
*o = OneOfPrimitiveTypeChild(varOneOfPrimitiveTypeChild)
|
||||
err = json.Unmarshal(bytes, &varOneOfPrimitiveTypeChild)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*o = OneOfPrimitiveTypeChild(varOneOfPrimitiveTypeChild)
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
|
@ -284,10 +284,14 @@ func (o Order) ToMap() (map[string]interface{}, error) {
|
||||
func (o *Order) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varOrder := _Order{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varOrder); err == nil {
|
||||
*o = Order(varOrder)
|
||||
err = json.Unmarshal(bytes, &varOrder)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*o = Order(varOrder)
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
|
@ -170,10 +170,14 @@ func (o OuterComposite) ToMap() (map[string]interface{}, error) {
|
||||
func (o *OuterComposite) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varOuterComposite := _OuterComposite{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varOuterComposite); err == nil {
|
||||
*o = OuterComposite(varOuterComposite)
|
||||
err = json.Unmarshal(bytes, &varOuterComposite)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*o = OuterComposite(varOuterComposite)
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
|
@ -265,10 +265,14 @@ func (o Pet) ToMap() (map[string]interface{}, error) {
|
||||
func (o *Pet) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varPet := _Pet{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varPet); err == nil {
|
||||
*o = Pet(varPet)
|
||||
err = json.Unmarshal(bytes, &varPet)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*o = Pet(varPet)
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
|
@ -206,10 +206,14 @@ func (o PropertyNameMapping) ToMap() (map[string]interface{}, error) {
|
||||
func (o *PropertyNameMapping) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varPropertyNameMapping := _PropertyNameMapping{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varPropertyNameMapping); err == nil {
|
||||
*o = PropertyNameMapping(varPropertyNameMapping)
|
||||
err = json.Unmarshal(bytes, &varPropertyNameMapping)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*o = PropertyNameMapping(varPropertyNameMapping)
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
|
@ -134,10 +134,14 @@ func (o ReadOnlyFirst) ToMap() (map[string]interface{}, error) {
|
||||
func (o *ReadOnlyFirst) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varReadOnlyFirst := _ReadOnlyFirst{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varReadOnlyFirst); err == nil {
|
||||
*o = ReadOnlyFirst(varReadOnlyFirst)
|
||||
err = json.Unmarshal(bytes, &varReadOnlyFirst)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*o = ReadOnlyFirst(varReadOnlyFirst)
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
|
@ -326,10 +326,14 @@ func (o ReadOnlyWithDefault) ToMap() (map[string]interface{}, error) {
|
||||
func (o *ReadOnlyWithDefault) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varReadOnlyWithDefault := _ReadOnlyWithDefault{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varReadOnlyWithDefault); err == nil {
|
||||
*o = ReadOnlyWithDefault(varReadOnlyWithDefault)
|
||||
err = json.Unmarshal(bytes, &varReadOnlyWithDefault)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*o = ReadOnlyWithDefault(varReadOnlyWithDefault)
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
|
@ -98,10 +98,14 @@ func (o Return) ToMap() (map[string]interface{}, error) {
|
||||
func (o *Return) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varReturn := _Return{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varReturn); err == nil {
|
||||
*o = Return(varReturn)
|
||||
err = json.Unmarshal(bytes, &varReturn)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*o = Return(varReturn)
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
|
@ -134,10 +134,14 @@ func (o Tag) ToMap() (map[string]interface{}, error) {
|
||||
func (o *Tag) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varTag := _Tag{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varTag); err == nil {
|
||||
*o = Tag(varTag)
|
||||
err = json.Unmarshal(bytes, &varTag)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*o = Tag(varTag)
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
|
@ -502,10 +502,14 @@ func (o User) ToMap() (map[string]interface{}, error) {
|
||||
func (o *User) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varUser := _User{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varUser); err == nil {
|
||||
*o = User(varUser)
|
||||
err = json.Unmarshal(bytes, &varUser)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*o = User(varUser)
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
|
@ -161,10 +161,14 @@ func (o Whale) ToMap() (map[string]interface{}, error) {
|
||||
func (o *Whale) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varWhale := _Whale{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varWhale); err == nil {
|
||||
*o = Whale(varWhale)
|
||||
err = json.Unmarshal(bytes, &varWhale)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*o = Whale(varWhale)
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
|
@ -125,10 +125,14 @@ func (o Zebra) ToMap() (map[string]interface{}, error) {
|
||||
func (o *Zebra) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varZebra := _Zebra{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varZebra); err == nil {
|
||||
*o = Zebra(varZebra)
|
||||
err = json.Unmarshal(bytes, &varZebra)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*o = Zebra(varZebra)
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
|
@ -24,7 +24,7 @@ func TestPlaceOrder(t *testing.T) {
|
||||
// Skip parsing time error due to error in Petstore Test Server
|
||||
// https://github.com/OpenAPITools/openapi-generator/issues/1292
|
||||
if regexp.
|
||||
MustCompile(`^parsing time.+cannot parse "\+0000"" as "Z07:00"$`).
|
||||
MustCompile(`as "Z07:00"$`).
|
||||
MatchString(err.Error()) {
|
||||
t.Log("Skipping error for parsing time with `+0000` UTC offset as Petstore Test Server does not return valid RFC 3339 datetime")
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user