@@ -1101,13 +1101,18 @@ def rest_key_extractor(attr, attr_desc, data):
1101
1101
key = attr_desc ['key' ]
1102
1102
working_data = data
1103
1103
1104
- while '.' in key and working_data :
1104
+ while '.' in key :
1105
1105
dict_keys = _FLATTEN .split (key )
1106
1106
if len (dict_keys ) == 1 :
1107
1107
key = _decode_attribute_map_key (dict_keys [0 ])
1108
1108
break
1109
1109
working_key = _decode_attribute_map_key (dict_keys [0 ])
1110
1110
working_data = working_data .get (working_key , data )
1111
+ if working_data is None :
1112
+ # If at any point while following flatten JSON path see None, it means
1113
+ # that all properties under are None as well
1114
+ # https://github.com/Azure/msrest-for-python/issues/197
1115
+ return None
1111
1116
key = '.' .join (dict_keys [1 :])
1112
1117
1113
1118
return working_data .get (key )
@@ -1116,13 +1121,18 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, data):
1116
1121
key = attr_desc ['key' ]
1117
1122
working_data = data
1118
1123
1119
- while '.' in key and working_data :
1124
+ while '.' in key :
1120
1125
dict_keys = _FLATTEN .split (key )
1121
1126
if len (dict_keys ) == 1 :
1122
1127
key = _decode_attribute_map_key (dict_keys [0 ])
1123
1128
break
1124
1129
working_key = _decode_attribute_map_key (dict_keys [0 ])
1125
1130
working_data = attribute_key_case_insensitive_extractor (working_key , None , working_data )
1131
+ if working_data is None :
1132
+ # If at any point while following flatten JSON path see None, it means
1133
+ # that all properties under are None as well
1134
+ # https://github.com/Azure/msrest-for-python/issues/197
1135
+ return None
1126
1136
key = '.' .join (dict_keys [1 :])
1127
1137
1128
1138
if working_data :
0 commit comments