Skip to content

Fixed model finding if model has dyn fields #138

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions tb_rest_client/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,10 +334,16 @@ def __deserialize(self, data, klass):
klass = found_class

except AttributeError:
found_class = getattr(tb_rest_client.models.models_ce, klass)
# if all(attr in list(found_class.attribute_map.values()) for attr in list(data.keys())):
# if sorted(list(found_class.attribute_map.values())) == sorted(list(data.keys())):
klass = found_class
try:
found_class = getattr(tb_rest_client.models.models_ce, klass)
# if all(attr in list(found_class.attribute_map.values()) for attr in list(data.keys())):
# if sorted(list(found_class.attribute_map.values())) == sorted(list(data.keys())):
klass = found_class
except AttributeError:
print('WARNING: received data fields not the same as in the {0} model (dyn fields problem)'.format(
klass))
found_class = getattr(tb_rest_client.models.models_pe, klass)
klass = found_class
# else:
# return self.__deserialize(data, type(data))
return self.__deserialize_data(data, klass)
Expand Down