Skip to content

Commit

Permalink
fix: Merge conflict from #16779 and #16777 (#16784)
Browse files Browse the repository at this point in the history
  • Loading branch information
robertschweizer authored Oct 11, 2023
1 parent 2b6b3b0 commit 384ff94
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,22 @@ def from_json(cls, json_str: str) -> Self:
"""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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,22 @@ def from_json(cls, json_str: str) -> Self:
"""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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,24 @@ def from_json(cls, json_str: str) -> Self:
"""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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,24 @@ def from_json(cls, json_str: str) -> Self:
"""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():
Expand Down

0 comments on commit 384ff94

Please sign in to comment.