forked from loafle/openapi-generator-original
[Default] update isAdditionalPropertiesTrue tag to cover more types (#16227)
* enhance additional properties support * update samples * update tests * add more tests * update samples * fix samples
This commit is contained in:
@@ -20,8 +20,11 @@ var _ MappedNullable = &AdditionalPropertiesAnyType{}
|
||||
// AdditionalPropertiesAnyType struct for AdditionalPropertiesAnyType
|
||||
type AdditionalPropertiesAnyType struct {
|
||||
Name *string `json:"name,omitempty"`
|
||||
AdditionalProperties map[string]interface{}
|
||||
}
|
||||
|
||||
type _AdditionalPropertiesAnyType AdditionalPropertiesAnyType
|
||||
|
||||
// NewAdditionalPropertiesAnyType instantiates a new AdditionalPropertiesAnyType object
|
||||
// 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
|
||||
@@ -84,9 +87,31 @@ func (o AdditionalPropertiesAnyType) ToMap() (map[string]interface{}, error) {
|
||||
if !IsNil(o.Name) {
|
||||
toSerialize["name"] = o.Name
|
||||
}
|
||||
|
||||
for key, value := range o.AdditionalProperties {
|
||||
toSerialize[key] = value
|
||||
}
|
||||
|
||||
return toSerialize, nil
|
||||
}
|
||||
|
||||
func (o *AdditionalPropertiesAnyType) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varAdditionalPropertiesAnyType := _AdditionalPropertiesAnyType{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varAdditionalPropertiesAnyType); err == nil {
|
||||
*o = AdditionalPropertiesAnyType(varAdditionalPropertiesAnyType)
|
||||
}
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
delete(additionalProperties, "name")
|
||||
o.AdditionalProperties = additionalProperties
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
type NullableAdditionalPropertiesAnyType struct {
|
||||
value *AdditionalPropertiesAnyType
|
||||
isSet bool
|
||||
|
||||
@@ -20,8 +20,11 @@ var _ MappedNullable = &AdditionalPropertiesArray{}
|
||||
// AdditionalPropertiesArray struct for AdditionalPropertiesArray
|
||||
type AdditionalPropertiesArray struct {
|
||||
Name *string `json:"name,omitempty"`
|
||||
AdditionalProperties map[string]interface{}
|
||||
}
|
||||
|
||||
type _AdditionalPropertiesArray AdditionalPropertiesArray
|
||||
|
||||
// NewAdditionalPropertiesArray instantiates a new AdditionalPropertiesArray object
|
||||
// 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
|
||||
@@ -84,9 +87,31 @@ func (o AdditionalPropertiesArray) ToMap() (map[string]interface{}, error) {
|
||||
if !IsNil(o.Name) {
|
||||
toSerialize["name"] = o.Name
|
||||
}
|
||||
|
||||
for key, value := range o.AdditionalProperties {
|
||||
toSerialize[key] = value
|
||||
}
|
||||
|
||||
return toSerialize, nil
|
||||
}
|
||||
|
||||
func (o *AdditionalPropertiesArray) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varAdditionalPropertiesArray := _AdditionalPropertiesArray{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varAdditionalPropertiesArray); err == nil {
|
||||
*o = AdditionalPropertiesArray(varAdditionalPropertiesArray)
|
||||
}
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
delete(additionalProperties, "name")
|
||||
o.AdditionalProperties = additionalProperties
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
type NullableAdditionalPropertiesArray struct {
|
||||
value *AdditionalPropertiesArray
|
||||
isSet bool
|
||||
|
||||
@@ -20,8 +20,11 @@ var _ MappedNullable = &AdditionalPropertiesBoolean{}
|
||||
// AdditionalPropertiesBoolean struct for AdditionalPropertiesBoolean
|
||||
type AdditionalPropertiesBoolean struct {
|
||||
Name *string `json:"name,omitempty"`
|
||||
AdditionalProperties map[string]interface{}
|
||||
}
|
||||
|
||||
type _AdditionalPropertiesBoolean AdditionalPropertiesBoolean
|
||||
|
||||
// NewAdditionalPropertiesBoolean instantiates a new AdditionalPropertiesBoolean object
|
||||
// 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
|
||||
@@ -84,9 +87,31 @@ func (o AdditionalPropertiesBoolean) ToMap() (map[string]interface{}, error) {
|
||||
if !IsNil(o.Name) {
|
||||
toSerialize["name"] = o.Name
|
||||
}
|
||||
|
||||
for key, value := range o.AdditionalProperties {
|
||||
toSerialize[key] = value
|
||||
}
|
||||
|
||||
return toSerialize, nil
|
||||
}
|
||||
|
||||
func (o *AdditionalPropertiesBoolean) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varAdditionalPropertiesBoolean := _AdditionalPropertiesBoolean{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varAdditionalPropertiesBoolean); err == nil {
|
||||
*o = AdditionalPropertiesBoolean(varAdditionalPropertiesBoolean)
|
||||
}
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
delete(additionalProperties, "name")
|
||||
o.AdditionalProperties = additionalProperties
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
type NullableAdditionalPropertiesBoolean struct {
|
||||
value *AdditionalPropertiesBoolean
|
||||
isSet bool
|
||||
|
||||
@@ -20,8 +20,11 @@ var _ MappedNullable = &AdditionalPropertiesInteger{}
|
||||
// AdditionalPropertiesInteger struct for AdditionalPropertiesInteger
|
||||
type AdditionalPropertiesInteger struct {
|
||||
Name *string `json:"name,omitempty"`
|
||||
AdditionalProperties map[string]interface{}
|
||||
}
|
||||
|
||||
type _AdditionalPropertiesInteger AdditionalPropertiesInteger
|
||||
|
||||
// NewAdditionalPropertiesInteger instantiates a new AdditionalPropertiesInteger object
|
||||
// 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
|
||||
@@ -84,9 +87,31 @@ func (o AdditionalPropertiesInteger) ToMap() (map[string]interface{}, error) {
|
||||
if !IsNil(o.Name) {
|
||||
toSerialize["name"] = o.Name
|
||||
}
|
||||
|
||||
for key, value := range o.AdditionalProperties {
|
||||
toSerialize[key] = value
|
||||
}
|
||||
|
||||
return toSerialize, nil
|
||||
}
|
||||
|
||||
func (o *AdditionalPropertiesInteger) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varAdditionalPropertiesInteger := _AdditionalPropertiesInteger{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varAdditionalPropertiesInteger); err == nil {
|
||||
*o = AdditionalPropertiesInteger(varAdditionalPropertiesInteger)
|
||||
}
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
delete(additionalProperties, "name")
|
||||
o.AdditionalProperties = additionalProperties
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
type NullableAdditionalPropertiesInteger struct {
|
||||
value *AdditionalPropertiesInteger
|
||||
isSet bool
|
||||
|
||||
@@ -20,8 +20,11 @@ var _ MappedNullable = &AdditionalPropertiesNumber{}
|
||||
// AdditionalPropertiesNumber struct for AdditionalPropertiesNumber
|
||||
type AdditionalPropertiesNumber struct {
|
||||
Name *string `json:"name,omitempty"`
|
||||
AdditionalProperties map[string]interface{}
|
||||
}
|
||||
|
||||
type _AdditionalPropertiesNumber AdditionalPropertiesNumber
|
||||
|
||||
// NewAdditionalPropertiesNumber instantiates a new AdditionalPropertiesNumber object
|
||||
// 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
|
||||
@@ -84,9 +87,31 @@ func (o AdditionalPropertiesNumber) ToMap() (map[string]interface{}, error) {
|
||||
if !IsNil(o.Name) {
|
||||
toSerialize["name"] = o.Name
|
||||
}
|
||||
|
||||
for key, value := range o.AdditionalProperties {
|
||||
toSerialize[key] = value
|
||||
}
|
||||
|
||||
return toSerialize, nil
|
||||
}
|
||||
|
||||
func (o *AdditionalPropertiesNumber) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varAdditionalPropertiesNumber := _AdditionalPropertiesNumber{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varAdditionalPropertiesNumber); err == nil {
|
||||
*o = AdditionalPropertiesNumber(varAdditionalPropertiesNumber)
|
||||
}
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
delete(additionalProperties, "name")
|
||||
o.AdditionalProperties = additionalProperties
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
type NullableAdditionalPropertiesNumber struct {
|
||||
value *AdditionalPropertiesNumber
|
||||
isSet bool
|
||||
|
||||
@@ -20,8 +20,11 @@ var _ MappedNullable = &AdditionalPropertiesObject{}
|
||||
// AdditionalPropertiesObject struct for AdditionalPropertiesObject
|
||||
type AdditionalPropertiesObject struct {
|
||||
Name *string `json:"name,omitempty"`
|
||||
AdditionalProperties map[string]interface{}
|
||||
}
|
||||
|
||||
type _AdditionalPropertiesObject AdditionalPropertiesObject
|
||||
|
||||
// NewAdditionalPropertiesObject instantiates a new AdditionalPropertiesObject object
|
||||
// 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
|
||||
@@ -84,9 +87,31 @@ func (o AdditionalPropertiesObject) ToMap() (map[string]interface{}, error) {
|
||||
if !IsNil(o.Name) {
|
||||
toSerialize["name"] = o.Name
|
||||
}
|
||||
|
||||
for key, value := range o.AdditionalProperties {
|
||||
toSerialize[key] = value
|
||||
}
|
||||
|
||||
return toSerialize, nil
|
||||
}
|
||||
|
||||
func (o *AdditionalPropertiesObject) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varAdditionalPropertiesObject := _AdditionalPropertiesObject{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varAdditionalPropertiesObject); err == nil {
|
||||
*o = AdditionalPropertiesObject(varAdditionalPropertiesObject)
|
||||
}
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
delete(additionalProperties, "name")
|
||||
o.AdditionalProperties = additionalProperties
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
type NullableAdditionalPropertiesObject struct {
|
||||
value *AdditionalPropertiesObject
|
||||
isSet bool
|
||||
|
||||
@@ -20,8 +20,11 @@ var _ MappedNullable = &AdditionalPropertiesString{}
|
||||
// AdditionalPropertiesString struct for AdditionalPropertiesString
|
||||
type AdditionalPropertiesString struct {
|
||||
Name *string `json:"name,omitempty"`
|
||||
AdditionalProperties map[string]interface{}
|
||||
}
|
||||
|
||||
type _AdditionalPropertiesString AdditionalPropertiesString
|
||||
|
||||
// NewAdditionalPropertiesString instantiates a new AdditionalPropertiesString object
|
||||
// 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
|
||||
@@ -84,9 +87,31 @@ func (o AdditionalPropertiesString) ToMap() (map[string]interface{}, error) {
|
||||
if !IsNil(o.Name) {
|
||||
toSerialize["name"] = o.Name
|
||||
}
|
||||
|
||||
for key, value := range o.AdditionalProperties {
|
||||
toSerialize[key] = value
|
||||
}
|
||||
|
||||
return toSerialize, nil
|
||||
}
|
||||
|
||||
func (o *AdditionalPropertiesString) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varAdditionalPropertiesString := _AdditionalPropertiesString{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varAdditionalPropertiesString); err == nil {
|
||||
*o = AdditionalPropertiesString(varAdditionalPropertiesString)
|
||||
}
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
delete(additionalProperties, "name")
|
||||
o.AdditionalProperties = additionalProperties
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
type NullableAdditionalPropertiesString struct {
|
||||
value *AdditionalPropertiesString
|
||||
isSet bool
|
||||
|
||||
Reference in New Issue
Block a user