diff --git a/modules/swagger-codegen/src/main/resources/python/model.mustache b/modules/swagger-codegen/src/main/resources/python/model.mustache index 105eefec095..d7c3493d9da 100644 --- a/modules/swagger-codegen/src/main/resources/python/model.mustache +++ b/modules/swagger-codegen/src/main/resources/python/model.mustache @@ -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 diff --git a/samples/client/petstore/python/swagger_client/models/category.py b/samples/client/petstore/python/swagger_client/models/category.py index d5156eee4ff..59970e0bc3f 100644 --- a/samples/client/petstore/python/swagger_client/models/category.py +++ b/samples/client/petstore/python/swagger_client/models/category.py @@ -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: @@ -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 diff --git a/samples/client/petstore/python/swagger_client/models/order.py b/samples/client/petstore/python/swagger_client/models/order.py index 93126d98a86..488f01f05ba 100644 --- a/samples/client/petstore/python/swagger_client/models/order.py +++ b/samples/client/petstore/python/swagger_client/models/order.py @@ -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: @@ -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 diff --git a/samples/client/petstore/python/swagger_client/models/pet.py b/samples/client/petstore/python/swagger_client/models/pet.py index d7c425e3e0e..94ca2249c0a 100644 --- a/samples/client/petstore/python/swagger_client/models/pet.py +++ b/samples/client/petstore/python/swagger_client/models/pet.py @@ -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: @@ -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 diff --git a/samples/client/petstore/python/swagger_client/models/tag.py b/samples/client/petstore/python/swagger_client/models/tag.py index 81d27fa5e63..4deced8a351 100644 --- a/samples/client/petstore/python/swagger_client/models/tag.py +++ b/samples/client/petstore/python/swagger_client/models/tag.py @@ -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: @@ -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 diff --git a/samples/client/petstore/python/swagger_client/models/user.py b/samples/client/petstore/python/swagger_client/models/user.py index 6af36592c02..f8c1012842a 100644 --- a/samples/client/petstore/python/swagger_client/models/user.py +++ b/samples/client/petstore/python/swagger_client/models/user.py @@ -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: @@ -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