diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PythonClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PythonClientCodegen.java index a1e3d6f9356..7cb4dc703db 100755 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PythonClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PythonClientCodegen.java @@ -58,10 +58,12 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig typeMapping.put("DateTime", "datetime"); typeMapping.put("object", "object"); typeMapping.put("file", "file"); - //TODO binary should be mapped to byte array + // TODO binary should be mapped to byte array // mapped to String as a workaround typeMapping.put("binary", "str"); typeMapping.put("ByteArray", "str"); + // map uuid to string for the time being + typeMapping.put("UUID", "str"); // from https://docs.python.org/release/2.5.4/ref/keywords.html setReservedWordsLowerCase( diff --git a/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml b/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml index 29996c16b72..4160e59cc48 100644 --- a/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml +++ b/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml @@ -590,6 +590,7 @@ paths: in: formData description: None - name: number + type: number maximum: 543.2 minimum: 32.1 in: formData @@ -890,6 +891,9 @@ definitions: dateTime: type: string format: date-time + uuid: + type: string + format: uuid password: type: string format: password diff --git a/samples/client/petstore/python/README.md b/samples/client/petstore/python/README.md index 79eef580326..851c5458cb1 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-04-20T22:11:45.927+08:00 +- Build date: 2016-04-27T17:36:32.266+08:00 - Build package: class io.swagger.codegen.languages.PythonClientCodegen ## Requirements. @@ -50,18 +50,26 @@ import time import swagger_client from swagger_client.rest import ApiException from pprint import pprint - -# Configure OAuth2 access token for authorization: petstore_auth -swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN' # create an instance of the API class -api_instance = swagger_client.PetApi -body = swagger_client.Pet() # Pet | Pet object that needs to be added to the store +api_instance = swagger_client.FakeApi +number = 3.4 # float | None +double = 1.2 # float | None +string = 'string_example' # str | None +byte = 'B' # str | None +integer = 56 # int | None (optional) +int32 = 56 # int | None (optional) +int64 = 789 # int | None (optional) +float = 3.4 # float | None (optional) +binary = 'B' # str | None (optional) +date = '2013-10-20' # date | None (optional) +date_time = '2013-10-20T19:20:30+01:00' # datetime | None (optional) +password = 'password_example' # str | None (optional) try: - # Add a new pet to the store - api_instance.add_pet(body) + # Fake endpoint for testing various parameters + api_instance.test_endpoint_parameters(number, double, string, byte, integer=integer, int32=int32, int64=int64, float=float, binary=binary, date=date, date_time=date_time, password=password) except ApiException as e: - print "Exception when calling PetApi->add_pet: %s\n" % e + print "Exception when calling FakeApi->test_endpoint_parameters: %s\n" % e ``` @@ -71,6 +79,7 @@ All URIs are relative to *http://petstore.swagger.io/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- +*FakeApi* | [**test_endpoint_parameters**](docs/FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters *PetApi* | [**add_pet**](docs/PetApi.md#add_pet) | **POST** /pet | Add a new pet to the store *PetApi* | [**delete_pet**](docs/PetApi.md#delete_pet) | **DELETE** /pet/{petId} | Deletes a pet *PetApi* | [**find_pets_by_status**](docs/PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status diff --git a/samples/client/petstore/python/docs/FormatTest.md b/samples/client/petstore/python/docs/FormatTest.md index 4182a447086..3e489e863fa 100644 --- a/samples/client/petstore/python/docs/FormatTest.md +++ b/samples/client/petstore/python/docs/FormatTest.md @@ -10,11 +10,12 @@ Name | Type | Description | Notes **float** | **float** | | [optional] **double** | **float** | | [optional] **string** | **str** | | [optional] -**byte** | **str** | | [optional] +**byte** | **str** | | **binary** | **str** | | [optional] -**date** | **date** | | [optional] +**date** | **date** | | **date_time** | **datetime** | | [optional] -**password** | **str** | | [optional] +**uuid** | **str** | | [optional] +**password** | **str** | | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/python/swagger_client/__init__.py b/samples/client/petstore/python/swagger_client/__init__.py index 2169ecd37e7..783f8b9713a 100644 --- a/samples/client/petstore/python/swagger_client/__init__.py +++ b/samples/client/petstore/python/swagger_client/__init__.py @@ -17,6 +17,7 @@ from .models.tag import Tag from .models.user import User # import apis into sdk package +from .apis.fake_api import FakeApi from .apis.pet_api import PetApi from .apis.store_api import StoreApi from .apis.user_api import UserApi diff --git a/samples/client/petstore/python/swagger_client/apis/__init__.py b/samples/client/petstore/python/swagger_client/apis/__init__.py index a3a12ea9ac1..ddde8c164bf 100644 --- a/samples/client/petstore/python/swagger_client/apis/__init__.py +++ b/samples/client/petstore/python/swagger_client/apis/__init__.py @@ -1,6 +1,7 @@ from __future__ import absolute_import # import apis into api package +from .fake_api import FakeApi from .pet_api import PetApi from .store_api import StoreApi from .user_api import UserApi diff --git a/samples/client/petstore/python/swagger_client/models/format_test.py b/samples/client/petstore/python/swagger_client/models/format_test.py index 8654d79bc3c..28f348edf04 100644 --- a/samples/client/petstore/python/swagger_client/models/format_test.py +++ b/samples/client/petstore/python/swagger_client/models/format_test.py @@ -48,6 +48,7 @@ class FormatTest(object): 'binary': 'str', 'date': 'date', 'date_time': 'datetime', + 'uuid': 'str', 'password': 'str' } @@ -63,6 +64,7 @@ class FormatTest(object): 'binary': 'binary', 'date': 'date', 'date_time': 'dateTime', + 'uuid': 'uuid', 'password': 'password' } @@ -77,6 +79,7 @@ class FormatTest(object): self._binary = None self._date = None self._date_time = None + self._uuid = None self._password = None @property @@ -321,6 +324,28 @@ class FormatTest(object): """ self._date_time = date_time + @property + def uuid(self): + """ + Gets the uuid of this FormatTest. + + + :return: The uuid of this FormatTest. + :rtype: str + """ + return self._uuid + + @uuid.setter + def uuid(self, uuid): + """ + Sets the uuid of this FormatTest. + + + :param uuid: The uuid of this FormatTest. + :type: str + """ + self._uuid = uuid + @property def password(self): """