[python-client] Add model default values (#1776)

* Adds two models to the v2.0 spec, uses examples as defaults in python client

* Adds array default and type_holder_default and type_holder_example tests

* Re-generated python security client with ./bin/security/python-petstore.sh

* Changes comment text, rebased master

* Updates client + server samples

* Adds missing samples updates

* Changes python client to look for true or false with booleans in toDefaultValue

* Changes boolean casting to use Boolean.valueOf

* Adds deserialization fix for python tests

* Changes Mock to namedtuple in python deserialization tests

* Actually remove unittest.mock
This commit is contained in:
Justin Black
2019-01-08 19:18:35 -08:00
committed by William Cheng
parent 189849319c
commit 539ec23298
197 changed files with 20872 additions and 292 deletions

View File

@@ -53,11 +53,11 @@ from pprint import pprint
# create an instance of the API class
api_instance = petstore_api.AnotherFakeApi(petstore_api.ApiClient(configuration))
client = petstore_api.Client() # Client | client model
body = petstore_api.Client() # Client | client model
try:
# To test special tags
api_response = api_instance.call_123_test_special_tags(client)
api_response = api_instance.call_123_test_special_tags(body)
pprint(api_response)
except ApiException as e:
print("Exception when calling AnotherFakeApi->call_123_test_special_tags: %s\n" % e)
@@ -142,6 +142,8 @@ Class | Method | HTTP request | Description
- [ReadOnlyFirst](docs/ReadOnlyFirst.md)
- [SpecialModelName](docs/SpecialModelName.md)
- [Tag](docs/Tag.md)
- [TypeHolderDefault](docs/TypeHolderDefault.md)
- [TypeHolderExample](docs/TypeHolderExample.md)
- [User](docs/User.md)

View File

@@ -8,7 +8,7 @@ Method | HTTP request | Description
# **call_123_test_special_tags**
> Client call_123_test_special_tags(client)
> Client call_123_test_special_tags(body)
To test special tags
@@ -24,11 +24,11 @@ from pprint import pprint
# create an instance of the API class
api_instance = petstore_api.AnotherFakeApi()
client = petstore_api.Client() # Client | client model
body = petstore_api.Client() # Client | client model
try:
# To test special tags
api_response = api_instance.call_123_test_special_tags(client)
api_response = api_instance.call_123_test_special_tags(body)
pprint(api_response)
except ApiException as e:
print("Exception when calling AnotherFakeApi->call_123_test_special_tags: %s\n" % e)
@@ -38,7 +38,7 @@ except ApiException as e:
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**client** | [**Client**](Client.md)| client model |
**body** | [**Client**](Client.md)| client model |
### Return type

View File

@@ -66,7 +66,7 @@ No authorization required
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **fake_outer_composite_serialize**
> OuterComposite fake_outer_composite_serialize(outer_composite=outer_composite)
> OuterComposite fake_outer_composite_serialize(body=body)
@@ -82,10 +82,10 @@ from pprint import pprint
# create an instance of the API class
api_instance = petstore_api.FakeApi()
outer_composite = petstore_api.OuterComposite() # OuterComposite | Input composite as post body (optional)
body = petstore_api.OuterComposite() # OuterComposite | Input composite as post body (optional)
try:
api_response = api_instance.fake_outer_composite_serialize(outer_composite=outer_composite)
api_response = api_instance.fake_outer_composite_serialize(body=body)
pprint(api_response)
except ApiException as e:
print("Exception when calling FakeApi->fake_outer_composite_serialize: %s\n" % e)
@@ -95,7 +95,7 @@ except ApiException as e:
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**outer_composite** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional]
**body** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional]
### Return type
@@ -207,7 +207,7 @@ No authorization required
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **test_body_with_file_schema**
> test_body_with_file_schema(file_schema_test_class)
> test_body_with_file_schema(body)
@@ -223,10 +223,10 @@ from pprint import pprint
# create an instance of the API class
api_instance = petstore_api.FakeApi()
file_schema_test_class = petstore_api.FileSchemaTestClass() # FileSchemaTestClass |
body = petstore_api.FileSchemaTestClass() # FileSchemaTestClass |
try:
api_instance.test_body_with_file_schema(file_schema_test_class)
api_instance.test_body_with_file_schema(body)
except ApiException as e:
print("Exception when calling FakeApi->test_body_with_file_schema: %s\n" % e)
```
@@ -235,7 +235,7 @@ except ApiException as e:
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**file_schema_test_class** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| |
**body** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| |
### Return type
@@ -253,7 +253,7 @@ No authorization required
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **test_body_with_query_params**
> test_body_with_query_params(query, user)
> test_body_with_query_params(query, body)
@@ -268,10 +268,10 @@ from pprint import pprint
# create an instance of the API class
api_instance = petstore_api.FakeApi()
query = 'query_example' # str |
user = petstore_api.User() # User |
body = petstore_api.User() # User |
try:
api_instance.test_body_with_query_params(query, user)
api_instance.test_body_with_query_params(query, body)
except ApiException as e:
print("Exception when calling FakeApi->test_body_with_query_params: %s\n" % e)
```
@@ -281,7 +281,7 @@ except ApiException as e:
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**query** | **str**| |
**user** | [**User**](User.md)| |
**body** | [**User**](User.md)| |
### Return type
@@ -299,7 +299,7 @@ No authorization required
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **test_client_model**
> Client test_client_model(client)
> Client test_client_model(body)
To test \"client\" model
@@ -315,11 +315,11 @@ from pprint import pprint
# create an instance of the API class
api_instance = petstore_api.FakeApi()
client = petstore_api.Client() # Client | client model
body = petstore_api.Client() # Client | client model
try:
# To test \"client\" model
api_response = api_instance.test_client_model(client)
api_response = api_instance.test_client_model(body)
pprint(api_response)
except ApiException as e:
print("Exception when calling FakeApi->test_client_model: %s\n" % e)
@@ -329,7 +329,7 @@ except ApiException as e:
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**client** | [**Client**](Client.md)| client model |
**body** | [**Client**](Client.md)| client model |
### Return type
@@ -545,7 +545,7 @@ No authorization required
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **test_inline_additional_properties**
> test_inline_additional_properties(request_body)
> test_inline_additional_properties(param)
test inline additionalProperties
@@ -559,11 +559,11 @@ from pprint import pprint
# create an instance of the API class
api_instance = petstore_api.FakeApi()
request_body = {'key': 'request_body_example'} # dict(str, str) | request body
param = {'key': 'param_example'} # dict(str, str) | request body
try:
# test inline additionalProperties
api_instance.test_inline_additional_properties(request_body)
api_instance.test_inline_additional_properties(param)
except ApiException as e:
print("Exception when calling FakeApi->test_inline_additional_properties: %s\n" % e)
```
@@ -572,7 +572,7 @@ except ApiException as e:
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**request_body** | [**dict(str, str)**](str.md)| request body |
**param** | [**dict(str, str)**](str.md)| request body |
### Return type

View File

@@ -8,7 +8,7 @@ Method | HTTP request | Description
# **test_classname**
> Client test_classname(client)
> Client test_classname(body)
To test class name in snake case
@@ -32,11 +32,11 @@ configuration.api_key['api_key_query'] = 'YOUR_API_KEY'
# create an instance of the API class
api_instance = petstore_api.FakeClassnameTags123Api(petstore_api.ApiClient(configuration))
client = petstore_api.Client() # Client | client model
body = petstore_api.Client() # Client | client model
try:
# To test class name in snake case
api_response = api_instance.test_classname(client)
api_response = api_instance.test_classname(body)
pprint(api_response)
except ApiException as e:
print("Exception when calling FakeClassnameTags123Api->test_classname: %s\n" % e)
@@ -46,7 +46,7 @@ except ApiException as e:
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**client** | [**Client**](Client.md)| client model |
**body** | [**Client**](Client.md)| client model |
### Return type

View File

@@ -5,7 +5,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **int** | | [optional]
**category** | [**Category**](Category.md) | | [optional]
**name** | **str** | |
**name** | **str** | | [default to 'doggie']
**photo_urls** | **list[str]** | |
**tags** | [**list[Tag]**](Tag.md) | | [optional]
**status** | **str** | pet status in the store | [optional]

View File

@@ -16,7 +16,7 @@ Method | HTTP request | Description
# **add_pet**
> add_pet(pet)
> add_pet(body)
Add a new pet to the store
@@ -36,11 +36,11 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
# create an instance of the API class
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
pet = petstore_api.Pet() # Pet | Pet object that needs to be added to the store
body = petstore_api.Pet() # Pet | Pet object that needs to be added to the store
try:
# Add a new pet to the store
api_instance.add_pet(pet)
api_instance.add_pet(body)
except ApiException as e:
print("Exception when calling PetApi->add_pet: %s\n" % e)
```
@@ -49,7 +49,7 @@ except ApiException as e:
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
**body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
### Return type
@@ -284,7 +284,7 @@ Name | Type | Description | Notes
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **update_pet**
> update_pet(pet)
> update_pet(body)
Update an existing pet
@@ -304,11 +304,11 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
# create an instance of the API class
api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration))
pet = petstore_api.Pet() # Pet | Pet object that needs to be added to the store
body = petstore_api.Pet() # Pet | Pet object that needs to be added to the store
try:
# Update an existing pet
api_instance.update_pet(pet)
api_instance.update_pet(body)
except ApiException as e:
print("Exception when calling PetApi->update_pet: %s\n" % e)
```
@@ -317,7 +317,7 @@ except ApiException as e:
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
**body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
### Return type

View File

@@ -158,7 +158,7 @@ No authorization required
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **place_order**
> Order place_order(order)
> Order place_order(body)
Place an order for a pet
@@ -172,11 +172,11 @@ from pprint import pprint
# create an instance of the API class
api_instance = petstore_api.StoreApi()
order = petstore_api.Order() # Order | order placed for purchasing the pet
body = petstore_api.Order() # Order | order placed for purchasing the pet
try:
# Place an order for a pet
api_response = api_instance.place_order(order)
api_response = api_instance.place_order(body)
pprint(api_response)
except ApiException as e:
print("Exception when calling StoreApi->place_order: %s\n" % e)
@@ -186,7 +186,7 @@ except ApiException as e:
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**order** | [**Order**](Order.md)| order placed for purchasing the pet |
**body** | [**Order**](Order.md)| order placed for purchasing the pet |
### Return type

View File

@@ -0,0 +1,14 @@
# TypeHolderDefault
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**string_item** | **str** | | [default to 'what']
**number_item** | **float** | |
**integer_item** | **int** | |
**bool_item** | **bool** | | [default to True]
**array_item** | **list[int]** | |
[[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

@@ -0,0 +1,14 @@
# TypeHolderExample
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**string_item** | **str** | | [default to 'what']
**number_item** | **float** | | [default to 1.234]
**integer_item** | **int** | | [default to -2]
**bool_item** | **bool** | | [default to True]
**array_item** | **list[int]** | | [default to [0, 1, 2, 3]]
[[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

@@ -15,7 +15,7 @@ Method | HTTP request | Description
# **create_user**
> create_user(user)
> create_user(body)
Create user
@@ -31,11 +31,11 @@ from pprint import pprint
# create an instance of the API class
api_instance = petstore_api.UserApi()
user = petstore_api.User() # User | Created user object
body = petstore_api.User() # User | Created user object
try:
# Create user
api_instance.create_user(user)
api_instance.create_user(body)
except ApiException as e:
print("Exception when calling UserApi->create_user: %s\n" % e)
```
@@ -44,7 +44,7 @@ except ApiException as e:
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**user** | [**User**](User.md)| Created user object |
**body** | [**User**](User.md)| Created user object |
### Return type
@@ -62,7 +62,7 @@ No authorization required
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **create_users_with_array_input**
> create_users_with_array_input(user)
> create_users_with_array_input(body)
Creates list of users with given input array
@@ -76,11 +76,11 @@ from pprint import pprint
# create an instance of the API class
api_instance = petstore_api.UserApi()
user = NULL # list[User] | List of user object
body = NULL # list[User] | List of user object
try:
# Creates list of users with given input array
api_instance.create_users_with_array_input(user)
api_instance.create_users_with_array_input(body)
except ApiException as e:
print("Exception when calling UserApi->create_users_with_array_input: %s\n" % e)
```
@@ -89,7 +89,7 @@ except ApiException as e:
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**user** | [**list[User]**](list.md)| List of user object |
**body** | [**list[User]**](list.md)| List of user object |
### Return type
@@ -107,7 +107,7 @@ No authorization required
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **create_users_with_list_input**
> create_users_with_list_input(user)
> create_users_with_list_input(body)
Creates list of users with given input array
@@ -121,11 +121,11 @@ from pprint import pprint
# create an instance of the API class
api_instance = petstore_api.UserApi()
user = NULL # list[User] | List of user object
body = NULL # list[User] | List of user object
try:
# Creates list of users with given input array
api_instance.create_users_with_list_input(user)
api_instance.create_users_with_list_input(body)
except ApiException as e:
print("Exception when calling UserApi->create_users_with_list_input: %s\n" % e)
```
@@ -134,7 +134,7 @@ except ApiException as e:
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**user** | [**list[User]**](list.md)| List of user object |
**body** | [**list[User]**](list.md)| List of user object |
### Return type
@@ -334,7 +334,7 @@ No authorization required
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **update_user**
> update_user(username, user)
> update_user(username, body)
Updated user
@@ -351,11 +351,11 @@ from pprint import pprint
# create an instance of the API class
api_instance = petstore_api.UserApi()
username = 'username_example' # str | name that need to be deleted
user = petstore_api.User() # User | Updated user object
body = petstore_api.User() # User | Updated user object
try:
# Updated user
api_instance.update_user(username, user)
api_instance.update_user(username, body)
except ApiException as e:
print("Exception when calling UserApi->update_user: %s\n" % e)
```
@@ -365,7 +365,7 @@ except ApiException as e:
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**username** | **str**| name that need to be deleted |
**user** | [**User**](User.md)| Updated user object |
**body** | [**User**](User.md)| Updated user object |
### Return type

View File

@@ -61,4 +61,6 @@ from petstore_api.models.pet import Pet
from petstore_api.models.read_only_first import ReadOnlyFirst
from petstore_api.models.special_model_name import SpecialModelName
from petstore_api.models.tag import Tag
from petstore_api.models.type_holder_default import TypeHolderDefault
from petstore_api.models.type_holder_example import TypeHolderExample
from petstore_api.models.user import User

View File

@@ -32,39 +32,39 @@ class AnotherFakeApi(object):
api_client = ApiClient()
self.api_client = api_client
def call_123_test_special_tags(self, client, **kwargs): # noqa: E501
def call_123_test_special_tags(self, body, **kwargs): # noqa: E501
"""To test special tags # noqa: E501
To test special tags and operation ID starting with number # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.call_123_test_special_tags(client, async_req=True)
>>> thread = api.call_123_test_special_tags(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param Client client: client model (required)
:param Client body: client model (required)
:return: Client
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.call_123_test_special_tags_with_http_info(client, **kwargs) # noqa: E501
return self.call_123_test_special_tags_with_http_info(body, **kwargs) # noqa: E501
else:
(data) = self.call_123_test_special_tags_with_http_info(client, **kwargs) # noqa: E501
(data) = self.call_123_test_special_tags_with_http_info(body, **kwargs) # noqa: E501
return data
def call_123_test_special_tags_with_http_info(self, client, **kwargs): # noqa: E501
def call_123_test_special_tags_with_http_info(self, body, **kwargs): # noqa: E501
"""To test special tags # noqa: E501
To test special tags and operation ID starting with number # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.call_123_test_special_tags_with_http_info(client, async_req=True)
>>> thread = api.call_123_test_special_tags_with_http_info(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param Client client: client model (required)
:param Client body: client model (required)
:return: Client
If the method is called asynchronously,
returns the request thread.
@@ -72,7 +72,7 @@ class AnotherFakeApi(object):
local_var_params = locals()
all_params = ['client'] # noqa: E501
all_params = ['body'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
@@ -86,10 +86,10 @@ class AnotherFakeApi(object):
)
local_var_params[key] = val
del local_var_params['kwargs']
# verify the required parameter 'client' is set
if ('client' not in local_var_params or
local_var_params['client'] is None):
raise ValueError("Missing the required parameter `client` when calling `call_123_test_special_tags`") # noqa: E501
# verify the required parameter 'body' is set
if ('body' not in local_var_params or
local_var_params['body'] is None):
raise ValueError("Missing the required parameter `body` when calling `call_123_test_special_tags`") # noqa: E501
collection_formats = {}
@@ -103,8 +103,8 @@ class AnotherFakeApi(object):
local_var_files = {}
body_params = None
if 'client' in local_var_params:
body_params = local_var_params['client']
if 'body' in local_var_params:
body_params = local_var_params['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']) # noqa: E501

View File

@@ -134,7 +134,7 @@ class FakeApi(object):
>>> result = thread.get()
:param async_req bool
:param OuterComposite outer_composite: Input composite as post body
:param OuterComposite body: Input composite as post body
:return: OuterComposite
If the method is called asynchronously,
returns the request thread.
@@ -156,7 +156,7 @@ class FakeApi(object):
>>> result = thread.get()
:param async_req bool
:param OuterComposite outer_composite: Input composite as post body
:param OuterComposite body: Input composite as post body
:return: OuterComposite
If the method is called asynchronously,
returns the request thread.
@@ -164,7 +164,7 @@ class FakeApi(object):
local_var_params = locals()
all_params = ['outer_composite'] # noqa: E501
all_params = ['body'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
@@ -191,8 +191,8 @@ class FakeApi(object):
local_var_files = {}
body_params = None
if 'outer_composite' in local_var_params:
body_params = local_var_params['outer_composite']
if 'body' in local_var_params:
body_params = local_var_params['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['*/*']) # noqa: E501
@@ -400,39 +400,39 @@ class FakeApi(object):
_request_timeout=local_var_params.get('_request_timeout'),
collection_formats=collection_formats)
def test_body_with_file_schema(self, file_schema_test_class, **kwargs): # noqa: E501
def test_body_with_file_schema(self, body, **kwargs): # noqa: E501
"""test_body_with_file_schema # noqa: E501
For this test, the body for this request much reference a schema named `File`. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.test_body_with_file_schema(file_schema_test_class, async_req=True)
>>> thread = api.test_body_with_file_schema(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param FileSchemaTestClass file_schema_test_class: (required)
:param FileSchemaTestClass body: (required)
:return: None
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.test_body_with_file_schema_with_http_info(file_schema_test_class, **kwargs) # noqa: E501
return self.test_body_with_file_schema_with_http_info(body, **kwargs) # noqa: E501
else:
(data) = self.test_body_with_file_schema_with_http_info(file_schema_test_class, **kwargs) # noqa: E501
(data) = self.test_body_with_file_schema_with_http_info(body, **kwargs) # noqa: E501
return data
def test_body_with_file_schema_with_http_info(self, file_schema_test_class, **kwargs): # noqa: E501
def test_body_with_file_schema_with_http_info(self, body, **kwargs): # noqa: E501
"""test_body_with_file_schema # noqa: E501
For this test, the body for this request much reference a schema named `File`. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.test_body_with_file_schema_with_http_info(file_schema_test_class, async_req=True)
>>> thread = api.test_body_with_file_schema_with_http_info(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param FileSchemaTestClass file_schema_test_class: (required)
:param FileSchemaTestClass body: (required)
:return: None
If the method is called asynchronously,
returns the request thread.
@@ -440,7 +440,7 @@ class FakeApi(object):
local_var_params = locals()
all_params = ['file_schema_test_class'] # noqa: E501
all_params = ['body'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
@@ -454,10 +454,10 @@ class FakeApi(object):
)
local_var_params[key] = val
del local_var_params['kwargs']
# verify the required parameter 'file_schema_test_class' is set
if ('file_schema_test_class' not in local_var_params or
local_var_params['file_schema_test_class'] is None):
raise ValueError("Missing the required parameter `file_schema_test_class` when calling `test_body_with_file_schema`") # noqa: E501
# verify the required parameter 'body' is set
if ('body' not in local_var_params or
local_var_params['body'] is None):
raise ValueError("Missing the required parameter `body` when calling `test_body_with_file_schema`") # noqa: E501
collection_formats = {}
@@ -471,8 +471,8 @@ class FakeApi(object):
local_var_files = {}
body_params = None
if 'file_schema_test_class' in local_var_params:
body_params = local_var_params['file_schema_test_class']
if 'body' in local_var_params:
body_params = local_var_params['body']
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json']) # noqa: E501
@@ -496,39 +496,39 @@ class FakeApi(object):
_request_timeout=local_var_params.get('_request_timeout'),
collection_formats=collection_formats)
def test_body_with_query_params(self, query, user, **kwargs): # noqa: E501
def test_body_with_query_params(self, query, body, **kwargs): # noqa: E501
"""test_body_with_query_params # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.test_body_with_query_params(query, user, async_req=True)
>>> thread = api.test_body_with_query_params(query, body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str query: (required)
:param User user: (required)
:param User body: (required)
:return: None
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.test_body_with_query_params_with_http_info(query, user, **kwargs) # noqa: E501
return self.test_body_with_query_params_with_http_info(query, body, **kwargs) # noqa: E501
else:
(data) = self.test_body_with_query_params_with_http_info(query, user, **kwargs) # noqa: E501
(data) = self.test_body_with_query_params_with_http_info(query, body, **kwargs) # noqa: E501
return data
def test_body_with_query_params_with_http_info(self, query, user, **kwargs): # noqa: E501
def test_body_with_query_params_with_http_info(self, query, body, **kwargs): # noqa: E501
"""test_body_with_query_params # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.test_body_with_query_params_with_http_info(query, user, async_req=True)
>>> thread = api.test_body_with_query_params_with_http_info(query, body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str query: (required)
:param User user: (required)
:param User body: (required)
:return: None
If the method is called asynchronously,
returns the request thread.
@@ -536,7 +536,7 @@ class FakeApi(object):
local_var_params = locals()
all_params = ['query', 'user'] # noqa: E501
all_params = ['query', 'body'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
@@ -554,10 +554,10 @@ class FakeApi(object):
if ('query' not in local_var_params or
local_var_params['query'] is None):
raise ValueError("Missing the required parameter `query` when calling `test_body_with_query_params`") # noqa: E501
# verify the required parameter 'user' is set
if ('user' not in local_var_params or
local_var_params['user'] is None):
raise ValueError("Missing the required parameter `user` when calling `test_body_with_query_params`") # noqa: E501
# verify the required parameter 'body' is set
if ('body' not in local_var_params or
local_var_params['body'] is None):
raise ValueError("Missing the required parameter `body` when calling `test_body_with_query_params`") # noqa: E501
collection_formats = {}
@@ -573,8 +573,8 @@ class FakeApi(object):
local_var_files = {}
body_params = None
if 'user' in local_var_params:
body_params = local_var_params['user']
if 'body' in local_var_params:
body_params = local_var_params['body']
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json']) # noqa: E501
@@ -598,39 +598,39 @@ class FakeApi(object):
_request_timeout=local_var_params.get('_request_timeout'),
collection_formats=collection_formats)
def test_client_model(self, client, **kwargs): # noqa: E501
def test_client_model(self, body, **kwargs): # noqa: E501
"""To test \"client\" model # noqa: E501
To test \"client\" model # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.test_client_model(client, async_req=True)
>>> thread = api.test_client_model(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param Client client: client model (required)
:param Client body: client model (required)
:return: Client
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.test_client_model_with_http_info(client, **kwargs) # noqa: E501
return self.test_client_model_with_http_info(body, **kwargs) # noqa: E501
else:
(data) = self.test_client_model_with_http_info(client, **kwargs) # noqa: E501
(data) = self.test_client_model_with_http_info(body, **kwargs) # noqa: E501
return data
def test_client_model_with_http_info(self, client, **kwargs): # noqa: E501
def test_client_model_with_http_info(self, body, **kwargs): # noqa: E501
"""To test \"client\" model # noqa: E501
To test \"client\" model # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.test_client_model_with_http_info(client, async_req=True)
>>> thread = api.test_client_model_with_http_info(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param Client client: client model (required)
:param Client body: client model (required)
:return: Client
If the method is called asynchronously,
returns the request thread.
@@ -638,7 +638,7 @@ class FakeApi(object):
local_var_params = locals()
all_params = ['client'] # noqa: E501
all_params = ['body'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
@@ -652,10 +652,10 @@ class FakeApi(object):
)
local_var_params[key] = val
del local_var_params['kwargs']
# verify the required parameter 'client' is set
if ('client' not in local_var_params or
local_var_params['client'] is None):
raise ValueError("Missing the required parameter `client` when calling `test_client_model`") # noqa: E501
# verify the required parameter 'body' is set
if ('body' not in local_var_params or
local_var_params['body'] is None):
raise ValueError("Missing the required parameter `body` when calling `test_client_model`") # noqa: E501
collection_formats = {}
@@ -669,8 +669,8 @@ class FakeApi(object):
local_var_files = {}
body_params = None
if 'client' in local_var_params:
body_params = local_var_params['client']
if 'body' in local_var_params:
body_params = local_var_params['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']) # noqa: E501
@@ -1129,37 +1129,37 @@ class FakeApi(object):
_request_timeout=local_var_params.get('_request_timeout'),
collection_formats=collection_formats)
def test_inline_additional_properties(self, request_body, **kwargs): # noqa: E501
def test_inline_additional_properties(self, param, **kwargs): # noqa: E501
"""test inline additionalProperties # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.test_inline_additional_properties(request_body, async_req=True)
>>> thread = api.test_inline_additional_properties(param, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict(str, str) request_body: request body (required)
:param dict(str, str) param: request body (required)
:return: None
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.test_inline_additional_properties_with_http_info(request_body, **kwargs) # noqa: E501
return self.test_inline_additional_properties_with_http_info(param, **kwargs) # noqa: E501
else:
(data) = self.test_inline_additional_properties_with_http_info(request_body, **kwargs) # noqa: E501
(data) = self.test_inline_additional_properties_with_http_info(param, **kwargs) # noqa: E501
return data
def test_inline_additional_properties_with_http_info(self, request_body, **kwargs): # noqa: E501
def test_inline_additional_properties_with_http_info(self, param, **kwargs): # noqa: E501
"""test inline additionalProperties # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.test_inline_additional_properties_with_http_info(request_body, async_req=True)
>>> thread = api.test_inline_additional_properties_with_http_info(param, async_req=True)
>>> result = thread.get()
:param async_req bool
:param dict(str, str) request_body: request body (required)
:param dict(str, str) param: request body (required)
:return: None
If the method is called asynchronously,
returns the request thread.
@@ -1167,7 +1167,7 @@ class FakeApi(object):
local_var_params = locals()
all_params = ['request_body'] # noqa: E501
all_params = ['param'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
@@ -1181,10 +1181,10 @@ class FakeApi(object):
)
local_var_params[key] = val
del local_var_params['kwargs']
# verify the required parameter 'request_body' is set
if ('request_body' not in local_var_params or
local_var_params['request_body'] is None):
raise ValueError("Missing the required parameter `request_body` when calling `test_inline_additional_properties`") # noqa: E501
# verify the required parameter 'param' is set
if ('param' not in local_var_params or
local_var_params['param'] is None):
raise ValueError("Missing the required parameter `param` when calling `test_inline_additional_properties`") # noqa: E501
collection_formats = {}
@@ -1198,8 +1198,8 @@ class FakeApi(object):
local_var_files = {}
body_params = None
if 'request_body' in local_var_params:
body_params = local_var_params['request_body']
if 'param' in local_var_params:
body_params = local_var_params['param']
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json']) # noqa: E501

View File

@@ -32,39 +32,39 @@ class FakeClassnameTags123Api(object):
api_client = ApiClient()
self.api_client = api_client
def test_classname(self, client, **kwargs): # noqa: E501
def test_classname(self, body, **kwargs): # noqa: E501
"""To test class name in snake case # noqa: E501
To test class name in snake case # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.test_classname(client, async_req=True)
>>> thread = api.test_classname(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param Client client: client model (required)
:param Client body: client model (required)
:return: Client
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.test_classname_with_http_info(client, **kwargs) # noqa: E501
return self.test_classname_with_http_info(body, **kwargs) # noqa: E501
else:
(data) = self.test_classname_with_http_info(client, **kwargs) # noqa: E501
(data) = self.test_classname_with_http_info(body, **kwargs) # noqa: E501
return data
def test_classname_with_http_info(self, client, **kwargs): # noqa: E501
def test_classname_with_http_info(self, body, **kwargs): # noqa: E501
"""To test class name in snake case # noqa: E501
To test class name in snake case # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.test_classname_with_http_info(client, async_req=True)
>>> thread = api.test_classname_with_http_info(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param Client client: client model (required)
:param Client body: client model (required)
:return: Client
If the method is called asynchronously,
returns the request thread.
@@ -72,7 +72,7 @@ class FakeClassnameTags123Api(object):
local_var_params = locals()
all_params = ['client'] # noqa: E501
all_params = ['body'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
@@ -86,10 +86,10 @@ class FakeClassnameTags123Api(object):
)
local_var_params[key] = val
del local_var_params['kwargs']
# verify the required parameter 'client' is set
if ('client' not in local_var_params or
local_var_params['client'] is None):
raise ValueError("Missing the required parameter `client` when calling `test_classname`") # noqa: E501
# verify the required parameter 'body' is set
if ('body' not in local_var_params or
local_var_params['body'] is None):
raise ValueError("Missing the required parameter `body` when calling `test_classname`") # noqa: E501
collection_formats = {}
@@ -103,8 +103,8 @@ class FakeClassnameTags123Api(object):
local_var_files = {}
body_params = None
if 'client' in local_var_params:
body_params = local_var_params['client']
if 'body' in local_var_params:
body_params = local_var_params['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']) # noqa: E501

View File

@@ -32,37 +32,37 @@ class PetApi(object):
api_client = ApiClient()
self.api_client = api_client
def add_pet(self, pet, **kwargs): # noqa: E501
def add_pet(self, body, **kwargs): # noqa: E501
"""Add a new pet to the store # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.add_pet(pet, async_req=True)
>>> thread = api.add_pet(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param Pet pet: Pet object that needs to be added to the store (required)
:param Pet body: Pet object that needs to be added to the store (required)
:return: None
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.add_pet_with_http_info(pet, **kwargs) # noqa: E501
return self.add_pet_with_http_info(body, **kwargs) # noqa: E501
else:
(data) = self.add_pet_with_http_info(pet, **kwargs) # noqa: E501
(data) = self.add_pet_with_http_info(body, **kwargs) # noqa: E501
return data
def add_pet_with_http_info(self, pet, **kwargs): # noqa: E501
def add_pet_with_http_info(self, body, **kwargs): # noqa: E501
"""Add a new pet to the store # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.add_pet_with_http_info(pet, async_req=True)
>>> thread = api.add_pet_with_http_info(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param Pet pet: Pet object that needs to be added to the store (required)
:param Pet body: Pet object that needs to be added to the store (required)
:return: None
If the method is called asynchronously,
returns the request thread.
@@ -70,7 +70,7 @@ class PetApi(object):
local_var_params = locals()
all_params = ['pet'] # noqa: E501
all_params = ['body'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
@@ -84,10 +84,10 @@ class PetApi(object):
)
local_var_params[key] = val
del local_var_params['kwargs']
# verify the required parameter 'pet' is set
if ('pet' not in local_var_params or
local_var_params['pet'] is None):
raise ValueError("Missing the required parameter `pet` when calling `add_pet`") # noqa: E501
# verify the required parameter 'body' is set
if ('body' not in local_var_params or
local_var_params['body'] is None):
raise ValueError("Missing the required parameter `body` when calling `add_pet`") # noqa: E501
collection_formats = {}
@@ -101,8 +101,8 @@ class PetApi(object):
local_var_files = {}
body_params = None
if 'pet' in local_var_params:
body_params = local_var_params['pet']
if 'body' in local_var_params:
body_params = local_var_params['body']
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json', 'application/xml']) # noqa: E501
@@ -510,37 +510,37 @@ class PetApi(object):
_request_timeout=local_var_params.get('_request_timeout'),
collection_formats=collection_formats)
def update_pet(self, pet, **kwargs): # noqa: E501
def update_pet(self, body, **kwargs): # noqa: E501
"""Update an existing pet # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.update_pet(pet, async_req=True)
>>> thread = api.update_pet(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param Pet pet: Pet object that needs to be added to the store (required)
:param Pet body: Pet object that needs to be added to the store (required)
:return: None
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.update_pet_with_http_info(pet, **kwargs) # noqa: E501
return self.update_pet_with_http_info(body, **kwargs) # noqa: E501
else:
(data) = self.update_pet_with_http_info(pet, **kwargs) # noqa: E501
(data) = self.update_pet_with_http_info(body, **kwargs) # noqa: E501
return data
def update_pet_with_http_info(self, pet, **kwargs): # noqa: E501
def update_pet_with_http_info(self, body, **kwargs): # noqa: E501
"""Update an existing pet # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.update_pet_with_http_info(pet, async_req=True)
>>> thread = api.update_pet_with_http_info(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param Pet pet: Pet object that needs to be added to the store (required)
:param Pet body: Pet object that needs to be added to the store (required)
:return: None
If the method is called asynchronously,
returns the request thread.
@@ -548,7 +548,7 @@ class PetApi(object):
local_var_params = locals()
all_params = ['pet'] # noqa: E501
all_params = ['body'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
@@ -562,10 +562,10 @@ class PetApi(object):
)
local_var_params[key] = val
del local_var_params['kwargs']
# verify the required parameter 'pet' is set
if ('pet' not in local_var_params or
local_var_params['pet'] is None):
raise ValueError("Missing the required parameter `pet` when calling `update_pet`") # noqa: E501
# verify the required parameter 'body' is set
if ('body' not in local_var_params or
local_var_params['body'] is None):
raise ValueError("Missing the required parameter `body` when calling `update_pet`") # noqa: E501
collection_formats = {}
@@ -579,8 +579,8 @@ class PetApi(object):
local_var_files = {}
body_params = None
if 'pet' in local_var_params:
body_params = local_var_params['pet']
if 'body' in local_var_params:
body_params = local_var_params['body']
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json', 'application/xml']) # noqa: E501

View File

@@ -312,37 +312,37 @@ class StoreApi(object):
_request_timeout=local_var_params.get('_request_timeout'),
collection_formats=collection_formats)
def place_order(self, order, **kwargs): # noqa: E501
def place_order(self, body, **kwargs): # noqa: E501
"""Place an order for a pet # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.place_order(order, async_req=True)
>>> thread = api.place_order(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param Order order: order placed for purchasing the pet (required)
:param Order body: order placed for purchasing the pet (required)
:return: Order
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.place_order_with_http_info(order, **kwargs) # noqa: E501
return self.place_order_with_http_info(body, **kwargs) # noqa: E501
else:
(data) = self.place_order_with_http_info(order, **kwargs) # noqa: E501
(data) = self.place_order_with_http_info(body, **kwargs) # noqa: E501
return data
def place_order_with_http_info(self, order, **kwargs): # noqa: E501
def place_order_with_http_info(self, body, **kwargs): # noqa: E501
"""Place an order for a pet # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.place_order_with_http_info(order, async_req=True)
>>> thread = api.place_order_with_http_info(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param Order order: order placed for purchasing the pet (required)
:param Order body: order placed for purchasing the pet (required)
:return: Order
If the method is called asynchronously,
returns the request thread.
@@ -350,7 +350,7 @@ class StoreApi(object):
local_var_params = locals()
all_params = ['order'] # noqa: E501
all_params = ['body'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
@@ -364,10 +364,10 @@ class StoreApi(object):
)
local_var_params[key] = val
del local_var_params['kwargs']
# verify the required parameter 'order' is set
if ('order' not in local_var_params or
local_var_params['order'] is None):
raise ValueError("Missing the required parameter `order` when calling `place_order`") # noqa: E501
# verify the required parameter 'body' is set
if ('body' not in local_var_params or
local_var_params['body'] is None):
raise ValueError("Missing the required parameter `body` when calling `place_order`") # noqa: E501
collection_formats = {}
@@ -381,8 +381,8 @@ class StoreApi(object):
local_var_files = {}
body_params = None
if 'order' in local_var_params:
body_params = local_var_params['order']
if 'body' in local_var_params:
body_params = local_var_params['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/xml', 'application/json']) # noqa: E501

View File

@@ -32,39 +32,39 @@ class UserApi(object):
api_client = ApiClient()
self.api_client = api_client
def create_user(self, user, **kwargs): # noqa: E501
def create_user(self, body, **kwargs): # noqa: E501
"""Create user # noqa: E501
This can only be done by the logged in user. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_user(user, async_req=True)
>>> thread = api.create_user(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param User user: Created user object (required)
:param User body: Created user object (required)
:return: None
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.create_user_with_http_info(user, **kwargs) # noqa: E501
return self.create_user_with_http_info(body, **kwargs) # noqa: E501
else:
(data) = self.create_user_with_http_info(user, **kwargs) # noqa: E501
(data) = self.create_user_with_http_info(body, **kwargs) # noqa: E501
return data
def create_user_with_http_info(self, user, **kwargs): # noqa: E501
def create_user_with_http_info(self, body, **kwargs): # noqa: E501
"""Create user # noqa: E501
This can only be done by the logged in user. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_user_with_http_info(user, async_req=True)
>>> thread = api.create_user_with_http_info(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param User user: Created user object (required)
:param User body: Created user object (required)
:return: None
If the method is called asynchronously,
returns the request thread.
@@ -72,7 +72,7 @@ class UserApi(object):
local_var_params = locals()
all_params = ['user'] # noqa: E501
all_params = ['body'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
@@ -86,10 +86,10 @@ class UserApi(object):
)
local_var_params[key] = val
del local_var_params['kwargs']
# verify the required parameter 'user' is set
if ('user' not in local_var_params or
local_var_params['user'] is None):
raise ValueError("Missing the required parameter `user` when calling `create_user`") # noqa: E501
# verify the required parameter 'body' is set
if ('body' not in local_var_params or
local_var_params['body'] is None):
raise ValueError("Missing the required parameter `body` when calling `create_user`") # noqa: E501
collection_formats = {}
@@ -103,8 +103,8 @@ class UserApi(object):
local_var_files = {}
body_params = None
if 'user' in local_var_params:
body_params = local_var_params['user']
if 'body' in local_var_params:
body_params = local_var_params['body']
# Authentication setting
auth_settings = [] # noqa: E501
@@ -124,37 +124,37 @@ class UserApi(object):
_request_timeout=local_var_params.get('_request_timeout'),
collection_formats=collection_formats)
def create_users_with_array_input(self, user, **kwargs): # noqa: E501
def create_users_with_array_input(self, body, **kwargs): # noqa: E501
"""Creates list of users with given input array # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_users_with_array_input(user, async_req=True)
>>> thread = api.create_users_with_array_input(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param list[User] user: List of user object (required)
:param list[User] body: List of user object (required)
:return: None
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.create_users_with_array_input_with_http_info(user, **kwargs) # noqa: E501
return self.create_users_with_array_input_with_http_info(body, **kwargs) # noqa: E501
else:
(data) = self.create_users_with_array_input_with_http_info(user, **kwargs) # noqa: E501
(data) = self.create_users_with_array_input_with_http_info(body, **kwargs) # noqa: E501
return data
def create_users_with_array_input_with_http_info(self, user, **kwargs): # noqa: E501
def create_users_with_array_input_with_http_info(self, body, **kwargs): # noqa: E501
"""Creates list of users with given input array # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_users_with_array_input_with_http_info(user, async_req=True)
>>> thread = api.create_users_with_array_input_with_http_info(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param list[User] user: List of user object (required)
:param list[User] body: List of user object (required)
:return: None
If the method is called asynchronously,
returns the request thread.
@@ -162,7 +162,7 @@ class UserApi(object):
local_var_params = locals()
all_params = ['user'] # noqa: E501
all_params = ['body'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
@@ -176,10 +176,10 @@ class UserApi(object):
)
local_var_params[key] = val
del local_var_params['kwargs']
# verify the required parameter 'user' is set
if ('user' not in local_var_params or
local_var_params['user'] is None):
raise ValueError("Missing the required parameter `user` when calling `create_users_with_array_input`") # noqa: E501
# verify the required parameter 'body' is set
if ('body' not in local_var_params or
local_var_params['body'] is None):
raise ValueError("Missing the required parameter `body` when calling `create_users_with_array_input`") # noqa: E501
collection_formats = {}
@@ -193,8 +193,8 @@ class UserApi(object):
local_var_files = {}
body_params = None
if 'user' in local_var_params:
body_params = local_var_params['user']
if 'body' in local_var_params:
body_params = local_var_params['body']
# Authentication setting
auth_settings = [] # noqa: E501
@@ -214,37 +214,37 @@ class UserApi(object):
_request_timeout=local_var_params.get('_request_timeout'),
collection_formats=collection_formats)
def create_users_with_list_input(self, user, **kwargs): # noqa: E501
def create_users_with_list_input(self, body, **kwargs): # noqa: E501
"""Creates list of users with given input array # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_users_with_list_input(user, async_req=True)
>>> thread = api.create_users_with_list_input(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param list[User] user: List of user object (required)
:param list[User] body: List of user object (required)
:return: None
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.create_users_with_list_input_with_http_info(user, **kwargs) # noqa: E501
return self.create_users_with_list_input_with_http_info(body, **kwargs) # noqa: E501
else:
(data) = self.create_users_with_list_input_with_http_info(user, **kwargs) # noqa: E501
(data) = self.create_users_with_list_input_with_http_info(body, **kwargs) # noqa: E501
return data
def create_users_with_list_input_with_http_info(self, user, **kwargs): # noqa: E501
def create_users_with_list_input_with_http_info(self, body, **kwargs): # noqa: E501
"""Creates list of users with given input array # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_users_with_list_input_with_http_info(user, async_req=True)
>>> thread = api.create_users_with_list_input_with_http_info(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param list[User] user: List of user object (required)
:param list[User] body: List of user object (required)
:return: None
If the method is called asynchronously,
returns the request thread.
@@ -252,7 +252,7 @@ class UserApi(object):
local_var_params = locals()
all_params = ['user'] # noqa: E501
all_params = ['body'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
@@ -266,10 +266,10 @@ class UserApi(object):
)
local_var_params[key] = val
del local_var_params['kwargs']
# verify the required parameter 'user' is set
if ('user' not in local_var_params or
local_var_params['user'] is None):
raise ValueError("Missing the required parameter `user` when calling `create_users_with_list_input`") # noqa: E501
# verify the required parameter 'body' is set
if ('body' not in local_var_params or
local_var_params['body'] is None):
raise ValueError("Missing the required parameter `body` when calling `create_users_with_list_input`") # noqa: E501
collection_formats = {}
@@ -283,8 +283,8 @@ class UserApi(object):
local_var_files = {}
body_params = None
if 'user' in local_var_params:
body_params = local_var_params['user']
if 'body' in local_var_params:
body_params = local_var_params['body']
# Authentication setting
auth_settings = [] # noqa: E501
@@ -674,41 +674,41 @@ class UserApi(object):
_request_timeout=local_var_params.get('_request_timeout'),
collection_formats=collection_formats)
def update_user(self, username, user, **kwargs): # noqa: E501
def update_user(self, username, body, **kwargs): # noqa: E501
"""Updated user # noqa: E501
This can only be done by the logged in user. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.update_user(username, user, async_req=True)
>>> thread = api.update_user(username, body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str username: name that need to be deleted (required)
:param User user: Updated user object (required)
:param User body: Updated user object (required)
:return: None
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.update_user_with_http_info(username, user, **kwargs) # noqa: E501
return self.update_user_with_http_info(username, body, **kwargs) # noqa: E501
else:
(data) = self.update_user_with_http_info(username, user, **kwargs) # noqa: E501
(data) = self.update_user_with_http_info(username, body, **kwargs) # noqa: E501
return data
def update_user_with_http_info(self, username, user, **kwargs): # noqa: E501
def update_user_with_http_info(self, username, body, **kwargs): # noqa: E501
"""Updated user # noqa: E501
This can only be done by the logged in user. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.update_user_with_http_info(username, user, async_req=True)
>>> thread = api.update_user_with_http_info(username, body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str username: name that need to be deleted (required)
:param User user: Updated user object (required)
:param User body: Updated user object (required)
:return: None
If the method is called asynchronously,
returns the request thread.
@@ -716,7 +716,7 @@ class UserApi(object):
local_var_params = locals()
all_params = ['username', 'user'] # noqa: E501
all_params = ['username', 'body'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
@@ -734,10 +734,10 @@ class UserApi(object):
if ('username' not in local_var_params or
local_var_params['username'] is None):
raise ValueError("Missing the required parameter `username` when calling `update_user`") # noqa: E501
# verify the required parameter 'user' is set
if ('user' not in local_var_params or
local_var_params['user'] is None):
raise ValueError("Missing the required parameter `user` when calling `update_user`") # noqa: E501
# verify the required parameter 'body' is set
if ('body' not in local_var_params or
local_var_params['body'] is None):
raise ValueError("Missing the required parameter `body` when calling `update_user`") # noqa: E501
collection_formats = {}
@@ -753,8 +753,8 @@ class UserApi(object):
local_var_files = {}
body_params = None
if 'user' in local_var_params:
body_params = local_var_params['user']
if 'body' in local_var_params:
body_params = local_var_params['body']
# Authentication setting
auth_settings = [] # noqa: E501

View File

@@ -47,4 +47,6 @@ from petstore_api.models.pet import Pet
from petstore_api.models.read_only_first import ReadOnlyFirst
from petstore_api.models.special_model_name import SpecialModelName
from petstore_api.models.tag import Tag
from petstore_api.models.type_holder_default import TypeHolderDefault
from petstore_api.models.type_holder_example import TypeHolderExample
from petstore_api.models.user import User

View File

@@ -50,7 +50,7 @@ class Animal(object):
self._class_name = None
self._color = None
self.discriminator = 'className'
self.discriminator = 'class_name'
self.class_name = class_name
if color is not None:
@@ -102,7 +102,8 @@ class Animal(object):
def get_real_child_model(self, data):
"""Returns the real base class specified by the discriminator"""
discriminator_value = data[self.discriminator]
discriminator_key = self.attribute_map[self.discriminator]
discriminator_value = data[discriminator_key]
return self.discriminator_value_class_map.get(discriminator_value)
def to_dict(self):

View File

@@ -48,7 +48,7 @@ class Pet(object):
'status': 'status'
}
def __init__(self, id=None, category=None, name=None, photo_urls=None, tags=None, status=None): # noqa: E501
def __init__(self, id=None, category=None, name='doggie', photo_urls=None, tags=None, status=None): # noqa: E501
"""Pet - a model defined in OpenAPI""" # noqa: E501
self._id = None

View File

@@ -0,0 +1,221 @@
# coding: utf-8
"""
OpenAPI Petstore
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501
OpenAPI spec version: 1.0.0
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
class TypeHolderDefault(object):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
"""
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
openapi_types = {
'string_item': 'str',
'number_item': 'float',
'integer_item': 'int',
'bool_item': 'bool',
'array_item': 'list[int]'
}
attribute_map = {
'string_item': 'string_item',
'number_item': 'number_item',
'integer_item': 'integer_item',
'bool_item': 'bool_item',
'array_item': 'array_item'
}
def __init__(self, string_item='what', number_item=None, integer_item=None, bool_item=True, array_item=None): # noqa: E501
"""TypeHolderDefault - a model defined in OpenAPI""" # noqa: E501
self._string_item = None
self._number_item = None
self._integer_item = None
self._bool_item = None
self._array_item = None
self.discriminator = None
self.string_item = string_item
self.number_item = number_item
self.integer_item = integer_item
self.bool_item = bool_item
self.array_item = array_item
@property
def string_item(self):
"""Gets the string_item of this TypeHolderDefault. # noqa: E501
:return: The string_item of this TypeHolderDefault. # noqa: E501
:rtype: str
"""
return self._string_item
@string_item.setter
def string_item(self, string_item):
"""Sets the string_item of this TypeHolderDefault.
:param string_item: The string_item of this TypeHolderDefault. # noqa: E501
:type: str
"""
if string_item is None:
raise ValueError("Invalid value for `string_item`, must not be `None`") # noqa: E501
self._string_item = string_item
@property
def number_item(self):
"""Gets the number_item of this TypeHolderDefault. # noqa: E501
:return: The number_item of this TypeHolderDefault. # noqa: E501
:rtype: float
"""
return self._number_item
@number_item.setter
def number_item(self, number_item):
"""Sets the number_item of this TypeHolderDefault.
:param number_item: The number_item of this TypeHolderDefault. # noqa: E501
:type: float
"""
if number_item is None:
raise ValueError("Invalid value for `number_item`, must not be `None`") # noqa: E501
self._number_item = number_item
@property
def integer_item(self):
"""Gets the integer_item of this TypeHolderDefault. # noqa: E501
:return: The integer_item of this TypeHolderDefault. # noqa: E501
:rtype: int
"""
return self._integer_item
@integer_item.setter
def integer_item(self, integer_item):
"""Sets the integer_item of this TypeHolderDefault.
:param integer_item: The integer_item of this TypeHolderDefault. # noqa: E501
:type: int
"""
if integer_item is None:
raise ValueError("Invalid value for `integer_item`, must not be `None`") # noqa: E501
self._integer_item = integer_item
@property
def bool_item(self):
"""Gets the bool_item of this TypeHolderDefault. # noqa: E501
:return: The bool_item of this TypeHolderDefault. # noqa: E501
:rtype: bool
"""
return self._bool_item
@bool_item.setter
def bool_item(self, bool_item):
"""Sets the bool_item of this TypeHolderDefault.
:param bool_item: The bool_item of this TypeHolderDefault. # noqa: E501
:type: bool
"""
if bool_item is None:
raise ValueError("Invalid value for `bool_item`, must not be `None`") # noqa: E501
self._bool_item = bool_item
@property
def array_item(self):
"""Gets the array_item of this TypeHolderDefault. # noqa: E501
:return: The array_item of this TypeHolderDefault. # noqa: E501
:rtype: list[int]
"""
return self._array_item
@array_item.setter
def array_item(self, array_item):
"""Sets the array_item of this TypeHolderDefault.
:param array_item: The array_item of this TypeHolderDefault. # noqa: E501
:type: list[int]
"""
if array_item is None:
raise ValueError("Invalid value for `array_item`, must not be `None`") # noqa: E501
self._array_item = array_item
def to_dict(self):
"""Returns the model properties as a dict"""
result = {}
for attr, _ in six.iteritems(self.openapi_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
))
elif hasattr(value, "to_dict"):
result[attr] = value.to_dict()
elif isinstance(value, dict):
result[attr] = dict(map(
lambda item: (item[0], item[1].to_dict())
if hasattr(item[1], "to_dict") else item,
value.items()
))
else:
result[attr] = value
return result
def to_str(self):
"""Returns the string representation of the model"""
return pprint.pformat(self.to_dict())
def __repr__(self):
"""For `print` and `pprint`"""
return self.to_str()
def __eq__(self, other):
"""Returns true if both objects are equal"""
if not isinstance(other, TypeHolderDefault):
return False
return self.__dict__ == other.__dict__
def __ne__(self, other):
"""Returns true if both objects are not equal"""
return not self == other

View File

@@ -0,0 +1,221 @@
# coding: utf-8
"""
OpenAPI Petstore
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501
OpenAPI spec version: 1.0.0
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
class TypeHolderExample(object):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
"""
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
openapi_types = {
'string_item': 'str',
'number_item': 'float',
'integer_item': 'int',
'bool_item': 'bool',
'array_item': 'list[int]'
}
attribute_map = {
'string_item': 'string_item',
'number_item': 'number_item',
'integer_item': 'integer_item',
'bool_item': 'bool_item',
'array_item': 'array_item'
}
def __init__(self, string_item='what', number_item=1.234, integer_item=-2, bool_item=True, array_item=[0, 1, 2, 3]): # noqa: E501
"""TypeHolderExample - a model defined in OpenAPI""" # noqa: E501
self._string_item = None
self._number_item = None
self._integer_item = None
self._bool_item = None
self._array_item = None
self.discriminator = None
self.string_item = string_item
self.number_item = number_item
self.integer_item = integer_item
self.bool_item = bool_item
self.array_item = array_item
@property
def string_item(self):
"""Gets the string_item of this TypeHolderExample. # noqa: E501
:return: The string_item of this TypeHolderExample. # noqa: E501
:rtype: str
"""
return self._string_item
@string_item.setter
def string_item(self, string_item):
"""Sets the string_item of this TypeHolderExample.
:param string_item: The string_item of this TypeHolderExample. # noqa: E501
:type: str
"""
if string_item is None:
raise ValueError("Invalid value for `string_item`, must not be `None`") # noqa: E501
self._string_item = string_item
@property
def number_item(self):
"""Gets the number_item of this TypeHolderExample. # noqa: E501
:return: The number_item of this TypeHolderExample. # noqa: E501
:rtype: float
"""
return self._number_item
@number_item.setter
def number_item(self, number_item):
"""Sets the number_item of this TypeHolderExample.
:param number_item: The number_item of this TypeHolderExample. # noqa: E501
:type: float
"""
if number_item is None:
raise ValueError("Invalid value for `number_item`, must not be `None`") # noqa: E501
self._number_item = number_item
@property
def integer_item(self):
"""Gets the integer_item of this TypeHolderExample. # noqa: E501
:return: The integer_item of this TypeHolderExample. # noqa: E501
:rtype: int
"""
return self._integer_item
@integer_item.setter
def integer_item(self, integer_item):
"""Sets the integer_item of this TypeHolderExample.
:param integer_item: The integer_item of this TypeHolderExample. # noqa: E501
:type: int
"""
if integer_item is None:
raise ValueError("Invalid value for `integer_item`, must not be `None`") # noqa: E501
self._integer_item = integer_item
@property
def bool_item(self):
"""Gets the bool_item of this TypeHolderExample. # noqa: E501
:return: The bool_item of this TypeHolderExample. # noqa: E501
:rtype: bool
"""
return self._bool_item
@bool_item.setter
def bool_item(self, bool_item):
"""Sets the bool_item of this TypeHolderExample.
:param bool_item: The bool_item of this TypeHolderExample. # noqa: E501
:type: bool
"""
if bool_item is None:
raise ValueError("Invalid value for `bool_item`, must not be `None`") # noqa: E501
self._bool_item = bool_item
@property
def array_item(self):
"""Gets the array_item of this TypeHolderExample. # noqa: E501
:return: The array_item of this TypeHolderExample. # noqa: E501
:rtype: list[int]
"""
return self._array_item
@array_item.setter
def array_item(self, array_item):
"""Sets the array_item of this TypeHolderExample.
:param array_item: The array_item of this TypeHolderExample. # noqa: E501
:type: list[int]
"""
if array_item is None:
raise ValueError("Invalid value for `array_item`, must not be `None`") # noqa: E501
self._array_item = array_item
def to_dict(self):
"""Returns the model properties as a dict"""
result = {}
for attr, _ in six.iteritems(self.openapi_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
))
elif hasattr(value, "to_dict"):
result[attr] = value.to_dict()
elif isinstance(value, dict):
result[attr] = dict(map(
lambda item: (item[0], item[1].to_dict())
if hasattr(item[1], "to_dict") else item,
value.items()
))
else:
result[attr] = value
return result
def to_str(self):
"""Returns the string representation of the model"""
return pprint.pformat(self.to_dict())
def __repr__(self):
"""For `print` and `pprint`"""
return self.to_str()
def __eq__(self, other):
"""Returns true if both objects are equal"""
if not isinstance(other, TypeHolderExample):
return False
return self.__dict__ == other.__dict__
def __ne__(self, other):
"""Returns true if both objects are not equal"""
return not self == other

View File

@@ -0,0 +1,49 @@
# coding: utf-8
"""
OpenAPI Petstore
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501
OpenAPI spec version: 1.0.0
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import unittest
import petstore_api
from petstore_api.models.type_holder_default import TypeHolderDefault # noqa: E501
from petstore_api.rest import ApiException
class TestTypeHolderDefault(unittest.TestCase):
"""TypeHolderDefault unit test stubs"""
def setUp(self):
pass
def tearDown(self):
pass
def testTypeHolderDefault(self):
"""Test TypeHolderDefault"""
# required_vars are set to None now until swagger-parser/swagger-core fixes
# https://github.com/swagger-api/swagger-parser/issues/971
required_vars = ['number_item', 'integer_item', 'array_item']
sample_values = [5.67, 4, [-5, 2, -6]]
assigned_variables = {}
for index, required_var in enumerate(required_vars):
with self.assertRaises(ValueError):
model = TypeHolderDefault(**assigned_variables)
assigned_variables[required_var] = sample_values[index]
# assigned_variables is fully set, all required variables passed in
model = TypeHolderDefault(**assigned_variables)
self.assertEqual(model.string_item, 'what')
self.assertEqual(model.bool_item, True)
if __name__ == '__main__':
unittest.main()

View File

@@ -0,0 +1,42 @@
# coding: utf-8
"""
OpenAPI Petstore
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501
OpenAPI spec version: 1.0.0
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import unittest
import petstore_api
from petstore_api.models.type_holder_example import TypeHolderExample # noqa: E501
from petstore_api.rest import ApiException
class TestTypeHolderExample(unittest.TestCase):
"""TypeHolderExample unit test stubs"""
def setUp(self):
pass
def tearDown(self):
pass
def testTypeHolderExample(self):
"""Test TypeHolderExample"""
model = TypeHolderExample()
self.assertEqual(model.string_item, 'what')
self.assertEqual(model.number_item, 1.234)
self.assertEqual(model.integer_item, -2)
self.assertEqual(model.bool_item, True)
self.assertEqual(model.array_item, [0, 1, 2, 3])
if __name__ == '__main__':
unittest.main()

View File

@@ -8,6 +8,8 @@ $ pip install nose (optional)
$ cd OpenAPIPetstore-python
$ nosetests -v
"""
from collections import namedtuple
import json
import os
import time
import unittest
@@ -16,11 +18,14 @@ import datetime
import petstore_api
MockResponse = namedtuple('MockResponse', 'data')
class DeserializationTests(unittest.TestCase):
def setUp(self):
self.api_client = petstore_api.ApiClient()
self.deserialize = self.api_client._ApiClient__deserialize
self.deserialize = self.api_client.deserialize
def test_enum_test(self):
""" deserialize dict(str, Enum_Test) """
@@ -33,8 +38,9 @@ class DeserializationTests(unittest.TestCase):
"outerEnum": "placed"
}
}
response = MockResponse(data=json.dumps(data))
deserialized = self.deserialize(data, 'dict(str, EnumTest)')
deserialized = self.deserialize(response, 'dict(str, EnumTest)')
self.assertTrue(isinstance(deserialized, dict))
self.assertTrue(isinstance(deserialized['enum_test'], petstore_api.EnumTest))
self.assertEqual(deserialized['enum_test'],
@@ -66,8 +72,9 @@ class DeserializationTests(unittest.TestCase):
"status": "available"
}
}
response = MockResponse(data=json.dumps(data))
deserialized = self.deserialize(data, 'dict(str, Pet)')
deserialized = self.deserialize(response, 'dict(str, Pet)')
self.assertTrue(isinstance(deserialized, dict))
self.assertTrue(isinstance(deserialized['pet'], petstore_api.Pet))
@@ -81,8 +88,9 @@ class DeserializationTests(unittest.TestCase):
"bread": "Jack Russel Terrier"
}
}
response = MockResponse(data=json.dumps(data))
deserialized = self.deserialize(data, 'dict(str, Animal)')
deserialized = self.deserialize(response, 'dict(str, Animal)')
self.assertTrue(isinstance(deserialized, dict))
self.assertTrue(isinstance(deserialized['dog'], petstore_api.Dog))
@@ -91,27 +99,34 @@ class DeserializationTests(unittest.TestCase):
data = {
'integer': 1
}
response = MockResponse(data=json.dumps(data))
deserialized = self.deserialize(data, 'dict(str, int)')
deserialized = self.deserialize(response, 'dict(str, int)')
self.assertTrue(isinstance(deserialized, dict))
self.assertTrue(isinstance(deserialized['integer'], int))
def test_deserialize_str(self):
""" deserialize str """
data = "test str"
deserialized = self.deserialize(data, "str")
response = MockResponse(data=json.dumps(data))
deserialized = self.deserialize(response, "str")
self.assertTrue(isinstance(deserialized, str))
def test_deserialize_date(self):
""" deserialize date """
data = "1997-07-16"
deserialized = self.deserialize(data, "date")
response = MockResponse(data=json.dumps(data))
deserialized = self.deserialize(response, "date")
self.assertTrue(isinstance(deserialized, datetime.date))
def test_deserialize_datetime(self):
""" deserialize datetime """
data = "1997-07-16T19:20:30.45+01:00"
deserialized = self.deserialize(data, "datetime")
response = MockResponse(data=json.dumps(data))
deserialized = self.deserialize(response, "datetime")
self.assertTrue(isinstance(deserialized, datetime.datetime))
def test_deserialize_pet(self):
@@ -134,7 +149,9 @@ class DeserializationTests(unittest.TestCase):
],
"status": "available"
}
deserialized = self.deserialize(data, "Pet")
response = MockResponse(data=json.dumps(data))
deserialized = self.deserialize(response, "Pet")
self.assertTrue(isinstance(deserialized, petstore_api.Pet))
self.assertEqual(deserialized.id, 0)
self.assertEqual(deserialized.name, "doggie")
@@ -182,7 +199,9 @@ class DeserializationTests(unittest.TestCase):
],
"status": "available"
}]
deserialized = self.deserialize(data, "list[Pet]")
response = MockResponse(data=json.dumps(data))
deserialized = self.deserialize(response, "list[Pet]")
self.assertTrue(isinstance(deserialized, list))
self.assertTrue(isinstance(deserialized[0], petstore_api.Pet))
self.assertEqual(deserialized[0].id, 0)
@@ -197,8 +216,9 @@ class DeserializationTests(unittest.TestCase):
"bar": 1
}
}
response = MockResponse(data=json.dumps(data))
deserialized = self.deserialize(data, "dict(str, dict(str, int))")
deserialized = self.deserialize(response, "dict(str, dict(str, int))")
self.assertTrue(isinstance(deserialized, dict))
self.assertTrue(isinstance(deserialized["foo"], dict))
self.assertTrue(isinstance(deserialized["foo"]["bar"], int))
@@ -206,13 +226,16 @@ class DeserializationTests(unittest.TestCase):
def test_deserialize_nested_list(self):
""" deserialize list[list[str]] """
data = [["foo"]]
response = MockResponse(data=json.dumps(data))
deserialized = self.deserialize(data, "list[list[str]]")
deserialized = self.deserialize(response, "list[list[str]]")
self.assertTrue(isinstance(deserialized, list))
self.assertTrue(isinstance(deserialized[0], list))
self.assertTrue(isinstance(deserialized[0][0], str))
def test_deserialize_none(self):
""" deserialize None """
deserialized = self.deserialize(None, "datetime")
response = MockResponse(data=json.dumps(None))
deserialized = self.deserialize(response, "datetime")
self.assertIsNone(deserialized)