mapped uuid to str in python

This commit is contained in:
wing328 2016-04-27 17:37:44 +08:00
parent 59f9849ca0
commit 87c6566bd0
7 changed files with 56 additions and 13 deletions

View File

@ -58,10 +58,12 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
typeMapping.put("DateTime", "datetime"); typeMapping.put("DateTime", "datetime");
typeMapping.put("object", "object"); typeMapping.put("object", "object");
typeMapping.put("file", "file"); 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 // mapped to String as a workaround
typeMapping.put("binary", "str"); typeMapping.put("binary", "str");
typeMapping.put("ByteArray", "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 // from https://docs.python.org/release/2.5.4/ref/keywords.html
setReservedWordsLowerCase( setReservedWordsLowerCase(

View File

@ -590,6 +590,7 @@ paths:
in: formData in: formData
description: None description: None
- name: number - name: number
type: number
maximum: 543.2 maximum: 543.2
minimum: 32.1 minimum: 32.1
in: formData in: formData
@ -890,6 +891,9 @@ definitions:
dateTime: dateTime:
type: string type: string
format: date-time format: date-time
uuid:
type: string
format: uuid
password: password:
type: string type: string
format: password format: password

View File

@ -5,7 +5,7 @@ This Python package is automatically generated by the [Swagger Codegen](https://
- API version: 1.0.0 - API version: 1.0.0
- Package 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 - Build package: class io.swagger.codegen.languages.PythonClientCodegen
## Requirements. ## Requirements.
@ -50,18 +50,26 @@ import time
import swagger_client import swagger_client
from swagger_client.rest import ApiException from swagger_client.rest import ApiException
from pprint import pprint 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 # create an instance of the API class
api_instance = swagger_client.PetApi api_instance = swagger_client.FakeApi
body = swagger_client.Pet() # Pet | Pet object that needs to be added to the store 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: try:
# Add a new pet to the store # Fake endpoint for testing various parameters
api_instance.add_pet(body) 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: 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 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* | [**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* | [**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 *PetApi* | [**find_pets_by_status**](docs/PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status

View File

@ -10,11 +10,12 @@ Name | Type | Description | Notes
**float** | **float** | | [optional] **float** | **float** | | [optional]
**double** | **float** | | [optional] **double** | **float** | | [optional]
**string** | **str** | | [optional] **string** | **str** | | [optional]
**byte** | **str** | | [optional] **byte** | **str** | |
**binary** | **str** | | [optional] **binary** | **str** | | [optional]
**date** | **date** | | [optional] **date** | **date** | |
**date_time** | **datetime** | | [optional] **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) [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -17,6 +17,7 @@ from .models.tag import Tag
from .models.user import User from .models.user import User
# import apis into sdk package # import apis into sdk package
from .apis.fake_api import FakeApi
from .apis.pet_api import PetApi from .apis.pet_api import PetApi
from .apis.store_api import StoreApi from .apis.store_api import StoreApi
from .apis.user_api import UserApi from .apis.user_api import UserApi

View File

@ -1,6 +1,7 @@
from __future__ import absolute_import from __future__ import absolute_import
# import apis into api package # import apis into api package
from .fake_api import FakeApi
from .pet_api import PetApi from .pet_api import PetApi
from .store_api import StoreApi from .store_api import StoreApi
from .user_api import UserApi from .user_api import UserApi

View File

@ -48,6 +48,7 @@ class FormatTest(object):
'binary': 'str', 'binary': 'str',
'date': 'date', 'date': 'date',
'date_time': 'datetime', 'date_time': 'datetime',
'uuid': 'str',
'password': 'str' 'password': 'str'
} }
@ -63,6 +64,7 @@ class FormatTest(object):
'binary': 'binary', 'binary': 'binary',
'date': 'date', 'date': 'date',
'date_time': 'dateTime', 'date_time': 'dateTime',
'uuid': 'uuid',
'password': 'password' 'password': 'password'
} }
@ -77,6 +79,7 @@ class FormatTest(object):
self._binary = None self._binary = None
self._date = None self._date = None
self._date_time = None self._date_time = None
self._uuid = None
self._password = None self._password = None
@property @property
@ -321,6 +324,28 @@ class FormatTest(object):
""" """
self._date_time = date_time 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 @property
def password(self): def password(self):
""" """