fix: Merge conflict from #16779 and #16777 (#16784)

This commit is contained in:
Robert Schweizer 2023-10-11 09:14:01 +02:00 committed by GitHub
parent 2b6b3b0883
commit 384ff941ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 68 additions and 26 deletions

View File

@ -55,12 +55,22 @@ class UnnamedDictWithAdditionalModelListProperties(BaseModel):
"""Create an instance of UnnamedDictWithAdditionalModelListProperties from a JSON string"""
return cls.from_dict(json.loads(json_str))
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.model_dump(by_alias=True,
exclude={
},
exclude_none=True)
def to_dict(self) -> Dict[str, Any]:
"""Return the dictionary representation of the model using alias.
This has the following differences from calling pydantic's
`self.model_dump(by_alias=True)`:
* `None` is only added to the output dict for nullable fields that
were set at model initialization. Other fields with value `None`
are ignored.
"""
_dict = self.model_dump(
by_alias=True,
exclude={
},
exclude_none=True,
)
# override the default output from pydantic by calling `to_dict()` of each value in dict_property (dict of array)
_field_dict_of_array = {}
if self.dict_property:

View File

@ -54,12 +54,22 @@ class UnnamedDictWithAdditionalStringListProperties(BaseModel):
"""Create an instance of UnnamedDictWithAdditionalStringListProperties from a JSON string"""
return cls.from_dict(json.loads(json_str))
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.model_dump(by_alias=True,
exclude={
},
exclude_none=True)
def to_dict(self) -> Dict[str, Any]:
"""Return the dictionary representation of the model using alias.
This has the following differences from calling pydantic's
`self.model_dump(by_alias=True)`:
* `None` is only added to the output dict for nullable fields that
were set at model initialization. Other fields with value `None`
are ignored.
"""
_dict = self.model_dump(
by_alias=True,
exclude={
},
exclude_none=True,
)
return _dict
@classmethod

View File

@ -56,13 +56,24 @@ class UnnamedDictWithAdditionalModelListProperties(BaseModel):
"""Create an instance of UnnamedDictWithAdditionalModelListProperties from a JSON string"""
return cls.from_dict(json.loads(json_str))
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.model_dump(by_alias=True,
exclude={
"additional_properties"
},
exclude_none=True)
def to_dict(self) -> Dict[str, Any]:
"""Return the dictionary representation of the model using alias.
This has the following differences from calling pydantic's
`self.model_dump(by_alias=True)`:
* `None` is only added to the output dict for nullable fields that
were set at model initialization. Other fields with value `None`
are ignored.
* Fields in `self.additional_properties` are added to the output dict.
"""
_dict = self.model_dump(
by_alias=True,
exclude={
"additional_properties",
},
exclude_none=True,
)
# override the default output from pydantic by calling `to_dict()` of each value in dict_property (dict of array)
_field_dict_of_array = {}
if self.dict_property:

View File

@ -55,13 +55,24 @@ class UnnamedDictWithAdditionalStringListProperties(BaseModel):
"""Create an instance of UnnamedDictWithAdditionalStringListProperties from a JSON string"""
return cls.from_dict(json.loads(json_str))
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.model_dump(by_alias=True,
exclude={
"additional_properties"
},
exclude_none=True)
def to_dict(self) -> Dict[str, Any]:
"""Return the dictionary representation of the model using alias.
This has the following differences from calling pydantic's
`self.model_dump(by_alias=True)`:
* `None` is only added to the output dict for nullable fields that
were set at model initialization. Other fields with value `None`
are ignored.
* Fields in `self.additional_properties` are added to the output dict.
"""
_dict = self.model_dump(
by_alias=True,
exclude={
"additional_properties",
},
exclude_none=True,
)
# puts key-value pairs in additional_properties in the top level
if self.additional_properties is not None:
for _key, _value in self.additional_properties.items():