From 10aa68c6b7243800b8419aeb24a9e86debb07a55 Mon Sep 17 00:00:00 2001 From: Zoltan Biro Date: Mon, 29 Aug 2016 16:08:45 +0200 Subject: [PATCH 1/3] Fix empty model object serialization in python client --- .../src/main/resources/python/api_client.mustache | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/swagger-codegen/src/main/resources/python/api_client.mustache b/modules/swagger-codegen/src/main/resources/python/api_client.mustache index e75c6be52ed..2ea9b2299cc 100644 --- a/modules/swagger-codegen/src/main/resources/python/api_client.mustache +++ b/modules/swagger-codegen/src/main/resources/python/api_client.mustache @@ -581,6 +581,9 @@ class ApiClient(object): """ instance = klass() + if(not instance.swagger_types): + return data + for attr, attr_type in iteritems(instance.swagger_types): if data is not None \ and instance.attribute_map[attr] in data\ From b050ba9dc3536f173a7b93d91a309603f4e709aa Mon Sep 17 00:00:00 2001 From: Zoltan Biro Date: Mon, 29 Aug 2016 16:47:22 +0200 Subject: [PATCH 2/3] regenerate petstore sample --- samples/client/petstore/python/README.md | 2 +- samples/client/petstore/python/petstore_api/api_client.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/samples/client/petstore/python/README.md b/samples/client/petstore/python/README.md index db827de9ceb..3f9cea1e35a 100644 --- a/samples/client/petstore/python/README.md +++ b/samples/client/petstore/python/README.md @@ -5,7 +5,7 @@ This Python package is automatically generated by the [Swagger Codegen](https:// - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-08-22T17:54:52.358+08:00 +- Build date: 2016-08-29T16:39:50.642+02:00 - Build package: class io.swagger.codegen.languages.PythonClientCodegen ## Requirements. diff --git a/samples/client/petstore/python/petstore_api/api_client.py b/samples/client/petstore/python/petstore_api/api_client.py index ddfaf2ca744..8fb86fc0964 100644 --- a/samples/client/petstore/python/petstore_api/api_client.py +++ b/samples/client/petstore/python/petstore_api/api_client.py @@ -581,6 +581,9 @@ class ApiClient(object): """ instance = klass() + if not instance.swagger_types: + return data + for attr, attr_type in iteritems(instance.swagger_types): if data is not None \ and instance.attribute_map[attr] in data\ From 646c4faa62f6391070bfbdda68c14ae504c17f5a Mon Sep 17 00:00:00 2001 From: Zoltan Biro Date: Mon, 29 Aug 2016 16:53:38 +0200 Subject: [PATCH 3/3] fixing python code formatting issue --- .../src/main/resources/python/api_client.mustache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/swagger-codegen/src/main/resources/python/api_client.mustache b/modules/swagger-codegen/src/main/resources/python/api_client.mustache index 2ea9b2299cc..4a8c14c8dd6 100644 --- a/modules/swagger-codegen/src/main/resources/python/api_client.mustache +++ b/modules/swagger-codegen/src/main/resources/python/api_client.mustache @@ -581,7 +581,7 @@ class ApiClient(object): """ instance = klass() - if(not instance.swagger_types): + if not instance.swagger_types: return data for attr, attr_type in iteritems(instance.swagger_types):