forked from loafle/openapi-generator-original
Add additionalProperties handling in python code genrator by adding dictionary handling in model's to_dict() method
This commit is contained in:
@@ -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:
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user