[http-client-python] Fix deserialization subtype (#4716)
Related SDK diff: https://github.com/Azure/autorest.python/pull/2430/files
This commit is contained in:
Родитель
4e63496411
Коммит
34624a02b4
|
@ -1,5 +1,11 @@
|
|||
# Change Log - @typespec/http-client-python
|
||||
|
||||
## 0.3.1
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- Avoid change original data when deserialize for polymorphic model
|
||||
|
||||
## 0.3.0
|
||||
|
||||
### Bump dependencies
|
||||
|
|
|
@ -506,7 +506,6 @@ class Model(object):
|
|||
def _classify(cls, response, objects):
|
||||
"""Check the class _subtype_map for any child classes.
|
||||
We want to ignore any inherited _subtype_maps.
|
||||
Remove the polymorphic key from the initial data.
|
||||
|
||||
:param dict response: The initial data
|
||||
:param dict objects: The class objects
|
||||
|
@ -518,7 +517,7 @@ class Model(object):
|
|||
|
||||
if not isinstance(response, ET.Element):
|
||||
rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1]
|
||||
subtype_value = response.pop(rest_api_response_key, None) or response.pop(subtype_key, None)
|
||||
subtype_value = response.get(rest_api_response_key, None) or response.get(subtype_key, None)
|
||||
else:
|
||||
subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response)
|
||||
if subtype_value:
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "@typespec/http-client-python",
|
||||
"version": "0.3.0",
|
||||
"version": "0.3.1",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@typespec/http-client-python",
|
||||
"version": "0.3.0",
|
||||
"version": "0.3.1",
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@typespec/http-client-python",
|
||||
"version": "0.3.0",
|
||||
"version": "0.3.1",
|
||||
"author": "Microsoft Corporation",
|
||||
"description": "TypeSpec emitter for Python SDKs",
|
||||
"homepage": "https://typespec.io",
|
||||
|
|
Загрузка…
Ссылка в новой задаче