Skip to content

Commit 5fd479b

Browse files
author
alex.chen
committed
fix the polymorphic issue
1 parent 9409f83 commit 5fd479b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

modules/swagger-codegen/src/main/resources/python/api_client.mustache

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,9 @@ class ApiClient(object):
597597
)
598598
)
599599

600+
def __hasattr(self, object, name):
601+
return name in object.__dict__
602+
600603
def __deserialize_model(self, data, klass):
601604
"""Deserializes list or dict to model.
602605

@@ -605,7 +608,7 @@ class ApiClient(object):
605608
:return: model object.
606609
"""
607610

608-
if not klass.swagger_types and not hasattr(klass,
611+
if not klass.swagger_types and not self.__hasattr(klass,
609612
'get_real_child_model'):
610613
return data
611614

@@ -626,7 +629,7 @@ class ApiClient(object):
626629
for key, value in data.items():
627630
if key not in klass.swagger_types:
628631
instance[key] = value
629-
if hasattr(instance, 'get_real_child_model'):
632+
if self.__hasattr(instance, 'get_real_child_model'):
630633
klass_name = instance.get_real_child_model(data)
631634
if klass_name:
632635
instance = self.__deserialize(data, klass_name)

0 commit comments

Comments
 (0)