[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

@@ -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