Skip to content
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

Add model's "additionalProperties" handling in python client #2058

Merged
merged 3 commits into from
Feb 7, 2016
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ class {{classname}}(object):
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
))
elif isinstance(value, dict):
result[attr] = dict(map(
lambda k, v: (k, v.to_dict()) if hasattr(v, "to_dict") else (k, v),
value.iteritems()
))
elif hasattr(value, "to_dict"):
result[attr] = value.to_dict()
else:
Expand All @@ -114,14 +119,14 @@ class {{classname}}(object):
"""
return self.to_str()

def __eq__(self, other):
def __eq__(self, other):
"""
Returns true if both objects are equal
"""
return self.__dict__ == other.__dict__

def __ne__(self, other):
"""
"""
Returns true if both objects are not equal
"""
return not self == other
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ def to_dict(self):
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
))
elif isinstance(value, dict):
result[attr] = dict(map(
lambda k, v: (k, v.to_dict()) if hasattr(v, "to_dict") else (k, v),
value.iteritems()
))
elif hasattr(value, "to_dict"):
result[attr] = value.to_dict()
else:
Expand All @@ -125,14 +130,14 @@ def __repr__(self):
"""
return self.to_str()

def __eq__(self, other):
def __eq__(self, other):
"""
Returns true if both objects are equal
"""
return self.__dict__ == other.__dict__

def __ne__(self, other):
"""
"""
Returns true if both objects are not equal
"""
return not self == other
Expand Down
9 changes: 7 additions & 2 deletions samples/client/petstore/python/swagger_client/models/order.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,11 @@ def to_dict(self):
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
))
elif isinstance(value, dict):
result[attr] = dict(map(
lambda k, v: (k, v.to_dict()) if hasattr(v, "to_dict") else (k, v),
value.iteritems()
))
elif hasattr(value, "to_dict"):
result[attr] = value.to_dict()
else:
Expand All @@ -231,14 +236,14 @@ def __repr__(self):
"""
return self.to_str()

def __eq__(self, other):
def __eq__(self, other):
"""
Returns true if both objects are equal
"""
return self.__dict__ == other.__dict__

def __ne__(self, other):
"""
"""
Returns true if both objects are not equal
"""
return not self == other
Expand Down
9 changes: 7 additions & 2 deletions samples/client/petstore/python/swagger_client/models/pet.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,11 @@ def to_dict(self):
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
))
elif isinstance(value, dict):
result[attr] = dict(map(
lambda k, v: (k, v.to_dict()) if hasattr(v, "to_dict") else (k, v),
value.iteritems()
))
elif hasattr(value, "to_dict"):
result[attr] = value.to_dict()
else:
Expand All @@ -231,14 +236,14 @@ def __repr__(self):
"""
return self.to_str()

def __eq__(self, other):
def __eq__(self, other):
"""
Returns true if both objects are equal
"""
return self.__dict__ == other.__dict__

def __ne__(self, other):
"""
"""
Returns true if both objects are not equal
"""
return not self == other
Expand Down
9 changes: 7 additions & 2 deletions samples/client/petstore/python/swagger_client/models/tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ def to_dict(self):
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
))
elif isinstance(value, dict):
result[attr] = dict(map(
lambda k, v: (k, v.to_dict()) if hasattr(v, "to_dict") else (k, v),
value.iteritems()
))
elif hasattr(value, "to_dict"):
result[attr] = value.to_dict()
else:
Expand All @@ -125,14 +130,14 @@ def __repr__(self):
"""
return self.to_str()

def __eq__(self, other):
def __eq__(self, other):
"""
Returns true if both objects are equal
"""
return self.__dict__ == other.__dict__

def __ne__(self, other):
"""
"""
Returns true if both objects are not equal
"""
return not self == other
Expand Down
9 changes: 7 additions & 2 deletions samples/client/petstore/python/swagger_client/models/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,11 @@ def to_dict(self):
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
))
elif isinstance(value, dict):
result[attr] = dict(map(
lambda k, v: (k, v.to_dict()) if hasattr(v, "to_dict") else (k, v),
value.iteritems()
))
elif hasattr(value, "to_dict"):
result[attr] = value.to_dict()
else:
Expand All @@ -275,14 +280,14 @@ def __repr__(self):
"""
return self.to_str()

def __eq__(self, other):
def __eq__(self, other):
"""
Returns true if both objects are equal
"""
return self.__dict__ == other.__dict__

def __ne__(self, other):
"""
"""
Returns true if both objects are not equal
"""
return not self == other
Expand Down