Skip to content

Commit 7c762b8

Browse files
iscai-msftiscai-msft
andauthored
[python] fix setting property on flattened property when flatten property is not called properties (#8867)
Co-authored-by: iscai-msft <isabellavcai@gmail.com>
1 parent bfba2a6 commit 7c762b8

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
changeKind: fix
3+
packages:
4+
- "@typespec/http-client-python"
5+
---
6+
7+
Fix setting attribute of flattened property when flattened property's name is not `properties`

packages/http-client-python/generator/pygen/codegen/templates/model_dpg.py.jinja2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
if key in self.__flattened_items:
7979
if self.{{ flattened_property_attr }} is None:
8080
self.{{ flattened_property_attr }} = self._attr_to_rest_field["{{ flattened_property_attr }}"]._class_type()
81-
setattr(self.properties, key, value)
81+
setattr(self.{{ flattened_property_attr }}, key, value)
8282
else:
8383
super().__setattr__(key, value)
8484
{% endif %}

0 commit comments

Comments
 (0)