Merge branch 'validation' of https://github.com/scottrw93/swagger-codegen into scottrw93-validation

This commit is contained in:
wing328
2016-05-09 10:51:23 +08:00
23 changed files with 285 additions and 6 deletions

View File

@@ -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-27T22:50:21.115+01:00
- Build date: 2016-05-09T01:08:25.311+01:00
- Build package: class io.swagger.codegen.languages.PythonClientCodegen
## Requirements.
@@ -18,9 +18,9 @@ Python 2.7 and 3.4+
If the python package is hosted on Github, you can install directly from Github
```sh
pip install git+https://github.com/YOUR_GIT_USR_ID/YOUR_GIT_REPO_ID.git
pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git
```
(you may need to run `pip` with root permission: `sudo pip install git+https://github.com/YOUR_GIT_USR_ID/YOUR_GIT_REPO_ID.git`)
(you may need to run `pip` with root permission: `sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git`)
Then import the package:
```python

View File

@@ -8,12 +8,12 @@ git_repo_id=$2
release_note=$3
if [ "$git_user_id" = "" ]; then
git_user_id="YOUR_GIT_USR_ID"
git_user_id="GIT_USER_ID"
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
fi
if [ "$git_repo_id" = "" ]; then
git_repo_id="YOUR_GIT_REPO_ID"
git_repo_id="GIT_REPO_ID"
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
fi

View File

@@ -21,6 +21,7 @@ from __future__ import absolute_import
import sys
import os
import re
# python 2 and python 3 compatibility library
from six import iteritems
@@ -103,6 +104,31 @@ class FakeApi(object):
if ('byte' not in params) or (params['byte'] is None):
raise ValueError("Missing the required parameter `byte` when calling `test_endpoint_parameters`")
if 'number' in params and params['number'] > 543.2:
raise ValueError("Invalid value for parameter `number` when calling `test_endpoint_parameters`, must be a value less than or equal to `543.2`")
if 'number' in params and params['number'] < 32.1:
raise ValueError("Invalid value for parameter `number` when calling `test_endpoint_parameters`, must be a value greater than or equal to `32.1`")
if 'double' in params and params['double'] > 123.4:
raise ValueError("Invalid value for parameter `double` when calling `test_endpoint_parameters`, must be a value less than or equal to `123.4`")
if 'double' in params and params['double'] < 67.8:
raise ValueError("Invalid value for parameter `double` when calling `test_endpoint_parameters`, must be a value greater than or equal to `67.8`")
if 'string' in params and not re.search('[a-z]', params['string'], flags=re.IGNORECASE):
raise ValueError("Invalid value for parameter `string` when calling `test_endpoint_parameters`, must conform to the pattern `/[a-z]/i`")
if 'integer' in params and params['integer'] > 100.0:
raise ValueError("Invalid value for parameter `integer` when calling `test_endpoint_parameters`, must be a value less than or equal to `100.0`")
if 'integer' in params and params['integer'] < 10.0:
raise ValueError("Invalid value for parameter `integer` when calling `test_endpoint_parameters`, must be a value greater than or equal to `10.0`")
if 'int32' in params and params['int32'] > 200.0:
raise ValueError("Invalid value for parameter `int32` when calling `test_endpoint_parameters`, must be a value less than or equal to `200.0`")
if 'int32' in params and params['int32'] < 20.0:
raise ValueError("Invalid value for parameter `int32` when calling `test_endpoint_parameters`, must be a value greater than or equal to `20.0`")
if 'float' in params and params['float'] > 987.6:
raise ValueError("Invalid value for parameter `float` when calling `test_endpoint_parameters`, must be a value less than or equal to `987.6`")
if 'password' in params and len(params['password']) > 64:
raise ValueError("Invalid value for parameter `password` when calling `test_endpoint_parameters`, length must be less than or equal to `64`")
if 'password' in params and len(params['password']) < 10:
raise ValueError("Invalid value for parameter `password` when calling `test_endpoint_parameters`, length must be greater than or equal to `10`")
resource_path = '/fake'.replace('{format}', 'json')
path_params = {}

View File

@@ -21,6 +21,7 @@ from __future__ import absolute_import
import sys
import os
import re
# python 2 and python 3 compatibility library
from six import iteritems
@@ -83,6 +84,7 @@ class PetApi(object):
if ('body' not in params) or (params['body'] is None):
raise ValueError("Missing the required parameter `body` when calling `add_pet`")
resource_path = '/pet'.replace('{format}', 'json')
path_params = {}
@@ -161,6 +163,7 @@ class PetApi(object):
if ('pet_id' not in params) or (params['pet_id'] is None):
raise ValueError("Missing the required parameter `pet_id` when calling `delete_pet`")
resource_path = '/pet/{petId}'.replace('{format}', 'json')
path_params = {}
if 'pet_id' in params:
@@ -240,6 +243,7 @@ class PetApi(object):
if ('status' not in params) or (params['status'] is None):
raise ValueError("Missing the required parameter `status` when calling `find_pets_by_status`")
resource_path = '/pet/findByStatus'.replace('{format}', 'json')
path_params = {}
@@ -317,6 +321,7 @@ class PetApi(object):
if ('tags' not in params) or (params['tags'] is None):
raise ValueError("Missing the required parameter `tags` when calling `find_pets_by_tags`")
resource_path = '/pet/findByTags'.replace('{format}', 'json')
path_params = {}
@@ -394,6 +399,7 @@ class PetApi(object):
if ('pet_id' not in params) or (params['pet_id'] is None):
raise ValueError("Missing the required parameter `pet_id` when calling `get_pet_by_id`")
resource_path = '/pet/{petId}'.replace('{format}', 'json')
path_params = {}
if 'pet_id' in params:
@@ -471,6 +477,7 @@ class PetApi(object):
if ('body' not in params) or (params['body'] is None):
raise ValueError("Missing the required parameter `body` when calling `update_pet`")
resource_path = '/pet'.replace('{format}', 'json')
path_params = {}
@@ -550,6 +557,7 @@ class PetApi(object):
if ('pet_id' not in params) or (params['pet_id'] is None):
raise ValueError("Missing the required parameter `pet_id` when calling `update_pet_with_form`")
resource_path = '/pet/{petId}'.replace('{format}', 'json')
path_params = {}
if 'pet_id' in params:
@@ -633,6 +641,7 @@ class PetApi(object):
if ('pet_id' not in params) or (params['pet_id'] is None):
raise ValueError("Missing the required parameter `pet_id` when calling `upload_file`")
resource_path = '/pet/{petId}/uploadImage'.replace('{format}', 'json')
path_params = {}
if 'pet_id' in params:

View File

@@ -21,6 +21,7 @@ from __future__ import absolute_import
import sys
import os
import re
# python 2 and python 3 compatibility library
from six import iteritems
@@ -83,6 +84,9 @@ class StoreApi(object):
if ('order_id' not in params) or (params['order_id'] is None):
raise ValueError("Missing the required parameter `order_id` when calling `delete_order`")
if 'order_id' in params and params['order_id'] < 1.0:
raise ValueError("Invalid value for parameter `order_id` when calling `delete_order`, must be a value greater than or equal to `1.0`")
resource_path = '/store/order/{orderId}'.replace('{format}', 'json')
path_params = {}
if 'order_id' in params:
@@ -156,6 +160,7 @@ class StoreApi(object):
del params['kwargs']
resource_path = '/store/inventory'.replace('{format}', 'json')
path_params = {}
@@ -231,6 +236,11 @@ class StoreApi(object):
if ('order_id' not in params) or (params['order_id'] is None):
raise ValueError("Missing the required parameter `order_id` when calling `get_order_by_id`")
if 'order_id' in params and params['order_id'] > 5.0:
raise ValueError("Invalid value for parameter `order_id` when calling `get_order_by_id`, must be a value less than or equal to `5.0`")
if 'order_id' in params and params['order_id'] < 1.0:
raise ValueError("Invalid value for parameter `order_id` when calling `get_order_by_id`, must be a value greater than or equal to `1.0`")
resource_path = '/store/order/{orderId}'.replace('{format}', 'json')
path_params = {}
if 'order_id' in params:
@@ -308,6 +318,7 @@ class StoreApi(object):
if ('body' not in params) or (params['body'] is None):
raise ValueError("Missing the required parameter `body` when calling `place_order`")
resource_path = '/store/order'.replace('{format}', 'json')
path_params = {}

View File

@@ -21,6 +21,7 @@ from __future__ import absolute_import
import sys
import os
import re
# python 2 and python 3 compatibility library
from six import iteritems
@@ -83,6 +84,7 @@ class UserApi(object):
if ('body' not in params) or (params['body'] is None):
raise ValueError("Missing the required parameter `body` when calling `create_user`")
resource_path = '/user'.replace('{format}', 'json')
path_params = {}
@@ -160,6 +162,7 @@ class UserApi(object):
if ('body' not in params) or (params['body'] is None):
raise ValueError("Missing the required parameter `body` when calling `create_users_with_array_input`")
resource_path = '/user/createWithArray'.replace('{format}', 'json')
path_params = {}
@@ -237,6 +240,7 @@ class UserApi(object):
if ('body' not in params) or (params['body'] is None):
raise ValueError("Missing the required parameter `body` when calling `create_users_with_list_input`")
resource_path = '/user/createWithList'.replace('{format}', 'json')
path_params = {}
@@ -314,6 +318,7 @@ class UserApi(object):
if ('username' not in params) or (params['username'] is None):
raise ValueError("Missing the required parameter `username` when calling `delete_user`")
resource_path = '/user/{username}'.replace('{format}', 'json')
path_params = {}
if 'username' in params:
@@ -391,6 +396,7 @@ class UserApi(object):
if ('username' not in params) or (params['username'] is None):
raise ValueError("Missing the required parameter `username` when calling `get_user_by_name`")
resource_path = '/user/{username}'.replace('{format}', 'json')
path_params = {}
if 'username' in params:
@@ -472,6 +478,7 @@ class UserApi(object):
if ('password' not in params) or (params['password'] is None):
raise ValueError("Missing the required parameter `password` when calling `login_user`")
resource_path = '/user/login'.replace('{format}', 'json')
path_params = {}
@@ -547,6 +554,7 @@ class UserApi(object):
del params['kwargs']
resource_path = '/user/logout'.replace('{format}', 'json')
path_params = {}
@@ -626,6 +634,7 @@ class UserApi(object):
if ('body' not in params) or (params['body'] is None):
raise ValueError("Missing the required parameter `body` when calling `update_user`")
resource_path = '/user/{username}'.replace('{format}', 'json')
path_params = {}
if 'username' in params:

View File

@@ -20,6 +20,7 @@ Copyright 2016 SmartBear Software
from pprint import pformat
from six import iteritems
import re
class Animal(object):
@@ -66,6 +67,7 @@ class Animal(object):
:param class_name: The class_name of this Animal.
:type: str
"""
self._class_name = class_name
def to_dict(self):

View File

@@ -20,6 +20,7 @@ Copyright 2016 SmartBear Software
from pprint import pformat
from six import iteritems
import re
class ApiResponse(object):
@@ -72,6 +73,7 @@ class ApiResponse(object):
:param code: The code of this ApiResponse.
:type: int
"""
self._code = code
@property
@@ -94,6 +96,7 @@ class ApiResponse(object):
:param type: The type of this ApiResponse.
:type: str
"""
self._type = type
@property
@@ -116,6 +119,7 @@ class ApiResponse(object):
:param message: The message of this ApiResponse.
:type: str
"""
self._message = message
def to_dict(self):

View File

@@ -20,6 +20,7 @@ Copyright 2016 SmartBear Software
from pprint import pformat
from six import iteritems
import re
class Cat(object):
@@ -69,6 +70,7 @@ class Cat(object):
:param class_name: The class_name of this Cat.
:type: str
"""
self._class_name = class_name
@property
@@ -91,6 +93,7 @@ class Cat(object):
:param declawed: The declawed of this Cat.
:type: bool
"""
self._declawed = declawed
def to_dict(self):

View File

@@ -20,6 +20,7 @@ Copyright 2016 SmartBear Software
from pprint import pformat
from six import iteritems
import re
class Category(object):
@@ -69,6 +70,7 @@ class Category(object):
:param id: The id of this Category.
:type: int
"""
self._id = id
@property
@@ -91,6 +93,7 @@ class Category(object):
:param name: The name of this Category.
:type: str
"""
self._name = name
def to_dict(self):

View File

@@ -20,6 +20,7 @@ Copyright 2016 SmartBear Software
from pprint import pformat
from six import iteritems
import re
class Dog(object):
@@ -69,6 +70,7 @@ class Dog(object):
:param class_name: The class_name of this Dog.
:type: str
"""
self._class_name = class_name
@property
@@ -91,6 +93,7 @@ class Dog(object):
:param breed: The breed of this Dog.
:type: str
"""
self._breed = breed
def to_dict(self):

View File

@@ -20,6 +20,7 @@ Copyright 2016 SmartBear Software
from pprint import pformat
from six import iteritems
import re
class FormatTest(object):
@@ -102,6 +103,14 @@ class FormatTest(object):
:param integer: The integer of this FormatTest.
:type: int
"""
if not integer:
raise ValueError("Invalid value for `integer`, must not be `None`")
if integer > 100.0:
raise ValueError("Invalid value for `integer`, must be a value less than or equal to `100.0`")
if integer < 10.0:
raise ValueError("Invalid value for `integer`, must be a value greater than or equal to `10.0`")
self._integer = integer
@property
@@ -124,6 +133,14 @@ class FormatTest(object):
:param int32: The int32 of this FormatTest.
:type: int
"""
if not int32:
raise ValueError("Invalid value for `int32`, must not be `None`")
if int32 > 200.0:
raise ValueError("Invalid value for `int32`, must be a value less than or equal to `200.0`")
if int32 < 20.0:
raise ValueError("Invalid value for `int32`, must be a value greater than or equal to `20.0`")
self._int32 = int32
@property
@@ -146,6 +163,7 @@ class FormatTest(object):
:param int64: The int64 of this FormatTest.
:type: int
"""
self._int64 = int64
@property
@@ -168,6 +186,14 @@ class FormatTest(object):
:param number: The number of this FormatTest.
:type: float
"""
if not number:
raise ValueError("Invalid value for `number`, must not be `None`")
if number > 543.2:
raise ValueError("Invalid value for `number`, must be a value less than or equal to `543.2`")
if number < 32.1:
raise ValueError("Invalid value for `number`, must be a value greater than or equal to `32.1`")
self._number = number
@property
@@ -190,6 +216,14 @@ class FormatTest(object):
:param float: The float of this FormatTest.
:type: float
"""
if not float:
raise ValueError("Invalid value for `float`, must not be `None`")
if float > 987.6:
raise ValueError("Invalid value for `float`, must be a value less than or equal to `987.6`")
if float < 54.3:
raise ValueError("Invalid value for `float`, must be a value greater than or equal to `54.3`")
self._float = float
@property
@@ -212,6 +246,14 @@ class FormatTest(object):
:param double: The double of this FormatTest.
:type: float
"""
if not double:
raise ValueError("Invalid value for `double`, must not be `None`")
if double > 123.4:
raise ValueError("Invalid value for `double`, must be a value less than or equal to `123.4`")
if double < 67.8:
raise ValueError("Invalid value for `double`, must be a value greater than or equal to `67.8`")
self._double = double
@property
@@ -234,6 +276,12 @@ class FormatTest(object):
:param string: The string of this FormatTest.
:type: str
"""
if not string:
raise ValueError("Invalid value for `string`, must not be `None`")
if not re.search('[a-z]', string, flags=re.IGNORECASE):
raise ValueError("Invalid value for `string`, must be a follow pattern or equal to `/[a-z]/i`")
self._string = string
@property
@@ -256,6 +304,7 @@ class FormatTest(object):
:param byte: The byte of this FormatTest.
:type: str
"""
self._byte = byte
@property
@@ -278,6 +327,7 @@ class FormatTest(object):
:param binary: The binary of this FormatTest.
:type: str
"""
self._binary = binary
@property
@@ -300,6 +350,7 @@ class FormatTest(object):
:param date: The date of this FormatTest.
:type: date
"""
self._date = date
@property
@@ -322,6 +373,7 @@ class FormatTest(object):
:param date_time: The date_time of this FormatTest.
:type: datetime
"""
self._date_time = date_time
@property
@@ -344,6 +396,7 @@ class FormatTest(object):
:param uuid: The uuid of this FormatTest.
:type: str
"""
self._uuid = uuid
@property
@@ -366,6 +419,14 @@ class FormatTest(object):
:param password: The password of this FormatTest.
:type: str
"""
if not password:
raise ValueError("Invalid value for `password`, must not be `None`")
if len(password) > 64:
raise ValueError("Invalid value for `password`, length must be less than `64`")
if len(password) < 10:
raise ValueError("Invalid value for `password`, length must be greater than or equal to `10`")
self._password = password
def to_dict(self):

View File

@@ -20,6 +20,7 @@ Copyright 2016 SmartBear Software
from pprint import pformat
from six import iteritems
import re
class Model200Response(object):
@@ -66,6 +67,7 @@ class Model200Response(object):
:param name: The name of this Model200Response.
:type: int
"""
self._name = name
def to_dict(self):

View File

@@ -20,6 +20,7 @@ Copyright 2016 SmartBear Software
from pprint import pformat
from six import iteritems
import re
class ModelReturn(object):
@@ -66,6 +67,7 @@ class ModelReturn(object):
:param _return: The _return of this ModelReturn.
:type: int
"""
self.__return = _return
def to_dict(self):

View File

@@ -20,6 +20,7 @@ Copyright 2016 SmartBear Software
from pprint import pformat
from six import iteritems
import re
class Name(object):
@@ -72,6 +73,7 @@ class Name(object):
:param name: The name of this Name.
:type: int
"""
self._name = name
@property
@@ -94,6 +96,7 @@ class Name(object):
:param snake_case: The snake_case of this Name.
:type: int
"""
self._snake_case = snake_case
@property
@@ -116,6 +119,7 @@ class Name(object):
:param _property: The _property of this Name.
:type: str
"""
self.__property = _property
def to_dict(self):

View File

@@ -20,6 +20,7 @@ Copyright 2016 SmartBear Software
from pprint import pformat
from six import iteritems
import re
class Order(object):
@@ -81,6 +82,7 @@ class Order(object):
:param id: The id of this Order.
:type: int
"""
self._id = id
@property
@@ -103,6 +105,7 @@ class Order(object):
:param pet_id: The pet_id of this Order.
:type: int
"""
self._pet_id = pet_id
@property
@@ -125,6 +128,7 @@ class Order(object):
:param quantity: The quantity of this Order.
:type: int
"""
self._quantity = quantity
@property
@@ -147,6 +151,7 @@ class Order(object):
:param ship_date: The ship_date of this Order.
:type: datetime
"""
self._ship_date = ship_date
@property
@@ -175,6 +180,7 @@ class Order(object):
"Invalid value for `status`, must be one of {0}"
.format(allowed_values)
)
self._status = status
@property
@@ -197,6 +203,7 @@ class Order(object):
:param complete: The complete of this Order.
:type: bool
"""
self._complete = complete
def to_dict(self):

View File

@@ -20,6 +20,7 @@ Copyright 2016 SmartBear Software
from pprint import pformat
from six import iteritems
import re
class Pet(object):
@@ -81,6 +82,7 @@ class Pet(object):
:param id: The id of this Pet.
:type: int
"""
self._id = id
@property
@@ -103,6 +105,7 @@ class Pet(object):
:param category: The category of this Pet.
:type: Category
"""
self._category = category
@property
@@ -125,6 +128,7 @@ class Pet(object):
:param name: The name of this Pet.
:type: str
"""
self._name = name
@property
@@ -147,6 +151,7 @@ class Pet(object):
:param photo_urls: The photo_urls of this Pet.
:type: list[str]
"""
self._photo_urls = photo_urls
@property
@@ -169,6 +174,7 @@ class Pet(object):
:param tags: The tags of this Pet.
:type: list[Tag]
"""
self._tags = tags
@property
@@ -197,6 +203,7 @@ class Pet(object):
"Invalid value for `status`, must be one of {0}"
.format(allowed_values)
)
self._status = status
def to_dict(self):

View File

@@ -20,6 +20,7 @@ Copyright 2016 SmartBear Software
from pprint import pformat
from six import iteritems
import re
class SpecialModelName(object):
@@ -66,6 +67,7 @@ class SpecialModelName(object):
:param special_property_name: The special_property_name of this SpecialModelName.
:type: int
"""
self._special_property_name = special_property_name
def to_dict(self):

View File

@@ -20,6 +20,7 @@ Copyright 2016 SmartBear Software
from pprint import pformat
from six import iteritems
import re
class Tag(object):
@@ -69,6 +70,7 @@ class Tag(object):
:param id: The id of this Tag.
:type: int
"""
self._id = id
@property
@@ -91,6 +93,7 @@ class Tag(object):
:param name: The name of this Tag.
:type: str
"""
self._name = name
def to_dict(self):

View File

@@ -20,6 +20,7 @@ Copyright 2016 SmartBear Software
from pprint import pformat
from six import iteritems
import re
class User(object):
@@ -87,6 +88,7 @@ class User(object):
:param id: The id of this User.
:type: int
"""
self._id = id
@property
@@ -109,6 +111,7 @@ class User(object):
:param username: The username of this User.
:type: str
"""
self._username = username
@property
@@ -131,6 +134,7 @@ class User(object):
:param first_name: The first_name of this User.
:type: str
"""
self._first_name = first_name
@property
@@ -153,6 +157,7 @@ class User(object):
:param last_name: The last_name of this User.
:type: str
"""
self._last_name = last_name
@property
@@ -175,6 +180,7 @@ class User(object):
:param email: The email of this User.
:type: str
"""
self._email = email
@property
@@ -197,6 +203,7 @@ class User(object):
:param password: The password of this User.
:type: str
"""
self._password = password
@property
@@ -219,6 +226,7 @@ class User(object):
:param phone: The phone of this User.
:type: str
"""
self._phone = phone
@property
@@ -241,6 +249,7 @@ class User(object):
:param user_status: The user_status of this User.
:type: int
"""
self._user_status = user_status
def to_dict(self):