Skip to content

Commit

Permalink
[python] update sample
Browse files Browse the repository at this point in the history
  • Loading branch information
fa0311 committed Mar 15, 2024
1 parent f464abe commit 8a7fecb
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def to_dict(self):
_field_dict_of_array = {}
if self.shop_id_to_org_online_lip_map:
for _key in self.shop_id_to_org_online_lip_map:
if self.shop_id_to_org_online_lip_map[_key]:
if self.shop_id_to_org_online_lip_map[_key] is not None:
_field_dict_of_array[_key] = [
_item.to_dict() for _item in self.shop_id_to_org_online_lip_map[_key]
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def to_dict(self):
_field_dict_of_array = {}
if self.dict_property:
for _key in self.dict_property:
if self.dict_property[_key]:
if self.dict_property[_key] is not None:
_field_dict_of_array[_key] = [
_item.to_dict() for _item in self.dict_property[_key]
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,6 @@ def to_dict(self):
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:
for _key in self.dict_property:
if self.dict_property[_key]:
_field_dict_of_array[_key] = [
_item.to_dict() for _item in self.dict_property[_key]
]
_dict['dictProperty'] = _field_dict_of_array
return _dict

@classmethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def to_dict(self):
_field_dict_of_array = {}
if self.shop_id_to_org_online_lip_map:
for _key in self.shop_id_to_org_online_lip_map:
if self.shop_id_to_org_online_lip_map[_key]:
if self.shop_id_to_org_online_lip_map[_key] is not None:
_field_dict_of_array[_key] = [
_item.to_dict() for _item in self.shop_id_to_org_online_lip_map[_key]
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def to_dict(self):
_field_dict_of_array = {}
if self.dict_property:
for _key in self.dict_property:
if self.dict_property[_key]:
if self.dict_property[_key] is not None:
_field_dict_of_array[_key] = [
_item.to_dict() for _item in self.dict_property[_key]
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,6 @@ def to_dict(self):
"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:
for _key in self.dict_property:
if self.dict_property[_key]:
_field_dict_of_array[_key] = [
_item.to_dict() for _item in self.dict_property[_key]
]
_dict['dictProperty'] = _field_dict_of_array
# 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 8a7fecb

Please sign in to comment.