Skip to content

Commit 010d399

Browse files
committed
Fix serialisation from dict with escape
1 parent 6f32061 commit 010d399

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

msrest/serialization.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,11 @@ def _classify(cls, response, objects):
129129
Remove the polymorphic key from the initial data.
130130
"""
131131
for subtype_key in cls.__dict__.get('_subtype_map', {}).keys():
132-
response_key = _decode_attribute_map_key(cls._attribute_map[subtype_key]['key'])
133-
if response_key in response:
134-
subtype_value = response.pop(response_key)
132+
subtype_value = None
133+
134+
rest_api_response_key = _decode_attribute_map_key(cls._attribute_map[subtype_key]['key'])
135+
subtype_value = response.pop(rest_api_response_key, None) or response.pop(subtype_key, None)
136+
if subtype_value:
135137
flatten_mapping_type = cls._flatten_subtype(subtype_key, objects)
136138
return objects[flatten_mapping_type[subtype_value]]
137139
return cls

0 commit comments

Comments
 (0)