forked from loafle/openapi-generator-original
Adds exceptions module to python clients (#2393)
* Adds python client exceptions module and updates samples * Adds python style updates, detects integers in exception paths with six * Updates to ruby samples which circleci needs * Removes petstore-security-tests samples * readme char removal (triggers ci tests) * Readme fix, triggers CI tests * Updates python client sample
This commit is contained in:
committed by
William Cheng
parent
45ad72b032
commit
b1955f3517
@@ -238,6 +238,7 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
|
||||
supportingFiles.add(new SupportingFile("__init__package.mustache", packagePath(), "__init__.py"));
|
||||
supportingFiles.add(new SupportingFile("__init__model.mustache", packagePath() + File.separatorChar + modelPackage, "__init__.py"));
|
||||
supportingFiles.add(new SupportingFile("__init__api.mustache", packagePath() + File.separatorChar + apiPackage, "__init__.py"));
|
||||
supportingFiles.add(new SupportingFile("exceptions.mustache", packagePath(), "exceptions.py"));
|
||||
|
||||
if (Boolean.FALSE.equals(excludeTests)) {
|
||||
supportingFiles.add(new SupportingFile("__init__test.mustache", testFolder, "__init__.py"));
|
||||
|
||||
@@ -14,6 +14,11 @@ __version__ = "{{packageVersion}}"
|
||||
# import ApiClient
|
||||
from {{packageName}}.api_client import ApiClient
|
||||
from {{packageName}}.configuration import Configuration
|
||||
from {{packageName}}.exceptions import OpenApiException
|
||||
from {{packageName}}.exceptions import ApiTypeError
|
||||
from {{packageName}}.exceptions import ApiValueError
|
||||
from {{packageName}}.exceptions import ApiKeyError
|
||||
from {{packageName}}.exceptions import ApiException
|
||||
# import models into sdk package
|
||||
{{#models}}{{#model}}from {{modelPackage}}.{{classFilename}} import {{classname}}
|
||||
{{/model}}{{/models}}
|
||||
{{/model}}{{/models}}
|
||||
|
||||
@@ -10,6 +10,10 @@ import re # noqa: F401
|
||||
import six
|
||||
|
||||
from {{packageName}}.api_client import ApiClient
|
||||
from {{packageName}}.exceptions import (
|
||||
ApiTypeError,
|
||||
ApiValueError
|
||||
)
|
||||
|
||||
|
||||
{{#operations}}
|
||||
@@ -87,7 +91,7 @@ class {{classname}}(object):
|
||||
local_var_host = local_var_hosts[0]
|
||||
if kwargs.get('_host_index'):
|
||||
if int(kwags.get('_host_index')) < 0 or int(kawgs.get('_host_index')) >= len(local_var_hosts):
|
||||
raise ValueError("Invalid host index. Must be 0 <= index < %s" % len(local_var_host))
|
||||
raise ApiValueError("Invalid host index. Must be 0 <= index < %s" % len(local_var_host))
|
||||
local_var_host = local_var_hosts[int(kwargs.get('_host_index'))]
|
||||
{{/servers.0}}
|
||||
local_var_params = locals()
|
||||
@@ -100,7 +104,7 @@ class {{classname}}(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params{{#servers.0}} and key != "_host_index"{{/servers.0}}:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method {{operationId}}" % key
|
||||
)
|
||||
@@ -112,7 +116,7 @@ class {{classname}}(object):
|
||||
# verify the required parameter '{{paramName}}' is set
|
||||
if ('{{paramName}}' not in local_var_params or
|
||||
local_var_params['{{paramName}}'] is None):
|
||||
raise ValueError("Missing the required parameter `{{paramName}}` when calling `{{operationId}}`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `{{paramName}}` when calling `{{operationId}}`") # noqa: E501
|
||||
{{/required}}
|
||||
{{/isNullable}}
|
||||
{{/allParams}}
|
||||
@@ -122,34 +126,34 @@ class {{classname}}(object):
|
||||
{{#maxLength}}
|
||||
if ('{{paramName}}' in local_var_params and
|
||||
len(local_var_params['{{paramName}}']) > {{maxLength}}):
|
||||
raise ValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, length must be less than or equal to `{{maxLength}}`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, length must be less than or equal to `{{maxLength}}`") # noqa: E501
|
||||
{{/maxLength}}
|
||||
{{#minLength}}
|
||||
if ('{{paramName}}' in local_var_params and
|
||||
len(local_var_params['{{paramName}}']) < {{minLength}}):
|
||||
raise ValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, length must be greater than or equal to `{{minLength}}`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, length must be greater than or equal to `{{minLength}}`") # noqa: E501
|
||||
{{/minLength}}
|
||||
{{#maximum}}
|
||||
if '{{paramName}}' in local_var_params and local_var_params['{{paramName}}'] >{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{maximum}}: # noqa: E501
|
||||
raise ValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, must be a value less than {{^exclusiveMaximum}}or equal to {{/exclusiveMaximum}}`{{maximum}}`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, must be a value less than {{^exclusiveMaximum}}or equal to {{/exclusiveMaximum}}`{{maximum}}`") # noqa: E501
|
||||
{{/maximum}}
|
||||
{{#minimum}}
|
||||
if '{{paramName}}' in local_var_params and local_var_params['{{paramName}}'] <{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{minimum}}: # noqa: E501
|
||||
raise ValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, must be a value greater than {{^exclusiveMinimum}}or equal to {{/exclusiveMinimum}}`{{minimum}}`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, must be a value greater than {{^exclusiveMinimum}}or equal to {{/exclusiveMinimum}}`{{minimum}}`") # noqa: E501
|
||||
{{/minimum}}
|
||||
{{#pattern}}
|
||||
if '{{paramName}}' in local_var_params and not re.search(r'{{{vendorExtensions.x-regex}}}', local_var_params['{{paramName}}']{{#vendorExtensions.x-modifiers}}{{#-first}}, flags={{/-first}}re.{{.}}{{^-last}} | {{/-last}}{{/vendorExtensions.x-modifiers}}): # noqa: E501
|
||||
raise ValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, must conform to the pattern `{{{pattern}}}`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, must conform to the pattern `{{{pattern}}}`") # noqa: E501
|
||||
{{/pattern}}
|
||||
{{#maxItems}}
|
||||
if ('{{paramName}}' in local_var_params and
|
||||
len(local_var_params['{{paramName}}']) > {{maxItems}}):
|
||||
raise ValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, number of items must be less than or equal to `{{maxItems}}`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, number of items must be less than or equal to `{{maxItems}}`") # noqa: E501
|
||||
{{/maxItems}}
|
||||
{{#minItems}}
|
||||
if ('{{paramName}}' in local_var_params and
|
||||
len(local_var_params['{{paramName}}']) < {{minItems}}):
|
||||
raise ValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, number of items must be greater than or equal to `{{minItems}}`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, number of items must be greater than or equal to `{{minItems}}`") # noqa: E501
|
||||
{{/minItems}}
|
||||
{{/hasValidation}}
|
||||
{{#-last}}
|
||||
|
||||
@@ -20,6 +20,7 @@ import tornado.gen
|
||||
from {{packageName}}.configuration import Configuration
|
||||
import {{modelPackage}}
|
||||
from {{packageName}} import rest
|
||||
from {{packageName}}.exceptions import ApiValueError
|
||||
|
||||
|
||||
class ApiClient(object):
|
||||
@@ -413,7 +414,7 @@ class ApiClient(object):
|
||||
_request_timeout=_request_timeout,
|
||||
body=body)
|
||||
else:
|
||||
raise ValueError(
|
||||
raise ApiValueError(
|
||||
"http method must be `GET`, `HEAD`, `OPTIONS`,"
|
||||
" `POST`, `PATCH`, `PUT` or `DELETE`."
|
||||
)
|
||||
@@ -530,7 +531,7 @@ class ApiClient(object):
|
||||
elif auth_setting['in'] == 'query':
|
||||
querys.append((auth_setting['key'], auth_setting['value']))
|
||||
else:
|
||||
raise ValueError(
|
||||
raise ApiValueError(
|
||||
'Authentication token must be in `query` or `header`'
|
||||
)
|
||||
|
||||
|
||||
@@ -14,6 +14,8 @@ import asyncio
|
||||
# python 2 and python 3 compatibility library
|
||||
from six.moves.urllib.parse import urlencode
|
||||
|
||||
from {{packageName}}.exceptions import ApiException, ApiValueError
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -100,7 +102,7 @@ class RESTClientObject(object):
|
||||
'PATCH', 'OPTIONS']
|
||||
|
||||
if post_params and body:
|
||||
raise ValueError(
|
||||
raise ApiValueError(
|
||||
"body parameter cannot be used with post_params parameter."
|
||||
)
|
||||
|
||||
@@ -238,30 +240,3 @@ class RESTClientObject(object):
|
||||
_preload_content=_preload_content,
|
||||
_request_timeout=_request_timeout,
|
||||
body=body))
|
||||
|
||||
|
||||
class ApiException(Exception):
|
||||
|
||||
def __init__(self, status=None, reason=None, http_resp=None):
|
||||
if http_resp:
|
||||
self.status = http_resp.status
|
||||
self.reason = http_resp.reason
|
||||
self.body = http_resp.data
|
||||
self.headers = http_resp.getheaders()
|
||||
else:
|
||||
self.status = status
|
||||
self.reason = reason
|
||||
self.body = None
|
||||
self.headers = None
|
||||
|
||||
def __str__(self):
|
||||
"""Custom error messages for exception"""
|
||||
error_message = "({0})\nReason: {1}\n".format(self.status, self.reason)
|
||||
if self.headers:
|
||||
error_message += "HTTP response headers: {0}\n".format(
|
||||
self.headers)
|
||||
|
||||
if self.body:
|
||||
error_message += "HTTP response body: {0}\n".format(self.body)
|
||||
|
||||
return error_message
|
||||
|
||||
112
modules/openapi-generator/src/main/resources/python/exceptions.mustache
vendored
Normal file
112
modules/openapi-generator/src/main/resources/python/exceptions.mustache
vendored
Normal file
@@ -0,0 +1,112 @@
|
||||
# coding: utf-8
|
||||
|
||||
{{>partial_header}}
|
||||
|
||||
import six
|
||||
|
||||
|
||||
class OpenApiException(Exception):
|
||||
"""The base exception class for all OpenAPIExceptions"""
|
||||
|
||||
|
||||
class ApiTypeError(OpenApiException, TypeError):
|
||||
def __init__(self, msg, path_to_item=None, valid_classes=None,
|
||||
key_type=None):
|
||||
""" Raises an exception for TypeErrors
|
||||
|
||||
Args:
|
||||
msg (str): the exception message
|
||||
|
||||
Keyword Args:
|
||||
path_to_item (list): a list of keys an indices to get to the
|
||||
current_item
|
||||
None if unset
|
||||
valid_classes (tuple): the primitive classes that current item
|
||||
should be an instance of
|
||||
None if unset
|
||||
key_type (bool): False if our value is a value in a dict
|
||||
True if it is a key in a dict
|
||||
False if our item is an item in a list
|
||||
None if unset
|
||||
"""
|
||||
self.path_to_item = path_to_item
|
||||
self.valid_classes = valid_classes
|
||||
self.key_type = key_type
|
||||
full_msg = msg
|
||||
if path_to_item:
|
||||
full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
|
||||
super(ApiTypeError, self).__init__(full_msg)
|
||||
|
||||
|
||||
class ApiValueError(OpenApiException, ValueError):
|
||||
def __init__(self, msg, path_to_item=None):
|
||||
"""
|
||||
Args:
|
||||
msg (str): the exception message
|
||||
|
||||
Keyword Args:
|
||||
path_to_item (list) the path to the exception in the
|
||||
received_data dict. None if unset
|
||||
"""
|
||||
|
||||
self.path_to_item = path_to_item
|
||||
full_msg = msg
|
||||
if path_to_item:
|
||||
full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
|
||||
super(ApiValueError, self).__init__(full_msg)
|
||||
|
||||
|
||||
class ApiKeyError(OpenApiException, KeyError):
|
||||
def __init__(self, msg, path_to_item=None):
|
||||
"""
|
||||
Args:
|
||||
msg (str): the exception message
|
||||
|
||||
Keyword Args:
|
||||
path_to_item (None/list) the path to the exception in the
|
||||
received_data dict
|
||||
"""
|
||||
self.path_to_item = path_to_item
|
||||
full_msg = msg
|
||||
if path_to_item:
|
||||
full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
|
||||
super(ApiKeyError, self).__init__(full_msg)
|
||||
|
||||
|
||||
class ApiException(OpenApiException):
|
||||
|
||||
def __init__(self, status=None, reason=None, http_resp=None):
|
||||
if http_resp:
|
||||
self.status = http_resp.status
|
||||
self.reason = http_resp.reason
|
||||
self.body = http_resp.data
|
||||
self.headers = http_resp.getheaders()
|
||||
else:
|
||||
self.status = status
|
||||
self.reason = reason
|
||||
self.body = None
|
||||
self.headers = None
|
||||
|
||||
def __str__(self):
|
||||
"""Custom error messages for exception"""
|
||||
error_message = "({0})\n"\
|
||||
"Reason: {1}\n".format(self.status, self.reason)
|
||||
if self.headers:
|
||||
error_message += "HTTP response headers: {0}\n".format(
|
||||
self.headers)
|
||||
|
||||
if self.body:
|
||||
error_message += "HTTP response body: {0}\n".format(self.body)
|
||||
|
||||
return error_message
|
||||
|
||||
|
||||
def render_path(path_to_item):
|
||||
"""Returns a string representation of a path"""
|
||||
result = ""
|
||||
for pth in path_to_item:
|
||||
if isinstance(pth, six.integer_types):
|
||||
result += "[{0}]".format(pth)
|
||||
else:
|
||||
result += "['{0}']".format(pth)
|
||||
return result
|
||||
@@ -14,11 +14,9 @@ import certifi
|
||||
# python 2 and python 3 compatibility library
|
||||
import six
|
||||
from six.moves.urllib.parse import urlencode
|
||||
import urllib3
|
||||
|
||||
try:
|
||||
import urllib3
|
||||
except ImportError:
|
||||
raise ImportError('OpenAPI Python client requires urllib3.')
|
||||
from {{packageName}}.exceptions import ApiException, ApiValueError
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -125,7 +123,7 @@ class RESTClientObject(object):
|
||||
'PATCH', 'OPTIONS']
|
||||
|
||||
if post_params and body:
|
||||
raise ValueError(
|
||||
raise ApiValueError(
|
||||
"body parameter cannot be used with post_params parameter."
|
||||
)
|
||||
|
||||
@@ -287,31 +285,3 @@ class RESTClientObject(object):
|
||||
_preload_content=_preload_content,
|
||||
_request_timeout=_request_timeout,
|
||||
body=body)
|
||||
|
||||
|
||||
class ApiException(Exception):
|
||||
|
||||
def __init__(self, status=None, reason=None, http_resp=None):
|
||||
if http_resp:
|
||||
self.status = http_resp.status
|
||||
self.reason = http_resp.reason
|
||||
self.body = http_resp.data
|
||||
self.headers = http_resp.getheaders()
|
||||
else:
|
||||
self.status = status
|
||||
self.reason = reason
|
||||
self.body = None
|
||||
self.headers = None
|
||||
|
||||
def __str__(self):
|
||||
"""Custom error messages for exception"""
|
||||
error_message = "({0})\n"\
|
||||
"Reason: {1}\n".format(self.status, self.reason)
|
||||
if self.headers:
|
||||
error_message += "HTTP response headers: {0}\n".format(
|
||||
self.headers)
|
||||
|
||||
if self.body:
|
||||
error_message += "HTTP response body: {0}\n".format(self.body)
|
||||
|
||||
return error_message
|
||||
|
||||
@@ -15,6 +15,8 @@ import tornado.gen
|
||||
from tornado import httpclient
|
||||
from urllib3.filepost import encode_multipart_formdata
|
||||
|
||||
from {{packageName}}.exceptions import ApiException, ApiValueError
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -87,7 +89,7 @@ class RESTClientObject(object):
|
||||
'PATCH', 'OPTIONS']
|
||||
|
||||
if post_params and body:
|
||||
raise ValueError(
|
||||
raise ApiValueError(
|
||||
"body parameter cannot be used with post_params parameter."
|
||||
)
|
||||
|
||||
@@ -225,31 +227,3 @@ class RESTClientObject(object):
|
||||
_request_timeout=_request_timeout,
|
||||
body=body)
|
||||
raise tornado.gen.Return(result)
|
||||
|
||||
|
||||
class ApiException(Exception):
|
||||
|
||||
def __init__(self, status=None, reason=None, http_resp=None):
|
||||
if http_resp:
|
||||
self.status = http_resp.status
|
||||
self.reason = http_resp.reason
|
||||
self.body = http_resp.data
|
||||
self.headers = http_resp.getheaders()
|
||||
else:
|
||||
self.status = status
|
||||
self.reason = reason
|
||||
self.body = None
|
||||
self.headers = None
|
||||
|
||||
def __str__(self):
|
||||
"""Custom error messages for exception"""
|
||||
error_message = "({0})\nReason: {1}\n".format(
|
||||
self.status, self.reason)
|
||||
if self.headers:
|
||||
error_message += "HTTP response headers: {0}\n".format(
|
||||
self.headers)
|
||||
|
||||
if self.body:
|
||||
error_message += "HTTP response body: {0}\n".format(self.body)
|
||||
|
||||
return error_message
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
/*
|
||||
* OpenAPI Petstore *_/ ' \" =end -- \\r\\n \\n \\r
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
|
||||
* Contact: something@something.abc *_/ ' \" =end -- \\r\\n \\n \\r
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
package org.openapitools.client.auth;
|
||||
|
||||
import org.openapitools.client.Pair;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class HttpBearerAuth implements Authentication {
|
||||
private final String scheme;
|
||||
private String bearerToken;
|
||||
|
||||
public HttpBearerAuth(String scheme) {
|
||||
this.scheme = scheme;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the token, which together with the scheme, will be sent as the value of the Authorization header.
|
||||
*
|
||||
* @return The bearer token
|
||||
*/
|
||||
public String getBearerToken() {
|
||||
return bearerToken;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the token, which together with the scheme, will be sent as the value of the Authorization header.
|
||||
*
|
||||
* @param bearerToken The bearer token to send in the Authorization header
|
||||
*/
|
||||
public void setBearerToken(String bearerToken) {
|
||||
this.bearerToken = bearerToken;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams) {
|
||||
if(bearerToken == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
headerParams.put("Authorization", (scheme != null ? upperCaseBearer(scheme) + " " : "") + bearerToken);
|
||||
}
|
||||
|
||||
private static String upperCaseBearer(String scheme) {
|
||||
return ("bearer".equalsIgnoreCase(scheme)) ? "Bearer" : scheme;
|
||||
}
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
/*
|
||||
* OpenAPI Petstore *_/ ' \" =end -- \\r\\n \\n \\r
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
|
||||
* Contact: something@something.abc *_/ ' \" =end -- \\r\\n \\n \\r
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
package org.openapitools.client.model;
|
||||
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
/**
|
||||
* Model tests for ModelReturn
|
||||
*/
|
||||
public class ModelReturnTest {
|
||||
private final ModelReturn model = new ModelReturn();
|
||||
|
||||
/**
|
||||
* Model tests for ModelReturn
|
||||
*/
|
||||
@Test
|
||||
public void testModelReturn() {
|
||||
// TODO: test ModelReturn
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the property '_return'
|
||||
*/
|
||||
@Test
|
||||
public void _returnTest() {
|
||||
// TODO: test _return
|
||||
}
|
||||
|
||||
}
|
||||
@@ -27,6 +27,11 @@ from petstore_api.api.user_api import UserApi
|
||||
# import ApiClient
|
||||
from petstore_api.api_client import ApiClient
|
||||
from petstore_api.configuration import Configuration
|
||||
from petstore_api.exceptions import OpenApiException
|
||||
from petstore_api.exceptions import ApiTypeError
|
||||
from petstore_api.exceptions import ApiValueError
|
||||
from petstore_api.exceptions import ApiKeyError
|
||||
from petstore_api.exceptions import ApiException
|
||||
# import models into sdk package
|
||||
from petstore_api.models.additional_properties_any_type import AdditionalPropertiesAnyType
|
||||
from petstore_api.models.additional_properties_array import AdditionalPropertiesArray
|
||||
@@ -72,3 +77,4 @@ 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
|
||||
from petstore_api.models.xml_item import XmlItem
|
||||
|
||||
|
||||
@@ -18,6 +18,10 @@ import re # noqa: F401
|
||||
import six
|
||||
|
||||
from petstore_api.api_client import ApiClient
|
||||
from petstore_api.exceptions import (
|
||||
ApiTypeError,
|
||||
ApiValueError
|
||||
)
|
||||
|
||||
|
||||
class AnotherFakeApi(object):
|
||||
@@ -80,7 +84,7 @@ class AnotherFakeApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method call_123_test_special_tags" % key
|
||||
)
|
||||
@@ -89,7 +93,7 @@ class AnotherFakeApi(object):
|
||||
# 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
|
||||
raise ApiValueError("Missing the required parameter `body` when calling `call_123_test_special_tags`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
|
||||
@@ -18,6 +18,10 @@ import re # noqa: F401
|
||||
import six
|
||||
|
||||
from petstore_api.api_client import ApiClient
|
||||
from petstore_api.exceptions import (
|
||||
ApiTypeError,
|
||||
ApiValueError
|
||||
)
|
||||
|
||||
|
||||
class FakeApi(object):
|
||||
@@ -80,7 +84,7 @@ class FakeApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method create_xml_item" % key
|
||||
)
|
||||
@@ -89,7 +93,7 @@ class FakeApi(object):
|
||||
# verify the required parameter 'xml_item' is set
|
||||
if ('xml_item' not in local_var_params or
|
||||
local_var_params['xml_item'] is None):
|
||||
raise ValueError("Missing the required parameter `xml_item` when calling `create_xml_item`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `xml_item` when calling `create_xml_item`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -176,7 +180,7 @@ class FakeApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method fake_outer_boolean_serialize" % key
|
||||
)
|
||||
@@ -268,7 +272,7 @@ class FakeApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method fake_outer_composite_serialize" % key
|
||||
)
|
||||
@@ -360,7 +364,7 @@ class FakeApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method fake_outer_number_serialize" % key
|
||||
)
|
||||
@@ -452,7 +456,7 @@ class FakeApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method fake_outer_string_serialize" % key
|
||||
)
|
||||
@@ -544,7 +548,7 @@ class FakeApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method test_body_with_file_schema" % key
|
||||
)
|
||||
@@ -553,7 +557,7 @@ class FakeApi(object):
|
||||
# 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
|
||||
raise ApiValueError("Missing the required parameter `body` when calling `test_body_with_file_schema`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -640,7 +644,7 @@ class FakeApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method test_body_with_query_params" % key
|
||||
)
|
||||
@@ -649,11 +653,11 @@ class FakeApi(object):
|
||||
# verify the required parameter 'query' is set
|
||||
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
|
||||
raise ApiValueError("Missing the required parameter `query` 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
|
||||
raise ApiValueError("Missing the required parameter `body` when calling `test_body_with_query_params`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -742,7 +746,7 @@ class FakeApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method test_client_model" % key
|
||||
)
|
||||
@@ -751,7 +755,7 @@ class FakeApi(object):
|
||||
# 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
|
||||
raise ApiValueError("Missing the required parameter `body` when calling `test_client_model`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -868,7 +872,7 @@ class FakeApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method test_endpoint_parameters" % key
|
||||
)
|
||||
@@ -877,48 +881,48 @@ class FakeApi(object):
|
||||
# verify the required parameter 'number' is set
|
||||
if ('number' not in local_var_params or
|
||||
local_var_params['number'] is None):
|
||||
raise ValueError("Missing the required parameter `number` when calling `test_endpoint_parameters`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `number` when calling `test_endpoint_parameters`") # noqa: E501
|
||||
# verify the required parameter 'double' is set
|
||||
if ('double' not in local_var_params or
|
||||
local_var_params['double'] is None):
|
||||
raise ValueError("Missing the required parameter `double` when calling `test_endpoint_parameters`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `double` when calling `test_endpoint_parameters`") # noqa: E501
|
||||
# verify the required parameter 'pattern_without_delimiter' is set
|
||||
if ('pattern_without_delimiter' not in local_var_params or
|
||||
local_var_params['pattern_without_delimiter'] is None):
|
||||
raise ValueError("Missing the required parameter `pattern_without_delimiter` when calling `test_endpoint_parameters`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `pattern_without_delimiter` when calling `test_endpoint_parameters`") # noqa: E501
|
||||
# verify the required parameter 'byte' is set
|
||||
if ('byte' not in local_var_params or
|
||||
local_var_params['byte'] is None):
|
||||
raise ValueError("Missing the required parameter `byte` when calling `test_endpoint_parameters`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `byte` when calling `test_endpoint_parameters`") # noqa: E501
|
||||
|
||||
if 'number' in local_var_params and local_var_params['number'] > 543.2: # noqa: E501
|
||||
raise ValueError("Invalid value for parameter `number` when calling `test_endpoint_parameters`, must be a value less than or equal to `543.2`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `number` when calling `test_endpoint_parameters`, must be a value less than or equal to `543.2`") # noqa: E501
|
||||
if 'number' in local_var_params and local_var_params['number'] < 32.1: # noqa: E501
|
||||
raise ValueError("Invalid value for parameter `number` when calling `test_endpoint_parameters`, must be a value greater than or equal to `32.1`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `number` when calling `test_endpoint_parameters`, must be a value greater than or equal to `32.1`") # noqa: E501
|
||||
if 'double' in local_var_params and local_var_params['double'] > 123.4: # noqa: E501
|
||||
raise ValueError("Invalid value for parameter `double` when calling `test_endpoint_parameters`, must be a value less than or equal to `123.4`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `double` when calling `test_endpoint_parameters`, must be a value less than or equal to `123.4`") # noqa: E501
|
||||
if 'double' in local_var_params and local_var_params['double'] < 67.8: # noqa: E501
|
||||
raise ValueError("Invalid value for parameter `double` when calling `test_endpoint_parameters`, must be a value greater than or equal to `67.8`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `double` when calling `test_endpoint_parameters`, must be a value greater than or equal to `67.8`") # noqa: E501
|
||||
if 'pattern_without_delimiter' in local_var_params and not re.search(r'^[A-Z].*', local_var_params['pattern_without_delimiter']): # noqa: E501
|
||||
raise ValueError("Invalid value for parameter `pattern_without_delimiter` when calling `test_endpoint_parameters`, must conform to the pattern `/^[A-Z].*/`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `pattern_without_delimiter` when calling `test_endpoint_parameters`, must conform to the pattern `/^[A-Z].*/`") # noqa: E501
|
||||
if 'integer' in local_var_params and local_var_params['integer'] > 100: # noqa: E501
|
||||
raise ValueError("Invalid value for parameter `integer` when calling `test_endpoint_parameters`, must be a value less than or equal to `100`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `integer` when calling `test_endpoint_parameters`, must be a value less than or equal to `100`") # noqa: E501
|
||||
if 'integer' in local_var_params and local_var_params['integer'] < 10: # noqa: E501
|
||||
raise ValueError("Invalid value for parameter `integer` when calling `test_endpoint_parameters`, must be a value greater than or equal to `10`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `integer` when calling `test_endpoint_parameters`, must be a value greater than or equal to `10`") # noqa: E501
|
||||
if 'int32' in local_var_params and local_var_params['int32'] > 200: # noqa: E501
|
||||
raise ValueError("Invalid value for parameter `int32` when calling `test_endpoint_parameters`, must be a value less than or equal to `200`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `int32` when calling `test_endpoint_parameters`, must be a value less than or equal to `200`") # noqa: E501
|
||||
if 'int32' in local_var_params and local_var_params['int32'] < 20: # noqa: E501
|
||||
raise ValueError("Invalid value for parameter `int32` when calling `test_endpoint_parameters`, must be a value greater than or equal to `20`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `int32` when calling `test_endpoint_parameters`, must be a value greater than or equal to `20`") # noqa: E501
|
||||
if 'float' in local_var_params and local_var_params['float'] > 987.6: # noqa: E501
|
||||
raise ValueError("Invalid value for parameter `float` when calling `test_endpoint_parameters`, must be a value less than or equal to `987.6`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `float` when calling `test_endpoint_parameters`, must be a value less than or equal to `987.6`") # noqa: E501
|
||||
if 'string' in local_var_params and not re.search(r'[a-z]', local_var_params['string'], flags=re.IGNORECASE): # noqa: E501
|
||||
raise ValueError("Invalid value for parameter `string` when calling `test_endpoint_parameters`, must conform to the pattern `/[a-z]/i`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `string` when calling `test_endpoint_parameters`, must conform to the pattern `/[a-z]/i`") # noqa: E501
|
||||
if ('password' in local_var_params and
|
||||
len(local_var_params['password']) > 64):
|
||||
raise ValueError("Invalid value for parameter `password` when calling `test_endpoint_parameters`, length must be less than or equal to `64`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `password` when calling `test_endpoint_parameters`, length must be less than or equal to `64`") # noqa: E501
|
||||
if ('password' in local_var_params and
|
||||
len(local_var_params['password']) < 10):
|
||||
raise ValueError("Invalid value for parameter `password` when calling `test_endpoint_parameters`, length must be greater than or equal to `10`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `password` when calling `test_endpoint_parameters`, length must be greater than or equal to `10`") # noqa: E501
|
||||
collection_formats = {}
|
||||
|
||||
path_params = {}
|
||||
@@ -1044,7 +1048,7 @@ class FakeApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method test_enum_parameters" % key
|
||||
)
|
||||
@@ -1163,7 +1167,7 @@ class FakeApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method test_group_parameters" % key
|
||||
)
|
||||
@@ -1172,15 +1176,15 @@ class FakeApi(object):
|
||||
# verify the required parameter 'required_string_group' is set
|
||||
if ('required_string_group' not in local_var_params or
|
||||
local_var_params['required_string_group'] is None):
|
||||
raise ValueError("Missing the required parameter `required_string_group` when calling `test_group_parameters`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `required_string_group` when calling `test_group_parameters`") # noqa: E501
|
||||
# verify the required parameter 'required_boolean_group' is set
|
||||
if ('required_boolean_group' not in local_var_params or
|
||||
local_var_params['required_boolean_group'] is None):
|
||||
raise ValueError("Missing the required parameter `required_boolean_group` when calling `test_group_parameters`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `required_boolean_group` when calling `test_group_parameters`") # noqa: E501
|
||||
# verify the required parameter 'required_int64_group' is set
|
||||
if ('required_int64_group' not in local_var_params or
|
||||
local_var_params['required_int64_group'] is None):
|
||||
raise ValueError("Missing the required parameter `required_int64_group` when calling `test_group_parameters`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `required_int64_group` when calling `test_group_parameters`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -1271,7 +1275,7 @@ class FakeApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method test_inline_additional_properties" % key
|
||||
)
|
||||
@@ -1280,7 +1284,7 @@ class FakeApi(object):
|
||||
# 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
|
||||
raise ApiValueError("Missing the required parameter `param` when calling `test_inline_additional_properties`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -1367,7 +1371,7 @@ class FakeApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method test_json_form_data" % key
|
||||
)
|
||||
@@ -1376,11 +1380,11 @@ class FakeApi(object):
|
||||
# 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_json_form_data`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `param` when calling `test_json_form_data`") # noqa: E501
|
||||
# verify the required parameter 'param2' is set
|
||||
if ('param2' not in local_var_params or
|
||||
local_var_params['param2'] is None):
|
||||
raise ValueError("Missing the required parameter `param2` when calling `test_json_form_data`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `param2` when calling `test_json_form_data`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
|
||||
@@ -18,6 +18,10 @@ import re # noqa: F401
|
||||
import six
|
||||
|
||||
from petstore_api.api_client import ApiClient
|
||||
from petstore_api.exceptions import (
|
||||
ApiTypeError,
|
||||
ApiValueError
|
||||
)
|
||||
|
||||
|
||||
class FakeClassnameTags123Api(object):
|
||||
@@ -80,7 +84,7 @@ class FakeClassnameTags123Api(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method test_classname" % key
|
||||
)
|
||||
@@ -89,7 +93,7 @@ class FakeClassnameTags123Api(object):
|
||||
# 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
|
||||
raise ApiValueError("Missing the required parameter `body` when calling `test_classname`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
|
||||
@@ -18,6 +18,10 @@ import re # noqa: F401
|
||||
import six
|
||||
|
||||
from petstore_api.api_client import ApiClient
|
||||
from petstore_api.exceptions import (
|
||||
ApiTypeError,
|
||||
ApiValueError
|
||||
)
|
||||
|
||||
|
||||
class PetApi(object):
|
||||
@@ -78,7 +82,7 @@ class PetApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method add_pet" % key
|
||||
)
|
||||
@@ -87,7 +91,7 @@ class PetApi(object):
|
||||
# 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
|
||||
raise ApiValueError("Missing the required parameter `body` when calling `add_pet`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -174,7 +178,7 @@ class PetApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method delete_pet" % key
|
||||
)
|
||||
@@ -183,7 +187,7 @@ class PetApi(object):
|
||||
# verify the required parameter 'pet_id' is set
|
||||
if ('pet_id' not in local_var_params or
|
||||
local_var_params['pet_id'] is None):
|
||||
raise ValueError("Missing the required parameter `pet_id` when calling `delete_pet`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `pet_id` when calling `delete_pet`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -268,7 +272,7 @@ class PetApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method find_pets_by_status" % key
|
||||
)
|
||||
@@ -277,7 +281,7 @@ class PetApi(object):
|
||||
# verify the required parameter 'status' is set
|
||||
if ('status' not in local_var_params or
|
||||
local_var_params['status'] is None):
|
||||
raise ValueError("Missing the required parameter `status` when calling `find_pets_by_status`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `status` when calling `find_pets_by_status`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -365,7 +369,7 @@ class PetApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method find_pets_by_tags" % key
|
||||
)
|
||||
@@ -374,7 +378,7 @@ class PetApi(object):
|
||||
# verify the required parameter 'tags' is set
|
||||
if ('tags' not in local_var_params or
|
||||
local_var_params['tags'] is None):
|
||||
raise ValueError("Missing the required parameter `tags` when calling `find_pets_by_tags`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `tags` when calling `find_pets_by_tags`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -462,7 +466,7 @@ class PetApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method get_pet_by_id" % key
|
||||
)
|
||||
@@ -471,7 +475,7 @@ class PetApi(object):
|
||||
# verify the required parameter 'pet_id' is set
|
||||
if ('pet_id' not in local_var_params or
|
||||
local_var_params['pet_id'] is None):
|
||||
raise ValueError("Missing the required parameter `pet_id` when calling `get_pet_by_id`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `pet_id` when calling `get_pet_by_id`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -556,7 +560,7 @@ class PetApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method update_pet" % key
|
||||
)
|
||||
@@ -565,7 +569,7 @@ class PetApi(object):
|
||||
# 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
|
||||
raise ApiValueError("Missing the required parameter `body` when calling `update_pet`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -654,7 +658,7 @@ class PetApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method update_pet_with_form" % key
|
||||
)
|
||||
@@ -663,7 +667,7 @@ class PetApi(object):
|
||||
# verify the required parameter 'pet_id' is set
|
||||
if ('pet_id' not in local_var_params or
|
||||
local_var_params['pet_id'] is None):
|
||||
raise ValueError("Missing the required parameter `pet_id` when calling `update_pet_with_form`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `pet_id` when calling `update_pet_with_form`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -756,7 +760,7 @@ class PetApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method upload_file" % key
|
||||
)
|
||||
@@ -765,7 +769,7 @@ class PetApi(object):
|
||||
# verify the required parameter 'pet_id' is set
|
||||
if ('pet_id' not in local_var_params or
|
||||
local_var_params['pet_id'] is None):
|
||||
raise ValueError("Missing the required parameter `pet_id` when calling `upload_file`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `pet_id` when calling `upload_file`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -862,7 +866,7 @@ class PetApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method upload_file_with_required_file" % key
|
||||
)
|
||||
@@ -871,11 +875,11 @@ class PetApi(object):
|
||||
# verify the required parameter 'pet_id' is set
|
||||
if ('pet_id' not in local_var_params or
|
||||
local_var_params['pet_id'] is None):
|
||||
raise ValueError("Missing the required parameter `pet_id` when calling `upload_file_with_required_file`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `pet_id` when calling `upload_file_with_required_file`") # noqa: E501
|
||||
# verify the required parameter 'required_file' is set
|
||||
if ('required_file' not in local_var_params or
|
||||
local_var_params['required_file'] is None):
|
||||
raise ValueError("Missing the required parameter `required_file` when calling `upload_file_with_required_file`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `required_file` when calling `upload_file_with_required_file`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
|
||||
@@ -18,6 +18,10 @@ import re # noqa: F401
|
||||
import six
|
||||
|
||||
from petstore_api.api_client import ApiClient
|
||||
from petstore_api.exceptions import (
|
||||
ApiTypeError,
|
||||
ApiValueError
|
||||
)
|
||||
|
||||
|
||||
class StoreApi(object):
|
||||
@@ -80,7 +84,7 @@ class StoreApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method delete_order" % key
|
||||
)
|
||||
@@ -89,7 +93,7 @@ class StoreApi(object):
|
||||
# verify the required parameter 'order_id' is set
|
||||
if ('order_id' not in local_var_params or
|
||||
local_var_params['order_id'] is None):
|
||||
raise ValueError("Missing the required parameter `order_id` when calling `delete_order`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `order_id` when calling `delete_order`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -170,7 +174,7 @@ class StoreApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method get_inventory" % key
|
||||
)
|
||||
@@ -260,7 +264,7 @@ class StoreApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method get_order_by_id" % key
|
||||
)
|
||||
@@ -269,12 +273,12 @@ class StoreApi(object):
|
||||
# verify the required parameter 'order_id' is set
|
||||
if ('order_id' not in local_var_params or
|
||||
local_var_params['order_id'] is None):
|
||||
raise ValueError("Missing the required parameter `order_id` when calling `get_order_by_id`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `order_id` when calling `get_order_by_id`") # noqa: E501
|
||||
|
||||
if 'order_id' in local_var_params and local_var_params['order_id'] > 5: # noqa: E501
|
||||
raise ValueError("Invalid value for parameter `order_id` when calling `get_order_by_id`, must be a value less than or equal to `5`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `order_id` when calling `get_order_by_id`, must be a value less than or equal to `5`") # noqa: E501
|
||||
if 'order_id' in local_var_params and local_var_params['order_id'] < 1: # noqa: E501
|
||||
raise ValueError("Invalid value for parameter `order_id` when calling `get_order_by_id`, must be a value greater than or equal to `1`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `order_id` when calling `get_order_by_id`, must be a value greater than or equal to `1`") # noqa: E501
|
||||
collection_formats = {}
|
||||
|
||||
path_params = {}
|
||||
@@ -358,7 +362,7 @@ class StoreApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method place_order" % key
|
||||
)
|
||||
@@ -367,7 +371,7 @@ class StoreApi(object):
|
||||
# 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
|
||||
raise ApiValueError("Missing the required parameter `body` when calling `place_order`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
|
||||
@@ -18,6 +18,10 @@ import re # noqa: F401
|
||||
import six
|
||||
|
||||
from petstore_api.api_client import ApiClient
|
||||
from petstore_api.exceptions import (
|
||||
ApiTypeError,
|
||||
ApiValueError
|
||||
)
|
||||
|
||||
|
||||
class UserApi(object):
|
||||
@@ -80,7 +84,7 @@ class UserApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method create_user" % key
|
||||
)
|
||||
@@ -89,7 +93,7 @@ class UserApi(object):
|
||||
# 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
|
||||
raise ApiValueError("Missing the required parameter `body` when calling `create_user`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -170,7 +174,7 @@ class UserApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method create_users_with_array_input" % key
|
||||
)
|
||||
@@ -179,7 +183,7 @@ class UserApi(object):
|
||||
# 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
|
||||
raise ApiValueError("Missing the required parameter `body` when calling `create_users_with_array_input`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -260,7 +264,7 @@ class UserApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method create_users_with_list_input" % key
|
||||
)
|
||||
@@ -269,7 +273,7 @@ class UserApi(object):
|
||||
# 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
|
||||
raise ApiValueError("Missing the required parameter `body` when calling `create_users_with_list_input`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -352,7 +356,7 @@ class UserApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method delete_user" % key
|
||||
)
|
||||
@@ -361,7 +365,7 @@ class UserApi(object):
|
||||
# verify the required parameter 'username' is set
|
||||
if ('username' not in local_var_params or
|
||||
local_var_params['username'] is None):
|
||||
raise ValueError("Missing the required parameter `username` when calling `delete_user`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `username` when calling `delete_user`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -442,7 +446,7 @@ class UserApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method get_user_by_name" % key
|
||||
)
|
||||
@@ -451,7 +455,7 @@ class UserApi(object):
|
||||
# verify the required parameter 'username' is set
|
||||
if ('username' not in local_var_params or
|
||||
local_var_params['username'] is None):
|
||||
raise ValueError("Missing the required parameter `username` when calling `get_user_by_name`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `username` when calling `get_user_by_name`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -538,7 +542,7 @@ class UserApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method login_user" % key
|
||||
)
|
||||
@@ -547,11 +551,11 @@ class UserApi(object):
|
||||
# verify the required parameter 'username' is set
|
||||
if ('username' not in local_var_params or
|
||||
local_var_params['username'] is None):
|
||||
raise ValueError("Missing the required parameter `username` when calling `login_user`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `username` when calling `login_user`") # noqa: E501
|
||||
# verify the required parameter 'password' is set
|
||||
if ('password' not in local_var_params or
|
||||
local_var_params['password'] is None):
|
||||
raise ValueError("Missing the required parameter `password` when calling `login_user`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `password` when calling `login_user`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -636,7 +640,7 @@ class UserApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method logout_user" % key
|
||||
)
|
||||
@@ -724,7 +728,7 @@ class UserApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method update_user" % key
|
||||
)
|
||||
@@ -733,11 +737,11 @@ class UserApi(object):
|
||||
# verify the required parameter 'username' is set
|
||||
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
|
||||
raise ApiValueError("Missing the required parameter `username` 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
|
||||
raise ApiValueError("Missing the required parameter `body` when calling `update_user`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ from six.moves.urllib.parse import quote
|
||||
from petstore_api.configuration import Configuration
|
||||
import petstore_api.models
|
||||
from petstore_api import rest
|
||||
from petstore_api.exceptions import ApiValueError
|
||||
|
||||
|
||||
class ApiClient(object):
|
||||
@@ -406,7 +407,7 @@ class ApiClient(object):
|
||||
_request_timeout=_request_timeout,
|
||||
body=body)
|
||||
else:
|
||||
raise ValueError(
|
||||
raise ApiValueError(
|
||||
"http method must be `GET`, `HEAD`, `OPTIONS`,"
|
||||
" `POST`, `PATCH`, `PUT` or `DELETE`."
|
||||
)
|
||||
@@ -523,7 +524,7 @@ class ApiClient(object):
|
||||
elif auth_setting['in'] == 'query':
|
||||
querys.append((auth_setting['key'], auth_setting['value']))
|
||||
else:
|
||||
raise ValueError(
|
||||
raise ApiValueError(
|
||||
'Authentication token must be in `query` or `header`'
|
||||
)
|
||||
|
||||
|
||||
@@ -22,6 +22,8 @@ import asyncio
|
||||
# python 2 and python 3 compatibility library
|
||||
from six.moves.urllib.parse import urlencode
|
||||
|
||||
from petstore_api.exceptions import ApiException, ApiValueError
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -108,7 +110,7 @@ class RESTClientObject(object):
|
||||
'PATCH', 'OPTIONS']
|
||||
|
||||
if post_params and body:
|
||||
raise ValueError(
|
||||
raise ApiValueError(
|
||||
"body parameter cannot be used with post_params parameter."
|
||||
)
|
||||
|
||||
@@ -246,30 +248,3 @@ class RESTClientObject(object):
|
||||
_preload_content=_preload_content,
|
||||
_request_timeout=_request_timeout,
|
||||
body=body))
|
||||
|
||||
|
||||
class ApiException(Exception):
|
||||
|
||||
def __init__(self, status=None, reason=None, http_resp=None):
|
||||
if http_resp:
|
||||
self.status = http_resp.status
|
||||
self.reason = http_resp.reason
|
||||
self.body = http_resp.data
|
||||
self.headers = http_resp.getheaders()
|
||||
else:
|
||||
self.status = status
|
||||
self.reason = reason
|
||||
self.body = None
|
||||
self.headers = None
|
||||
|
||||
def __str__(self):
|
||||
"""Custom error messages for exception"""
|
||||
error_message = "({0})\nReason: {1}\n".format(self.status, self.reason)
|
||||
if self.headers:
|
||||
error_message += "HTTP response headers: {0}\n".format(
|
||||
self.headers)
|
||||
|
||||
if self.body:
|
||||
error_message += "HTTP response body: {0}\n".format(self.body)
|
||||
|
||||
return error_message
|
||||
|
||||
@@ -27,6 +27,11 @@ from petstore_api.api.user_api import UserApi
|
||||
# import ApiClient
|
||||
from petstore_api.api_client import ApiClient
|
||||
from petstore_api.configuration import Configuration
|
||||
from petstore_api.exceptions import OpenApiException
|
||||
from petstore_api.exceptions import ApiTypeError
|
||||
from petstore_api.exceptions import ApiValueError
|
||||
from petstore_api.exceptions import ApiKeyError
|
||||
from petstore_api.exceptions import ApiException
|
||||
# import models into sdk package
|
||||
from petstore_api.models.additional_properties_any_type import AdditionalPropertiesAnyType
|
||||
from petstore_api.models.additional_properties_array import AdditionalPropertiesArray
|
||||
@@ -72,3 +77,4 @@ 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
|
||||
from petstore_api.models.xml_item import XmlItem
|
||||
|
||||
|
||||
@@ -18,6 +18,10 @@ import re # noqa: F401
|
||||
import six
|
||||
|
||||
from petstore_api.api_client import ApiClient
|
||||
from petstore_api.exceptions import (
|
||||
ApiTypeError,
|
||||
ApiValueError
|
||||
)
|
||||
|
||||
|
||||
class AnotherFakeApi(object):
|
||||
@@ -80,7 +84,7 @@ class AnotherFakeApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method call_123_test_special_tags" % key
|
||||
)
|
||||
@@ -89,7 +93,7 @@ class AnotherFakeApi(object):
|
||||
# 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
|
||||
raise ApiValueError("Missing the required parameter `body` when calling `call_123_test_special_tags`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
|
||||
@@ -18,6 +18,10 @@ import re # noqa: F401
|
||||
import six
|
||||
|
||||
from petstore_api.api_client import ApiClient
|
||||
from petstore_api.exceptions import (
|
||||
ApiTypeError,
|
||||
ApiValueError
|
||||
)
|
||||
|
||||
|
||||
class FakeApi(object):
|
||||
@@ -80,7 +84,7 @@ class FakeApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method create_xml_item" % key
|
||||
)
|
||||
@@ -89,7 +93,7 @@ class FakeApi(object):
|
||||
# verify the required parameter 'xml_item' is set
|
||||
if ('xml_item' not in local_var_params or
|
||||
local_var_params['xml_item'] is None):
|
||||
raise ValueError("Missing the required parameter `xml_item` when calling `create_xml_item`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `xml_item` when calling `create_xml_item`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -176,7 +180,7 @@ class FakeApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method fake_outer_boolean_serialize" % key
|
||||
)
|
||||
@@ -268,7 +272,7 @@ class FakeApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method fake_outer_composite_serialize" % key
|
||||
)
|
||||
@@ -360,7 +364,7 @@ class FakeApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method fake_outer_number_serialize" % key
|
||||
)
|
||||
@@ -452,7 +456,7 @@ class FakeApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method fake_outer_string_serialize" % key
|
||||
)
|
||||
@@ -544,7 +548,7 @@ class FakeApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method test_body_with_file_schema" % key
|
||||
)
|
||||
@@ -553,7 +557,7 @@ class FakeApi(object):
|
||||
# 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
|
||||
raise ApiValueError("Missing the required parameter `body` when calling `test_body_with_file_schema`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -640,7 +644,7 @@ class FakeApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method test_body_with_query_params" % key
|
||||
)
|
||||
@@ -649,11 +653,11 @@ class FakeApi(object):
|
||||
# verify the required parameter 'query' is set
|
||||
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
|
||||
raise ApiValueError("Missing the required parameter `query` 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
|
||||
raise ApiValueError("Missing the required parameter `body` when calling `test_body_with_query_params`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -742,7 +746,7 @@ class FakeApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method test_client_model" % key
|
||||
)
|
||||
@@ -751,7 +755,7 @@ class FakeApi(object):
|
||||
# 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
|
||||
raise ApiValueError("Missing the required parameter `body` when calling `test_client_model`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -868,7 +872,7 @@ class FakeApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method test_endpoint_parameters" % key
|
||||
)
|
||||
@@ -877,48 +881,48 @@ class FakeApi(object):
|
||||
# verify the required parameter 'number' is set
|
||||
if ('number' not in local_var_params or
|
||||
local_var_params['number'] is None):
|
||||
raise ValueError("Missing the required parameter `number` when calling `test_endpoint_parameters`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `number` when calling `test_endpoint_parameters`") # noqa: E501
|
||||
# verify the required parameter 'double' is set
|
||||
if ('double' not in local_var_params or
|
||||
local_var_params['double'] is None):
|
||||
raise ValueError("Missing the required parameter `double` when calling `test_endpoint_parameters`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `double` when calling `test_endpoint_parameters`") # noqa: E501
|
||||
# verify the required parameter 'pattern_without_delimiter' is set
|
||||
if ('pattern_without_delimiter' not in local_var_params or
|
||||
local_var_params['pattern_without_delimiter'] is None):
|
||||
raise ValueError("Missing the required parameter `pattern_without_delimiter` when calling `test_endpoint_parameters`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `pattern_without_delimiter` when calling `test_endpoint_parameters`") # noqa: E501
|
||||
# verify the required parameter 'byte' is set
|
||||
if ('byte' not in local_var_params or
|
||||
local_var_params['byte'] is None):
|
||||
raise ValueError("Missing the required parameter `byte` when calling `test_endpoint_parameters`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `byte` when calling `test_endpoint_parameters`") # noqa: E501
|
||||
|
||||
if 'number' in local_var_params and local_var_params['number'] > 543.2: # noqa: E501
|
||||
raise ValueError("Invalid value for parameter `number` when calling `test_endpoint_parameters`, must be a value less than or equal to `543.2`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `number` when calling `test_endpoint_parameters`, must be a value less than or equal to `543.2`") # noqa: E501
|
||||
if 'number' in local_var_params and local_var_params['number'] < 32.1: # noqa: E501
|
||||
raise ValueError("Invalid value for parameter `number` when calling `test_endpoint_parameters`, must be a value greater than or equal to `32.1`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `number` when calling `test_endpoint_parameters`, must be a value greater than or equal to `32.1`") # noqa: E501
|
||||
if 'double' in local_var_params and local_var_params['double'] > 123.4: # noqa: E501
|
||||
raise ValueError("Invalid value for parameter `double` when calling `test_endpoint_parameters`, must be a value less than or equal to `123.4`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `double` when calling `test_endpoint_parameters`, must be a value less than or equal to `123.4`") # noqa: E501
|
||||
if 'double' in local_var_params and local_var_params['double'] < 67.8: # noqa: E501
|
||||
raise ValueError("Invalid value for parameter `double` when calling `test_endpoint_parameters`, must be a value greater than or equal to `67.8`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `double` when calling `test_endpoint_parameters`, must be a value greater than or equal to `67.8`") # noqa: E501
|
||||
if 'pattern_without_delimiter' in local_var_params and not re.search(r'^[A-Z].*', local_var_params['pattern_without_delimiter']): # noqa: E501
|
||||
raise ValueError("Invalid value for parameter `pattern_without_delimiter` when calling `test_endpoint_parameters`, must conform to the pattern `/^[A-Z].*/`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `pattern_without_delimiter` when calling `test_endpoint_parameters`, must conform to the pattern `/^[A-Z].*/`") # noqa: E501
|
||||
if 'integer' in local_var_params and local_var_params['integer'] > 100: # noqa: E501
|
||||
raise ValueError("Invalid value for parameter `integer` when calling `test_endpoint_parameters`, must be a value less than or equal to `100`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `integer` when calling `test_endpoint_parameters`, must be a value less than or equal to `100`") # noqa: E501
|
||||
if 'integer' in local_var_params and local_var_params['integer'] < 10: # noqa: E501
|
||||
raise ValueError("Invalid value for parameter `integer` when calling `test_endpoint_parameters`, must be a value greater than or equal to `10`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `integer` when calling `test_endpoint_parameters`, must be a value greater than or equal to `10`") # noqa: E501
|
||||
if 'int32' in local_var_params and local_var_params['int32'] > 200: # noqa: E501
|
||||
raise ValueError("Invalid value for parameter `int32` when calling `test_endpoint_parameters`, must be a value less than or equal to `200`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `int32` when calling `test_endpoint_parameters`, must be a value less than or equal to `200`") # noqa: E501
|
||||
if 'int32' in local_var_params and local_var_params['int32'] < 20: # noqa: E501
|
||||
raise ValueError("Invalid value for parameter `int32` when calling `test_endpoint_parameters`, must be a value greater than or equal to `20`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `int32` when calling `test_endpoint_parameters`, must be a value greater than or equal to `20`") # noqa: E501
|
||||
if 'float' in local_var_params and local_var_params['float'] > 987.6: # noqa: E501
|
||||
raise ValueError("Invalid value for parameter `float` when calling `test_endpoint_parameters`, must be a value less than or equal to `987.6`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `float` when calling `test_endpoint_parameters`, must be a value less than or equal to `987.6`") # noqa: E501
|
||||
if 'string' in local_var_params and not re.search(r'[a-z]', local_var_params['string'], flags=re.IGNORECASE): # noqa: E501
|
||||
raise ValueError("Invalid value for parameter `string` when calling `test_endpoint_parameters`, must conform to the pattern `/[a-z]/i`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `string` when calling `test_endpoint_parameters`, must conform to the pattern `/[a-z]/i`") # noqa: E501
|
||||
if ('password' in local_var_params and
|
||||
len(local_var_params['password']) > 64):
|
||||
raise ValueError("Invalid value for parameter `password` when calling `test_endpoint_parameters`, length must be less than or equal to `64`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `password` when calling `test_endpoint_parameters`, length must be less than or equal to `64`") # noqa: E501
|
||||
if ('password' in local_var_params and
|
||||
len(local_var_params['password']) < 10):
|
||||
raise ValueError("Invalid value for parameter `password` when calling `test_endpoint_parameters`, length must be greater than or equal to `10`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `password` when calling `test_endpoint_parameters`, length must be greater than or equal to `10`") # noqa: E501
|
||||
collection_formats = {}
|
||||
|
||||
path_params = {}
|
||||
@@ -1044,7 +1048,7 @@ class FakeApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method test_enum_parameters" % key
|
||||
)
|
||||
@@ -1163,7 +1167,7 @@ class FakeApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method test_group_parameters" % key
|
||||
)
|
||||
@@ -1172,15 +1176,15 @@ class FakeApi(object):
|
||||
# verify the required parameter 'required_string_group' is set
|
||||
if ('required_string_group' not in local_var_params or
|
||||
local_var_params['required_string_group'] is None):
|
||||
raise ValueError("Missing the required parameter `required_string_group` when calling `test_group_parameters`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `required_string_group` when calling `test_group_parameters`") # noqa: E501
|
||||
# verify the required parameter 'required_boolean_group' is set
|
||||
if ('required_boolean_group' not in local_var_params or
|
||||
local_var_params['required_boolean_group'] is None):
|
||||
raise ValueError("Missing the required parameter `required_boolean_group` when calling `test_group_parameters`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `required_boolean_group` when calling `test_group_parameters`") # noqa: E501
|
||||
# verify the required parameter 'required_int64_group' is set
|
||||
if ('required_int64_group' not in local_var_params or
|
||||
local_var_params['required_int64_group'] is None):
|
||||
raise ValueError("Missing the required parameter `required_int64_group` when calling `test_group_parameters`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `required_int64_group` when calling `test_group_parameters`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -1271,7 +1275,7 @@ class FakeApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method test_inline_additional_properties" % key
|
||||
)
|
||||
@@ -1280,7 +1284,7 @@ class FakeApi(object):
|
||||
# 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
|
||||
raise ApiValueError("Missing the required parameter `param` when calling `test_inline_additional_properties`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -1367,7 +1371,7 @@ class FakeApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method test_json_form_data" % key
|
||||
)
|
||||
@@ -1376,11 +1380,11 @@ class FakeApi(object):
|
||||
# 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_json_form_data`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `param` when calling `test_json_form_data`") # noqa: E501
|
||||
# verify the required parameter 'param2' is set
|
||||
if ('param2' not in local_var_params or
|
||||
local_var_params['param2'] is None):
|
||||
raise ValueError("Missing the required parameter `param2` when calling `test_json_form_data`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `param2` when calling `test_json_form_data`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
|
||||
@@ -18,6 +18,10 @@ import re # noqa: F401
|
||||
import six
|
||||
|
||||
from petstore_api.api_client import ApiClient
|
||||
from petstore_api.exceptions import (
|
||||
ApiTypeError,
|
||||
ApiValueError
|
||||
)
|
||||
|
||||
|
||||
class FakeClassnameTags123Api(object):
|
||||
@@ -80,7 +84,7 @@ class FakeClassnameTags123Api(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method test_classname" % key
|
||||
)
|
||||
@@ -89,7 +93,7 @@ class FakeClassnameTags123Api(object):
|
||||
# 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
|
||||
raise ApiValueError("Missing the required parameter `body` when calling `test_classname`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
|
||||
@@ -18,6 +18,10 @@ import re # noqa: F401
|
||||
import six
|
||||
|
||||
from petstore_api.api_client import ApiClient
|
||||
from petstore_api.exceptions import (
|
||||
ApiTypeError,
|
||||
ApiValueError
|
||||
)
|
||||
|
||||
|
||||
class PetApi(object):
|
||||
@@ -78,7 +82,7 @@ class PetApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method add_pet" % key
|
||||
)
|
||||
@@ -87,7 +91,7 @@ class PetApi(object):
|
||||
# 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
|
||||
raise ApiValueError("Missing the required parameter `body` when calling `add_pet`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -174,7 +178,7 @@ class PetApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method delete_pet" % key
|
||||
)
|
||||
@@ -183,7 +187,7 @@ class PetApi(object):
|
||||
# verify the required parameter 'pet_id' is set
|
||||
if ('pet_id' not in local_var_params or
|
||||
local_var_params['pet_id'] is None):
|
||||
raise ValueError("Missing the required parameter `pet_id` when calling `delete_pet`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `pet_id` when calling `delete_pet`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -268,7 +272,7 @@ class PetApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method find_pets_by_status" % key
|
||||
)
|
||||
@@ -277,7 +281,7 @@ class PetApi(object):
|
||||
# verify the required parameter 'status' is set
|
||||
if ('status' not in local_var_params or
|
||||
local_var_params['status'] is None):
|
||||
raise ValueError("Missing the required parameter `status` when calling `find_pets_by_status`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `status` when calling `find_pets_by_status`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -365,7 +369,7 @@ class PetApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method find_pets_by_tags" % key
|
||||
)
|
||||
@@ -374,7 +378,7 @@ class PetApi(object):
|
||||
# verify the required parameter 'tags' is set
|
||||
if ('tags' not in local_var_params or
|
||||
local_var_params['tags'] is None):
|
||||
raise ValueError("Missing the required parameter `tags` when calling `find_pets_by_tags`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `tags` when calling `find_pets_by_tags`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -462,7 +466,7 @@ class PetApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method get_pet_by_id" % key
|
||||
)
|
||||
@@ -471,7 +475,7 @@ class PetApi(object):
|
||||
# verify the required parameter 'pet_id' is set
|
||||
if ('pet_id' not in local_var_params or
|
||||
local_var_params['pet_id'] is None):
|
||||
raise ValueError("Missing the required parameter `pet_id` when calling `get_pet_by_id`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `pet_id` when calling `get_pet_by_id`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -556,7 +560,7 @@ class PetApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method update_pet" % key
|
||||
)
|
||||
@@ -565,7 +569,7 @@ class PetApi(object):
|
||||
# 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
|
||||
raise ApiValueError("Missing the required parameter `body` when calling `update_pet`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -654,7 +658,7 @@ class PetApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method update_pet_with_form" % key
|
||||
)
|
||||
@@ -663,7 +667,7 @@ class PetApi(object):
|
||||
# verify the required parameter 'pet_id' is set
|
||||
if ('pet_id' not in local_var_params or
|
||||
local_var_params['pet_id'] is None):
|
||||
raise ValueError("Missing the required parameter `pet_id` when calling `update_pet_with_form`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `pet_id` when calling `update_pet_with_form`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -756,7 +760,7 @@ class PetApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method upload_file" % key
|
||||
)
|
||||
@@ -765,7 +769,7 @@ class PetApi(object):
|
||||
# verify the required parameter 'pet_id' is set
|
||||
if ('pet_id' not in local_var_params or
|
||||
local_var_params['pet_id'] is None):
|
||||
raise ValueError("Missing the required parameter `pet_id` when calling `upload_file`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `pet_id` when calling `upload_file`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -862,7 +866,7 @@ class PetApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method upload_file_with_required_file" % key
|
||||
)
|
||||
@@ -871,11 +875,11 @@ class PetApi(object):
|
||||
# verify the required parameter 'pet_id' is set
|
||||
if ('pet_id' not in local_var_params or
|
||||
local_var_params['pet_id'] is None):
|
||||
raise ValueError("Missing the required parameter `pet_id` when calling `upload_file_with_required_file`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `pet_id` when calling `upload_file_with_required_file`") # noqa: E501
|
||||
# verify the required parameter 'required_file' is set
|
||||
if ('required_file' not in local_var_params or
|
||||
local_var_params['required_file'] is None):
|
||||
raise ValueError("Missing the required parameter `required_file` when calling `upload_file_with_required_file`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `required_file` when calling `upload_file_with_required_file`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
|
||||
@@ -18,6 +18,10 @@ import re # noqa: F401
|
||||
import six
|
||||
|
||||
from petstore_api.api_client import ApiClient
|
||||
from petstore_api.exceptions import (
|
||||
ApiTypeError,
|
||||
ApiValueError
|
||||
)
|
||||
|
||||
|
||||
class StoreApi(object):
|
||||
@@ -80,7 +84,7 @@ class StoreApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method delete_order" % key
|
||||
)
|
||||
@@ -89,7 +93,7 @@ class StoreApi(object):
|
||||
# verify the required parameter 'order_id' is set
|
||||
if ('order_id' not in local_var_params or
|
||||
local_var_params['order_id'] is None):
|
||||
raise ValueError("Missing the required parameter `order_id` when calling `delete_order`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `order_id` when calling `delete_order`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -170,7 +174,7 @@ class StoreApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method get_inventory" % key
|
||||
)
|
||||
@@ -260,7 +264,7 @@ class StoreApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method get_order_by_id" % key
|
||||
)
|
||||
@@ -269,12 +273,12 @@ class StoreApi(object):
|
||||
# verify the required parameter 'order_id' is set
|
||||
if ('order_id' not in local_var_params or
|
||||
local_var_params['order_id'] is None):
|
||||
raise ValueError("Missing the required parameter `order_id` when calling `get_order_by_id`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `order_id` when calling `get_order_by_id`") # noqa: E501
|
||||
|
||||
if 'order_id' in local_var_params and local_var_params['order_id'] > 5: # noqa: E501
|
||||
raise ValueError("Invalid value for parameter `order_id` when calling `get_order_by_id`, must be a value less than or equal to `5`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `order_id` when calling `get_order_by_id`, must be a value less than or equal to `5`") # noqa: E501
|
||||
if 'order_id' in local_var_params and local_var_params['order_id'] < 1: # noqa: E501
|
||||
raise ValueError("Invalid value for parameter `order_id` when calling `get_order_by_id`, must be a value greater than or equal to `1`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `order_id` when calling `get_order_by_id`, must be a value greater than or equal to `1`") # noqa: E501
|
||||
collection_formats = {}
|
||||
|
||||
path_params = {}
|
||||
@@ -358,7 +362,7 @@ class StoreApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method place_order" % key
|
||||
)
|
||||
@@ -367,7 +371,7 @@ class StoreApi(object):
|
||||
# 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
|
||||
raise ApiValueError("Missing the required parameter `body` when calling `place_order`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
|
||||
@@ -18,6 +18,10 @@ import re # noqa: F401
|
||||
import six
|
||||
|
||||
from petstore_api.api_client import ApiClient
|
||||
from petstore_api.exceptions import (
|
||||
ApiTypeError,
|
||||
ApiValueError
|
||||
)
|
||||
|
||||
|
||||
class UserApi(object):
|
||||
@@ -80,7 +84,7 @@ class UserApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method create_user" % key
|
||||
)
|
||||
@@ -89,7 +93,7 @@ class UserApi(object):
|
||||
# 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
|
||||
raise ApiValueError("Missing the required parameter `body` when calling `create_user`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -170,7 +174,7 @@ class UserApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method create_users_with_array_input" % key
|
||||
)
|
||||
@@ -179,7 +183,7 @@ class UserApi(object):
|
||||
# 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
|
||||
raise ApiValueError("Missing the required parameter `body` when calling `create_users_with_array_input`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -260,7 +264,7 @@ class UserApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method create_users_with_list_input" % key
|
||||
)
|
||||
@@ -269,7 +273,7 @@ class UserApi(object):
|
||||
# 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
|
||||
raise ApiValueError("Missing the required parameter `body` when calling `create_users_with_list_input`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -352,7 +356,7 @@ class UserApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method delete_user" % key
|
||||
)
|
||||
@@ -361,7 +365,7 @@ class UserApi(object):
|
||||
# verify the required parameter 'username' is set
|
||||
if ('username' not in local_var_params or
|
||||
local_var_params['username'] is None):
|
||||
raise ValueError("Missing the required parameter `username` when calling `delete_user`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `username` when calling `delete_user`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -442,7 +446,7 @@ class UserApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method get_user_by_name" % key
|
||||
)
|
||||
@@ -451,7 +455,7 @@ class UserApi(object):
|
||||
# verify the required parameter 'username' is set
|
||||
if ('username' not in local_var_params or
|
||||
local_var_params['username'] is None):
|
||||
raise ValueError("Missing the required parameter `username` when calling `get_user_by_name`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `username` when calling `get_user_by_name`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -538,7 +542,7 @@ class UserApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method login_user" % key
|
||||
)
|
||||
@@ -547,11 +551,11 @@ class UserApi(object):
|
||||
# verify the required parameter 'username' is set
|
||||
if ('username' not in local_var_params or
|
||||
local_var_params['username'] is None):
|
||||
raise ValueError("Missing the required parameter `username` when calling `login_user`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `username` when calling `login_user`") # noqa: E501
|
||||
# verify the required parameter 'password' is set
|
||||
if ('password' not in local_var_params or
|
||||
local_var_params['password'] is None):
|
||||
raise ValueError("Missing the required parameter `password` when calling `login_user`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `password` when calling `login_user`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -636,7 +640,7 @@ class UserApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method logout_user" % key
|
||||
)
|
||||
@@ -724,7 +728,7 @@ class UserApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method update_user" % key
|
||||
)
|
||||
@@ -733,11 +737,11 @@ class UserApi(object):
|
||||
# verify the required parameter 'username' is set
|
||||
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
|
||||
raise ApiValueError("Missing the required parameter `username` 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
|
||||
raise ApiValueError("Missing the required parameter `body` when calling `update_user`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ import tornado.gen
|
||||
from petstore_api.configuration import Configuration
|
||||
import petstore_api.models
|
||||
from petstore_api import rest
|
||||
from petstore_api.exceptions import ApiValueError
|
||||
|
||||
|
||||
class ApiClient(object):
|
||||
@@ -408,7 +409,7 @@ class ApiClient(object):
|
||||
_request_timeout=_request_timeout,
|
||||
body=body)
|
||||
else:
|
||||
raise ValueError(
|
||||
raise ApiValueError(
|
||||
"http method must be `GET`, `HEAD`, `OPTIONS`,"
|
||||
" `POST`, `PATCH`, `PUT` or `DELETE`."
|
||||
)
|
||||
@@ -525,7 +526,7 @@ class ApiClient(object):
|
||||
elif auth_setting['in'] == 'query':
|
||||
querys.append((auth_setting['key'], auth_setting['value']))
|
||||
else:
|
||||
raise ValueError(
|
||||
raise ApiValueError(
|
||||
'Authentication token must be in `query` or `header`'
|
||||
)
|
||||
|
||||
|
||||
@@ -23,6 +23,8 @@ import tornado.gen
|
||||
from tornado import httpclient
|
||||
from urllib3.filepost import encode_multipart_formdata
|
||||
|
||||
from petstore_api.exceptions import ApiException, ApiValueError
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -95,7 +97,7 @@ class RESTClientObject(object):
|
||||
'PATCH', 'OPTIONS']
|
||||
|
||||
if post_params and body:
|
||||
raise ValueError(
|
||||
raise ApiValueError(
|
||||
"body parameter cannot be used with post_params parameter."
|
||||
)
|
||||
|
||||
@@ -233,31 +235,3 @@ class RESTClientObject(object):
|
||||
_request_timeout=_request_timeout,
|
||||
body=body)
|
||||
raise tornado.gen.Return(result)
|
||||
|
||||
|
||||
class ApiException(Exception):
|
||||
|
||||
def __init__(self, status=None, reason=None, http_resp=None):
|
||||
if http_resp:
|
||||
self.status = http_resp.status
|
||||
self.reason = http_resp.reason
|
||||
self.body = http_resp.data
|
||||
self.headers = http_resp.getheaders()
|
||||
else:
|
||||
self.status = status
|
||||
self.reason = reason
|
||||
self.body = None
|
||||
self.headers = None
|
||||
|
||||
def __str__(self):
|
||||
"""Custom error messages for exception"""
|
||||
error_message = "({0})\nReason: {1}\n".format(
|
||||
self.status, self.reason)
|
||||
if self.headers:
|
||||
error_message += "HTTP response headers: {0}\n".format(
|
||||
self.headers)
|
||||
|
||||
if self.body:
|
||||
error_message += "HTTP response body: {0}\n".format(self.body)
|
||||
|
||||
return error_message
|
||||
|
||||
@@ -27,6 +27,11 @@ from petstore_api.api.user_api import UserApi
|
||||
# import ApiClient
|
||||
from petstore_api.api_client import ApiClient
|
||||
from petstore_api.configuration import Configuration
|
||||
from petstore_api.exceptions import OpenApiException
|
||||
from petstore_api.exceptions import ApiTypeError
|
||||
from petstore_api.exceptions import ApiValueError
|
||||
from petstore_api.exceptions import ApiKeyError
|
||||
from petstore_api.exceptions import ApiException
|
||||
# import models into sdk package
|
||||
from petstore_api.models.additional_properties_any_type import AdditionalPropertiesAnyType
|
||||
from petstore_api.models.additional_properties_array import AdditionalPropertiesArray
|
||||
@@ -72,3 +77,4 @@ 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
|
||||
from petstore_api.models.xml_item import XmlItem
|
||||
|
||||
|
||||
@@ -18,6 +18,10 @@ import re # noqa: F401
|
||||
import six
|
||||
|
||||
from petstore_api.api_client import ApiClient
|
||||
from petstore_api.exceptions import (
|
||||
ApiTypeError,
|
||||
ApiValueError
|
||||
)
|
||||
|
||||
|
||||
class AnotherFakeApi(object):
|
||||
@@ -80,7 +84,7 @@ class AnotherFakeApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method call_123_test_special_tags" % key
|
||||
)
|
||||
@@ -89,7 +93,7 @@ class AnotherFakeApi(object):
|
||||
# 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
|
||||
raise ApiValueError("Missing the required parameter `body` when calling `call_123_test_special_tags`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
|
||||
@@ -18,6 +18,10 @@ import re # noqa: F401
|
||||
import six
|
||||
|
||||
from petstore_api.api_client import ApiClient
|
||||
from petstore_api.exceptions import (
|
||||
ApiTypeError,
|
||||
ApiValueError
|
||||
)
|
||||
|
||||
|
||||
class FakeApi(object):
|
||||
@@ -80,7 +84,7 @@ class FakeApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method create_xml_item" % key
|
||||
)
|
||||
@@ -89,7 +93,7 @@ class FakeApi(object):
|
||||
# verify the required parameter 'xml_item' is set
|
||||
if ('xml_item' not in local_var_params or
|
||||
local_var_params['xml_item'] is None):
|
||||
raise ValueError("Missing the required parameter `xml_item` when calling `create_xml_item`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `xml_item` when calling `create_xml_item`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -176,7 +180,7 @@ class FakeApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method fake_outer_boolean_serialize" % key
|
||||
)
|
||||
@@ -268,7 +272,7 @@ class FakeApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method fake_outer_composite_serialize" % key
|
||||
)
|
||||
@@ -360,7 +364,7 @@ class FakeApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method fake_outer_number_serialize" % key
|
||||
)
|
||||
@@ -452,7 +456,7 @@ class FakeApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method fake_outer_string_serialize" % key
|
||||
)
|
||||
@@ -544,7 +548,7 @@ class FakeApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method test_body_with_file_schema" % key
|
||||
)
|
||||
@@ -553,7 +557,7 @@ class FakeApi(object):
|
||||
# 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
|
||||
raise ApiValueError("Missing the required parameter `body` when calling `test_body_with_file_schema`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -640,7 +644,7 @@ class FakeApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method test_body_with_query_params" % key
|
||||
)
|
||||
@@ -649,11 +653,11 @@ class FakeApi(object):
|
||||
# verify the required parameter 'query' is set
|
||||
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
|
||||
raise ApiValueError("Missing the required parameter `query` 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
|
||||
raise ApiValueError("Missing the required parameter `body` when calling `test_body_with_query_params`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -742,7 +746,7 @@ class FakeApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method test_client_model" % key
|
||||
)
|
||||
@@ -751,7 +755,7 @@ class FakeApi(object):
|
||||
# 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
|
||||
raise ApiValueError("Missing the required parameter `body` when calling `test_client_model`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -868,7 +872,7 @@ class FakeApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method test_endpoint_parameters" % key
|
||||
)
|
||||
@@ -877,48 +881,48 @@ class FakeApi(object):
|
||||
# verify the required parameter 'number' is set
|
||||
if ('number' not in local_var_params or
|
||||
local_var_params['number'] is None):
|
||||
raise ValueError("Missing the required parameter `number` when calling `test_endpoint_parameters`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `number` when calling `test_endpoint_parameters`") # noqa: E501
|
||||
# verify the required parameter 'double' is set
|
||||
if ('double' not in local_var_params or
|
||||
local_var_params['double'] is None):
|
||||
raise ValueError("Missing the required parameter `double` when calling `test_endpoint_parameters`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `double` when calling `test_endpoint_parameters`") # noqa: E501
|
||||
# verify the required parameter 'pattern_without_delimiter' is set
|
||||
if ('pattern_without_delimiter' not in local_var_params or
|
||||
local_var_params['pattern_without_delimiter'] is None):
|
||||
raise ValueError("Missing the required parameter `pattern_without_delimiter` when calling `test_endpoint_parameters`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `pattern_without_delimiter` when calling `test_endpoint_parameters`") # noqa: E501
|
||||
# verify the required parameter 'byte' is set
|
||||
if ('byte' not in local_var_params or
|
||||
local_var_params['byte'] is None):
|
||||
raise ValueError("Missing the required parameter `byte` when calling `test_endpoint_parameters`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `byte` when calling `test_endpoint_parameters`") # noqa: E501
|
||||
|
||||
if 'number' in local_var_params and local_var_params['number'] > 543.2: # noqa: E501
|
||||
raise ValueError("Invalid value for parameter `number` when calling `test_endpoint_parameters`, must be a value less than or equal to `543.2`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `number` when calling `test_endpoint_parameters`, must be a value less than or equal to `543.2`") # noqa: E501
|
||||
if 'number' in local_var_params and local_var_params['number'] < 32.1: # noqa: E501
|
||||
raise ValueError("Invalid value for parameter `number` when calling `test_endpoint_parameters`, must be a value greater than or equal to `32.1`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `number` when calling `test_endpoint_parameters`, must be a value greater than or equal to `32.1`") # noqa: E501
|
||||
if 'double' in local_var_params and local_var_params['double'] > 123.4: # noqa: E501
|
||||
raise ValueError("Invalid value for parameter `double` when calling `test_endpoint_parameters`, must be a value less than or equal to `123.4`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `double` when calling `test_endpoint_parameters`, must be a value less than or equal to `123.4`") # noqa: E501
|
||||
if 'double' in local_var_params and local_var_params['double'] < 67.8: # noqa: E501
|
||||
raise ValueError("Invalid value for parameter `double` when calling `test_endpoint_parameters`, must be a value greater than or equal to `67.8`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `double` when calling `test_endpoint_parameters`, must be a value greater than or equal to `67.8`") # noqa: E501
|
||||
if 'pattern_without_delimiter' in local_var_params and not re.search(r'^[A-Z].*', local_var_params['pattern_without_delimiter']): # noqa: E501
|
||||
raise ValueError("Invalid value for parameter `pattern_without_delimiter` when calling `test_endpoint_parameters`, must conform to the pattern `/^[A-Z].*/`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `pattern_without_delimiter` when calling `test_endpoint_parameters`, must conform to the pattern `/^[A-Z].*/`") # noqa: E501
|
||||
if 'integer' in local_var_params and local_var_params['integer'] > 100: # noqa: E501
|
||||
raise ValueError("Invalid value for parameter `integer` when calling `test_endpoint_parameters`, must be a value less than or equal to `100`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `integer` when calling `test_endpoint_parameters`, must be a value less than or equal to `100`") # noqa: E501
|
||||
if 'integer' in local_var_params and local_var_params['integer'] < 10: # noqa: E501
|
||||
raise ValueError("Invalid value for parameter `integer` when calling `test_endpoint_parameters`, must be a value greater than or equal to `10`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `integer` when calling `test_endpoint_parameters`, must be a value greater than or equal to `10`") # noqa: E501
|
||||
if 'int32' in local_var_params and local_var_params['int32'] > 200: # noqa: E501
|
||||
raise ValueError("Invalid value for parameter `int32` when calling `test_endpoint_parameters`, must be a value less than or equal to `200`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `int32` when calling `test_endpoint_parameters`, must be a value less than or equal to `200`") # noqa: E501
|
||||
if 'int32' in local_var_params and local_var_params['int32'] < 20: # noqa: E501
|
||||
raise ValueError("Invalid value for parameter `int32` when calling `test_endpoint_parameters`, must be a value greater than or equal to `20`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `int32` when calling `test_endpoint_parameters`, must be a value greater than or equal to `20`") # noqa: E501
|
||||
if 'float' in local_var_params and local_var_params['float'] > 987.6: # noqa: E501
|
||||
raise ValueError("Invalid value for parameter `float` when calling `test_endpoint_parameters`, must be a value less than or equal to `987.6`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `float` when calling `test_endpoint_parameters`, must be a value less than or equal to `987.6`") # noqa: E501
|
||||
if 'string' in local_var_params and not re.search(r'[a-z]', local_var_params['string'], flags=re.IGNORECASE): # noqa: E501
|
||||
raise ValueError("Invalid value for parameter `string` when calling `test_endpoint_parameters`, must conform to the pattern `/[a-z]/i`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `string` when calling `test_endpoint_parameters`, must conform to the pattern `/[a-z]/i`") # noqa: E501
|
||||
if ('password' in local_var_params and
|
||||
len(local_var_params['password']) > 64):
|
||||
raise ValueError("Invalid value for parameter `password` when calling `test_endpoint_parameters`, length must be less than or equal to `64`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `password` when calling `test_endpoint_parameters`, length must be less than or equal to `64`") # noqa: E501
|
||||
if ('password' in local_var_params and
|
||||
len(local_var_params['password']) < 10):
|
||||
raise ValueError("Invalid value for parameter `password` when calling `test_endpoint_parameters`, length must be greater than or equal to `10`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `password` when calling `test_endpoint_parameters`, length must be greater than or equal to `10`") # noqa: E501
|
||||
collection_formats = {}
|
||||
|
||||
path_params = {}
|
||||
@@ -1044,7 +1048,7 @@ class FakeApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method test_enum_parameters" % key
|
||||
)
|
||||
@@ -1163,7 +1167,7 @@ class FakeApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method test_group_parameters" % key
|
||||
)
|
||||
@@ -1172,15 +1176,15 @@ class FakeApi(object):
|
||||
# verify the required parameter 'required_string_group' is set
|
||||
if ('required_string_group' not in local_var_params or
|
||||
local_var_params['required_string_group'] is None):
|
||||
raise ValueError("Missing the required parameter `required_string_group` when calling `test_group_parameters`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `required_string_group` when calling `test_group_parameters`") # noqa: E501
|
||||
# verify the required parameter 'required_boolean_group' is set
|
||||
if ('required_boolean_group' not in local_var_params or
|
||||
local_var_params['required_boolean_group'] is None):
|
||||
raise ValueError("Missing the required parameter `required_boolean_group` when calling `test_group_parameters`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `required_boolean_group` when calling `test_group_parameters`") # noqa: E501
|
||||
# verify the required parameter 'required_int64_group' is set
|
||||
if ('required_int64_group' not in local_var_params or
|
||||
local_var_params['required_int64_group'] is None):
|
||||
raise ValueError("Missing the required parameter `required_int64_group` when calling `test_group_parameters`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `required_int64_group` when calling `test_group_parameters`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -1271,7 +1275,7 @@ class FakeApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method test_inline_additional_properties" % key
|
||||
)
|
||||
@@ -1280,7 +1284,7 @@ class FakeApi(object):
|
||||
# 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
|
||||
raise ApiValueError("Missing the required parameter `param` when calling `test_inline_additional_properties`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -1367,7 +1371,7 @@ class FakeApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method test_json_form_data" % key
|
||||
)
|
||||
@@ -1376,11 +1380,11 @@ class FakeApi(object):
|
||||
# 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_json_form_data`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `param` when calling `test_json_form_data`") # noqa: E501
|
||||
# verify the required parameter 'param2' is set
|
||||
if ('param2' not in local_var_params or
|
||||
local_var_params['param2'] is None):
|
||||
raise ValueError("Missing the required parameter `param2` when calling `test_json_form_data`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `param2` when calling `test_json_form_data`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
|
||||
@@ -18,6 +18,10 @@ import re # noqa: F401
|
||||
import six
|
||||
|
||||
from petstore_api.api_client import ApiClient
|
||||
from petstore_api.exceptions import (
|
||||
ApiTypeError,
|
||||
ApiValueError
|
||||
)
|
||||
|
||||
|
||||
class FakeClassnameTags123Api(object):
|
||||
@@ -80,7 +84,7 @@ class FakeClassnameTags123Api(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method test_classname" % key
|
||||
)
|
||||
@@ -89,7 +93,7 @@ class FakeClassnameTags123Api(object):
|
||||
# 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
|
||||
raise ApiValueError("Missing the required parameter `body` when calling `test_classname`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
|
||||
@@ -18,6 +18,10 @@ import re # noqa: F401
|
||||
import six
|
||||
|
||||
from petstore_api.api_client import ApiClient
|
||||
from petstore_api.exceptions import (
|
||||
ApiTypeError,
|
||||
ApiValueError
|
||||
)
|
||||
|
||||
|
||||
class PetApi(object):
|
||||
@@ -78,7 +82,7 @@ class PetApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method add_pet" % key
|
||||
)
|
||||
@@ -87,7 +91,7 @@ class PetApi(object):
|
||||
# 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
|
||||
raise ApiValueError("Missing the required parameter `body` when calling `add_pet`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -174,7 +178,7 @@ class PetApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method delete_pet" % key
|
||||
)
|
||||
@@ -183,7 +187,7 @@ class PetApi(object):
|
||||
# verify the required parameter 'pet_id' is set
|
||||
if ('pet_id' not in local_var_params or
|
||||
local_var_params['pet_id'] is None):
|
||||
raise ValueError("Missing the required parameter `pet_id` when calling `delete_pet`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `pet_id` when calling `delete_pet`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -268,7 +272,7 @@ class PetApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method find_pets_by_status" % key
|
||||
)
|
||||
@@ -277,7 +281,7 @@ class PetApi(object):
|
||||
# verify the required parameter 'status' is set
|
||||
if ('status' not in local_var_params or
|
||||
local_var_params['status'] is None):
|
||||
raise ValueError("Missing the required parameter `status` when calling `find_pets_by_status`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `status` when calling `find_pets_by_status`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -365,7 +369,7 @@ class PetApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method find_pets_by_tags" % key
|
||||
)
|
||||
@@ -374,7 +378,7 @@ class PetApi(object):
|
||||
# verify the required parameter 'tags' is set
|
||||
if ('tags' not in local_var_params or
|
||||
local_var_params['tags'] is None):
|
||||
raise ValueError("Missing the required parameter `tags` when calling `find_pets_by_tags`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `tags` when calling `find_pets_by_tags`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -462,7 +466,7 @@ class PetApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method get_pet_by_id" % key
|
||||
)
|
||||
@@ -471,7 +475,7 @@ class PetApi(object):
|
||||
# verify the required parameter 'pet_id' is set
|
||||
if ('pet_id' not in local_var_params or
|
||||
local_var_params['pet_id'] is None):
|
||||
raise ValueError("Missing the required parameter `pet_id` when calling `get_pet_by_id`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `pet_id` when calling `get_pet_by_id`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -556,7 +560,7 @@ class PetApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method update_pet" % key
|
||||
)
|
||||
@@ -565,7 +569,7 @@ class PetApi(object):
|
||||
# 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
|
||||
raise ApiValueError("Missing the required parameter `body` when calling `update_pet`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -654,7 +658,7 @@ class PetApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method update_pet_with_form" % key
|
||||
)
|
||||
@@ -663,7 +667,7 @@ class PetApi(object):
|
||||
# verify the required parameter 'pet_id' is set
|
||||
if ('pet_id' not in local_var_params or
|
||||
local_var_params['pet_id'] is None):
|
||||
raise ValueError("Missing the required parameter `pet_id` when calling `update_pet_with_form`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `pet_id` when calling `update_pet_with_form`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -756,7 +760,7 @@ class PetApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method upload_file" % key
|
||||
)
|
||||
@@ -765,7 +769,7 @@ class PetApi(object):
|
||||
# verify the required parameter 'pet_id' is set
|
||||
if ('pet_id' not in local_var_params or
|
||||
local_var_params['pet_id'] is None):
|
||||
raise ValueError("Missing the required parameter `pet_id` when calling `upload_file`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `pet_id` when calling `upload_file`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -862,7 +866,7 @@ class PetApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method upload_file_with_required_file" % key
|
||||
)
|
||||
@@ -871,11 +875,11 @@ class PetApi(object):
|
||||
# verify the required parameter 'pet_id' is set
|
||||
if ('pet_id' not in local_var_params or
|
||||
local_var_params['pet_id'] is None):
|
||||
raise ValueError("Missing the required parameter `pet_id` when calling `upload_file_with_required_file`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `pet_id` when calling `upload_file_with_required_file`") # noqa: E501
|
||||
# verify the required parameter 'required_file' is set
|
||||
if ('required_file' not in local_var_params or
|
||||
local_var_params['required_file'] is None):
|
||||
raise ValueError("Missing the required parameter `required_file` when calling `upload_file_with_required_file`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `required_file` when calling `upload_file_with_required_file`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
|
||||
@@ -18,6 +18,10 @@ import re # noqa: F401
|
||||
import six
|
||||
|
||||
from petstore_api.api_client import ApiClient
|
||||
from petstore_api.exceptions import (
|
||||
ApiTypeError,
|
||||
ApiValueError
|
||||
)
|
||||
|
||||
|
||||
class StoreApi(object):
|
||||
@@ -80,7 +84,7 @@ class StoreApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method delete_order" % key
|
||||
)
|
||||
@@ -89,7 +93,7 @@ class StoreApi(object):
|
||||
# verify the required parameter 'order_id' is set
|
||||
if ('order_id' not in local_var_params or
|
||||
local_var_params['order_id'] is None):
|
||||
raise ValueError("Missing the required parameter `order_id` when calling `delete_order`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `order_id` when calling `delete_order`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -170,7 +174,7 @@ class StoreApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method get_inventory" % key
|
||||
)
|
||||
@@ -260,7 +264,7 @@ class StoreApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method get_order_by_id" % key
|
||||
)
|
||||
@@ -269,12 +273,12 @@ class StoreApi(object):
|
||||
# verify the required parameter 'order_id' is set
|
||||
if ('order_id' not in local_var_params or
|
||||
local_var_params['order_id'] is None):
|
||||
raise ValueError("Missing the required parameter `order_id` when calling `get_order_by_id`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `order_id` when calling `get_order_by_id`") # noqa: E501
|
||||
|
||||
if 'order_id' in local_var_params and local_var_params['order_id'] > 5: # noqa: E501
|
||||
raise ValueError("Invalid value for parameter `order_id` when calling `get_order_by_id`, must be a value less than or equal to `5`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `order_id` when calling `get_order_by_id`, must be a value less than or equal to `5`") # noqa: E501
|
||||
if 'order_id' in local_var_params and local_var_params['order_id'] < 1: # noqa: E501
|
||||
raise ValueError("Invalid value for parameter `order_id` when calling `get_order_by_id`, must be a value greater than or equal to `1`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `order_id` when calling `get_order_by_id`, must be a value greater than or equal to `1`") # noqa: E501
|
||||
collection_formats = {}
|
||||
|
||||
path_params = {}
|
||||
@@ -358,7 +362,7 @@ class StoreApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method place_order" % key
|
||||
)
|
||||
@@ -367,7 +371,7 @@ class StoreApi(object):
|
||||
# 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
|
||||
raise ApiValueError("Missing the required parameter `body` when calling `place_order`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
|
||||
@@ -18,6 +18,10 @@ import re # noqa: F401
|
||||
import six
|
||||
|
||||
from petstore_api.api_client import ApiClient
|
||||
from petstore_api.exceptions import (
|
||||
ApiTypeError,
|
||||
ApiValueError
|
||||
)
|
||||
|
||||
|
||||
class UserApi(object):
|
||||
@@ -80,7 +84,7 @@ class UserApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method create_user" % key
|
||||
)
|
||||
@@ -89,7 +93,7 @@ class UserApi(object):
|
||||
# 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
|
||||
raise ApiValueError("Missing the required parameter `body` when calling `create_user`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -170,7 +174,7 @@ class UserApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method create_users_with_array_input" % key
|
||||
)
|
||||
@@ -179,7 +183,7 @@ class UserApi(object):
|
||||
# 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
|
||||
raise ApiValueError("Missing the required parameter `body` when calling `create_users_with_array_input`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -260,7 +264,7 @@ class UserApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method create_users_with_list_input" % key
|
||||
)
|
||||
@@ -269,7 +273,7 @@ class UserApi(object):
|
||||
# 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
|
||||
raise ApiValueError("Missing the required parameter `body` when calling `create_users_with_list_input`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -352,7 +356,7 @@ class UserApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method delete_user" % key
|
||||
)
|
||||
@@ -361,7 +365,7 @@ class UserApi(object):
|
||||
# verify the required parameter 'username' is set
|
||||
if ('username' not in local_var_params or
|
||||
local_var_params['username'] is None):
|
||||
raise ValueError("Missing the required parameter `username` when calling `delete_user`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `username` when calling `delete_user`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -442,7 +446,7 @@ class UserApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method get_user_by_name" % key
|
||||
)
|
||||
@@ -451,7 +455,7 @@ class UserApi(object):
|
||||
# verify the required parameter 'username' is set
|
||||
if ('username' not in local_var_params or
|
||||
local_var_params['username'] is None):
|
||||
raise ValueError("Missing the required parameter `username` when calling `get_user_by_name`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `username` when calling `get_user_by_name`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -538,7 +542,7 @@ class UserApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method login_user" % key
|
||||
)
|
||||
@@ -547,11 +551,11 @@ class UserApi(object):
|
||||
# verify the required parameter 'username' is set
|
||||
if ('username' not in local_var_params or
|
||||
local_var_params['username'] is None):
|
||||
raise ValueError("Missing the required parameter `username` when calling `login_user`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `username` when calling `login_user`") # noqa: E501
|
||||
# verify the required parameter 'password' is set
|
||||
if ('password' not in local_var_params or
|
||||
local_var_params['password'] is None):
|
||||
raise ValueError("Missing the required parameter `password` when calling `login_user`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `password` when calling `login_user`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -636,7 +640,7 @@ class UserApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method logout_user" % key
|
||||
)
|
||||
@@ -724,7 +728,7 @@ class UserApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method update_user" % key
|
||||
)
|
||||
@@ -733,11 +737,11 @@ class UserApi(object):
|
||||
# verify the required parameter 'username' is set
|
||||
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
|
||||
raise ApiValueError("Missing the required parameter `username` 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
|
||||
raise ApiValueError("Missing the required parameter `body` when calling `update_user`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ from six.moves.urllib.parse import quote
|
||||
from petstore_api.configuration import Configuration
|
||||
import petstore_api.models
|
||||
from petstore_api import rest
|
||||
from petstore_api.exceptions import ApiValueError
|
||||
|
||||
|
||||
class ApiClient(object):
|
||||
@@ -406,7 +407,7 @@ class ApiClient(object):
|
||||
_request_timeout=_request_timeout,
|
||||
body=body)
|
||||
else:
|
||||
raise ValueError(
|
||||
raise ApiValueError(
|
||||
"http method must be `GET`, `HEAD`, `OPTIONS`,"
|
||||
" `POST`, `PATCH`, `PUT` or `DELETE`."
|
||||
)
|
||||
@@ -523,7 +524,7 @@ class ApiClient(object):
|
||||
elif auth_setting['in'] == 'query':
|
||||
querys.append((auth_setting['key'], auth_setting['value']))
|
||||
else:
|
||||
raise ValueError(
|
||||
raise ApiValueError(
|
||||
'Authentication token must be in `query` or `header`'
|
||||
)
|
||||
|
||||
|
||||
@@ -22,11 +22,9 @@ import certifi
|
||||
# python 2 and python 3 compatibility library
|
||||
import six
|
||||
from six.moves.urllib.parse import urlencode
|
||||
import urllib3
|
||||
|
||||
try:
|
||||
import urllib3
|
||||
except ImportError:
|
||||
raise ImportError('OpenAPI Python client requires urllib3.')
|
||||
from petstore_api.exceptions import ApiException, ApiValueError
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -133,7 +131,7 @@ class RESTClientObject(object):
|
||||
'PATCH', 'OPTIONS']
|
||||
|
||||
if post_params and body:
|
||||
raise ValueError(
|
||||
raise ApiValueError(
|
||||
"body parameter cannot be used with post_params parameter."
|
||||
)
|
||||
|
||||
@@ -295,31 +293,3 @@ class RESTClientObject(object):
|
||||
_preload_content=_preload_content,
|
||||
_request_timeout=_request_timeout,
|
||||
body=body)
|
||||
|
||||
|
||||
class ApiException(Exception):
|
||||
|
||||
def __init__(self, status=None, reason=None, http_resp=None):
|
||||
if http_resp:
|
||||
self.status = http_resp.status
|
||||
self.reason = http_resp.reason
|
||||
self.body = http_resp.data
|
||||
self.headers = http_resp.getheaders()
|
||||
else:
|
||||
self.status = status
|
||||
self.reason = reason
|
||||
self.body = None
|
||||
self.headers = None
|
||||
|
||||
def __str__(self):
|
||||
"""Custom error messages for exception"""
|
||||
error_message = "({0})\n"\
|
||||
"Reason: {1}\n".format(self.status, self.reason)
|
||||
if self.headers:
|
||||
error_message += "HTTP response headers: {0}\n".format(
|
||||
self.headers)
|
||||
|
||||
if self.body:
|
||||
error_message += "HTTP response body: {0}\n".format(self.body)
|
||||
|
||||
return error_message
|
||||
|
||||
@@ -28,6 +28,11 @@ from petstore_api.api.user_api import UserApi
|
||||
# import ApiClient
|
||||
from petstore_api.api_client import ApiClient
|
||||
from petstore_api.configuration import Configuration
|
||||
from petstore_api.exceptions import OpenApiException
|
||||
from petstore_api.exceptions import ApiTypeError
|
||||
from petstore_api.exceptions import ApiValueError
|
||||
from petstore_api.exceptions import ApiKeyError
|
||||
from petstore_api.exceptions import ApiException
|
||||
# import models into sdk package
|
||||
from petstore_api.models.additional_properties_class import AdditionalPropertiesClass
|
||||
from petstore_api.models.animal import Animal
|
||||
@@ -76,3 +81,4 @@ 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.user import User
|
||||
|
||||
|
||||
@@ -18,6 +18,10 @@ import re # noqa: F401
|
||||
import six
|
||||
|
||||
from petstore_api.api_client import ApiClient
|
||||
from petstore_api.exceptions import (
|
||||
ApiTypeError,
|
||||
ApiValueError
|
||||
)
|
||||
|
||||
|
||||
class AnotherFakeApi(object):
|
||||
@@ -80,7 +84,7 @@ class AnotherFakeApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method call_123_test_special_tags" % key
|
||||
)
|
||||
@@ -89,7 +93,7 @@ class AnotherFakeApi(object):
|
||||
# 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
|
||||
raise ApiValueError("Missing the required parameter `client` when calling `call_123_test_special_tags`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
|
||||
@@ -18,6 +18,10 @@ import re # noqa: F401
|
||||
import six
|
||||
|
||||
from petstore_api.api_client import ApiClient
|
||||
from petstore_api.exceptions import (
|
||||
ApiTypeError,
|
||||
ApiValueError
|
||||
)
|
||||
|
||||
|
||||
class DefaultApi(object):
|
||||
@@ -76,7 +80,7 @@ class DefaultApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method foo_get" % key
|
||||
)
|
||||
|
||||
@@ -18,6 +18,10 @@ import re # noqa: F401
|
||||
import six
|
||||
|
||||
from petstore_api.api_client import ApiClient
|
||||
from petstore_api.exceptions import (
|
||||
ApiTypeError,
|
||||
ApiValueError
|
||||
)
|
||||
|
||||
|
||||
class FakeApi(object):
|
||||
@@ -76,7 +80,7 @@ class FakeApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method fake_health_get" % key
|
||||
)
|
||||
@@ -166,7 +170,7 @@ class FakeApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method fake_outer_boolean_serialize" % key
|
||||
)
|
||||
@@ -262,7 +266,7 @@ class FakeApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method fake_outer_composite_serialize" % key
|
||||
)
|
||||
@@ -358,7 +362,7 @@ class FakeApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method fake_outer_number_serialize" % key
|
||||
)
|
||||
@@ -454,7 +458,7 @@ class FakeApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method fake_outer_string_serialize" % key
|
||||
)
|
||||
@@ -550,7 +554,7 @@ class FakeApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method test_body_with_file_schema" % key
|
||||
)
|
||||
@@ -559,7 +563,7 @@ class FakeApi(object):
|
||||
# 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
|
||||
raise ApiValueError("Missing the required parameter `file_schema_test_class` when calling `test_body_with_file_schema`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -646,7 +650,7 @@ class FakeApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method test_body_with_query_params" % key
|
||||
)
|
||||
@@ -655,11 +659,11 @@ class FakeApi(object):
|
||||
# verify the required parameter 'query' is set
|
||||
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
|
||||
raise ApiValueError("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
|
||||
raise ApiValueError("Missing the required parameter `user` when calling `test_body_with_query_params`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -748,7 +752,7 @@ class FakeApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method test_client_model" % key
|
||||
)
|
||||
@@ -757,7 +761,7 @@ class FakeApi(object):
|
||||
# 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
|
||||
raise ApiValueError("Missing the required parameter `client` when calling `test_client_model`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -874,7 +878,7 @@ class FakeApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method test_endpoint_parameters" % key
|
||||
)
|
||||
@@ -883,48 +887,48 @@ class FakeApi(object):
|
||||
# verify the required parameter 'number' is set
|
||||
if ('number' not in local_var_params or
|
||||
local_var_params['number'] is None):
|
||||
raise ValueError("Missing the required parameter `number` when calling `test_endpoint_parameters`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `number` when calling `test_endpoint_parameters`") # noqa: E501
|
||||
# verify the required parameter 'double' is set
|
||||
if ('double' not in local_var_params or
|
||||
local_var_params['double'] is None):
|
||||
raise ValueError("Missing the required parameter `double` when calling `test_endpoint_parameters`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `double` when calling `test_endpoint_parameters`") # noqa: E501
|
||||
# verify the required parameter 'pattern_without_delimiter' is set
|
||||
if ('pattern_without_delimiter' not in local_var_params or
|
||||
local_var_params['pattern_without_delimiter'] is None):
|
||||
raise ValueError("Missing the required parameter `pattern_without_delimiter` when calling `test_endpoint_parameters`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `pattern_without_delimiter` when calling `test_endpoint_parameters`") # noqa: E501
|
||||
# verify the required parameter 'byte' is set
|
||||
if ('byte' not in local_var_params or
|
||||
local_var_params['byte'] is None):
|
||||
raise ValueError("Missing the required parameter `byte` when calling `test_endpoint_parameters`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `byte` when calling `test_endpoint_parameters`") # noqa: E501
|
||||
|
||||
if 'number' in local_var_params and local_var_params['number'] > 543.2: # noqa: E501
|
||||
raise ValueError("Invalid value for parameter `number` when calling `test_endpoint_parameters`, must be a value less than or equal to `543.2`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `number` when calling `test_endpoint_parameters`, must be a value less than or equal to `543.2`") # noqa: E501
|
||||
if 'number' in local_var_params and local_var_params['number'] < 32.1: # noqa: E501
|
||||
raise ValueError("Invalid value for parameter `number` when calling `test_endpoint_parameters`, must be a value greater than or equal to `32.1`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `number` when calling `test_endpoint_parameters`, must be a value greater than or equal to `32.1`") # noqa: E501
|
||||
if 'double' in local_var_params and local_var_params['double'] > 123.4: # noqa: E501
|
||||
raise ValueError("Invalid value for parameter `double` when calling `test_endpoint_parameters`, must be a value less than or equal to `123.4`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `double` when calling `test_endpoint_parameters`, must be a value less than or equal to `123.4`") # noqa: E501
|
||||
if 'double' in local_var_params and local_var_params['double'] < 67.8: # noqa: E501
|
||||
raise ValueError("Invalid value for parameter `double` when calling `test_endpoint_parameters`, must be a value greater than or equal to `67.8`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `double` when calling `test_endpoint_parameters`, must be a value greater than or equal to `67.8`") # noqa: E501
|
||||
if 'pattern_without_delimiter' in local_var_params and not re.search(r'^[A-Z].*', local_var_params['pattern_without_delimiter']): # noqa: E501
|
||||
raise ValueError("Invalid value for parameter `pattern_without_delimiter` when calling `test_endpoint_parameters`, must conform to the pattern `/^[A-Z].*/`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `pattern_without_delimiter` when calling `test_endpoint_parameters`, must conform to the pattern `/^[A-Z].*/`") # noqa: E501
|
||||
if 'integer' in local_var_params and local_var_params['integer'] > 100: # noqa: E501
|
||||
raise ValueError("Invalid value for parameter `integer` when calling `test_endpoint_parameters`, must be a value less than or equal to `100`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `integer` when calling `test_endpoint_parameters`, must be a value less than or equal to `100`") # noqa: E501
|
||||
if 'integer' in local_var_params and local_var_params['integer'] < 10: # noqa: E501
|
||||
raise ValueError("Invalid value for parameter `integer` when calling `test_endpoint_parameters`, must be a value greater than or equal to `10`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `integer` when calling `test_endpoint_parameters`, must be a value greater than or equal to `10`") # noqa: E501
|
||||
if 'int32' in local_var_params and local_var_params['int32'] > 200: # noqa: E501
|
||||
raise ValueError("Invalid value for parameter `int32` when calling `test_endpoint_parameters`, must be a value less than or equal to `200`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `int32` when calling `test_endpoint_parameters`, must be a value less than or equal to `200`") # noqa: E501
|
||||
if 'int32' in local_var_params and local_var_params['int32'] < 20: # noqa: E501
|
||||
raise ValueError("Invalid value for parameter `int32` when calling `test_endpoint_parameters`, must be a value greater than or equal to `20`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `int32` when calling `test_endpoint_parameters`, must be a value greater than or equal to `20`") # noqa: E501
|
||||
if 'float' in local_var_params and local_var_params['float'] > 987.6: # noqa: E501
|
||||
raise ValueError("Invalid value for parameter `float` when calling `test_endpoint_parameters`, must be a value less than or equal to `987.6`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `float` when calling `test_endpoint_parameters`, must be a value less than or equal to `987.6`") # noqa: E501
|
||||
if 'string' in local_var_params and not re.search(r'[a-z]', local_var_params['string'], flags=re.IGNORECASE): # noqa: E501
|
||||
raise ValueError("Invalid value for parameter `string` when calling `test_endpoint_parameters`, must conform to the pattern `/[a-z]/i`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `string` when calling `test_endpoint_parameters`, must conform to the pattern `/[a-z]/i`") # noqa: E501
|
||||
if ('password' in local_var_params and
|
||||
len(local_var_params['password']) > 64):
|
||||
raise ValueError("Invalid value for parameter `password` when calling `test_endpoint_parameters`, length must be less than or equal to `64`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `password` when calling `test_endpoint_parameters`, length must be less than or equal to `64`") # noqa: E501
|
||||
if ('password' in local_var_params and
|
||||
len(local_var_params['password']) < 10):
|
||||
raise ValueError("Invalid value for parameter `password` when calling `test_endpoint_parameters`, length must be greater than or equal to `10`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `password` when calling `test_endpoint_parameters`, length must be greater than or equal to `10`") # noqa: E501
|
||||
collection_formats = {}
|
||||
|
||||
path_params = {}
|
||||
@@ -1050,7 +1054,7 @@ class FakeApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method test_enum_parameters" % key
|
||||
)
|
||||
@@ -1169,7 +1173,7 @@ class FakeApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method test_group_parameters" % key
|
||||
)
|
||||
@@ -1178,15 +1182,15 @@ class FakeApi(object):
|
||||
# verify the required parameter 'required_string_group' is set
|
||||
if ('required_string_group' not in local_var_params or
|
||||
local_var_params['required_string_group'] is None):
|
||||
raise ValueError("Missing the required parameter `required_string_group` when calling `test_group_parameters`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `required_string_group` when calling `test_group_parameters`") # noqa: E501
|
||||
# verify the required parameter 'required_boolean_group' is set
|
||||
if ('required_boolean_group' not in local_var_params or
|
||||
local_var_params['required_boolean_group'] is None):
|
||||
raise ValueError("Missing the required parameter `required_boolean_group` when calling `test_group_parameters`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `required_boolean_group` when calling `test_group_parameters`") # noqa: E501
|
||||
# verify the required parameter 'required_int64_group' is set
|
||||
if ('required_int64_group' not in local_var_params or
|
||||
local_var_params['required_int64_group'] is None):
|
||||
raise ValueError("Missing the required parameter `required_int64_group` when calling `test_group_parameters`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `required_int64_group` when calling `test_group_parameters`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -1277,7 +1281,7 @@ class FakeApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method test_inline_additional_properties" % key
|
||||
)
|
||||
@@ -1286,7 +1290,7 @@ class FakeApi(object):
|
||||
# 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
|
||||
raise ApiValueError("Missing the required parameter `request_body` when calling `test_inline_additional_properties`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -1373,7 +1377,7 @@ class FakeApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method test_json_form_data" % key
|
||||
)
|
||||
@@ -1382,11 +1386,11 @@ class FakeApi(object):
|
||||
# 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_json_form_data`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `param` when calling `test_json_form_data`") # noqa: E501
|
||||
# verify the required parameter 'param2' is set
|
||||
if ('param2' not in local_var_params or
|
||||
local_var_params['param2'] is None):
|
||||
raise ValueError("Missing the required parameter `param2` when calling `test_json_form_data`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `param2` when calling `test_json_form_data`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
|
||||
@@ -18,6 +18,10 @@ import re # noqa: F401
|
||||
import six
|
||||
|
||||
from petstore_api.api_client import ApiClient
|
||||
from petstore_api.exceptions import (
|
||||
ApiTypeError,
|
||||
ApiValueError
|
||||
)
|
||||
|
||||
|
||||
class FakeClassnameTags123Api(object):
|
||||
@@ -80,7 +84,7 @@ class FakeClassnameTags123Api(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method test_classname" % key
|
||||
)
|
||||
@@ -89,7 +93,7 @@ class FakeClassnameTags123Api(object):
|
||||
# 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
|
||||
raise ApiValueError("Missing the required parameter `client` when calling `test_classname`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
|
||||
@@ -18,6 +18,10 @@ import re # noqa: F401
|
||||
import six
|
||||
|
||||
from petstore_api.api_client import ApiClient
|
||||
from petstore_api.exceptions import (
|
||||
ApiTypeError,
|
||||
ApiValueError
|
||||
)
|
||||
|
||||
|
||||
class PetApi(object):
|
||||
@@ -72,7 +76,7 @@ class PetApi(object):
|
||||
local_var_host = local_var_hosts[0]
|
||||
if kwargs.get('_host_index'):
|
||||
if int(kwags.get('_host_index')) < 0 or int(kawgs.get('_host_index')) >= len(local_var_hosts):
|
||||
raise ValueError("Invalid host index. Must be 0 <= index < %s" % len(local_var_host))
|
||||
raise ApiValueError("Invalid host index. Must be 0 <= index < %s" % len(local_var_host))
|
||||
local_var_host = local_var_hosts[int(kwargs.get('_host_index'))]
|
||||
local_var_params = locals()
|
||||
|
||||
@@ -84,7 +88,7 @@ class PetApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params and key != "_host_index":
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method add_pet" % key
|
||||
)
|
||||
@@ -93,7 +97,7 @@ class PetApi(object):
|
||||
# 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
|
||||
raise ApiValueError("Missing the required parameter `pet` when calling `add_pet`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -181,7 +185,7 @@ class PetApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method delete_pet" % key
|
||||
)
|
||||
@@ -190,7 +194,7 @@ class PetApi(object):
|
||||
# verify the required parameter 'pet_id' is set
|
||||
if ('pet_id' not in local_var_params or
|
||||
local_var_params['pet_id'] is None):
|
||||
raise ValueError("Missing the required parameter `pet_id` when calling `delete_pet`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `pet_id` when calling `delete_pet`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -275,7 +279,7 @@ class PetApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method find_pets_by_status" % key
|
||||
)
|
||||
@@ -284,7 +288,7 @@ class PetApi(object):
|
||||
# verify the required parameter 'status' is set
|
||||
if ('status' not in local_var_params or
|
||||
local_var_params['status'] is None):
|
||||
raise ValueError("Missing the required parameter `status` when calling `find_pets_by_status`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `status` when calling `find_pets_by_status`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -372,7 +376,7 @@ class PetApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method find_pets_by_tags" % key
|
||||
)
|
||||
@@ -381,7 +385,7 @@ class PetApi(object):
|
||||
# verify the required parameter 'tags' is set
|
||||
if ('tags' not in local_var_params or
|
||||
local_var_params['tags'] is None):
|
||||
raise ValueError("Missing the required parameter `tags` when calling `find_pets_by_tags`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `tags` when calling `find_pets_by_tags`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -469,7 +473,7 @@ class PetApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method get_pet_by_id" % key
|
||||
)
|
||||
@@ -478,7 +482,7 @@ class PetApi(object):
|
||||
# verify the required parameter 'pet_id' is set
|
||||
if ('pet_id' not in local_var_params or
|
||||
local_var_params['pet_id'] is None):
|
||||
raise ValueError("Missing the required parameter `pet_id` when calling `get_pet_by_id`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `pet_id` when calling `get_pet_by_id`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -557,7 +561,7 @@ class PetApi(object):
|
||||
local_var_host = local_var_hosts[0]
|
||||
if kwargs.get('_host_index'):
|
||||
if int(kwags.get('_host_index')) < 0 or int(kawgs.get('_host_index')) >= len(local_var_hosts):
|
||||
raise ValueError("Invalid host index. Must be 0 <= index < %s" % len(local_var_host))
|
||||
raise ApiValueError("Invalid host index. Must be 0 <= index < %s" % len(local_var_host))
|
||||
local_var_host = local_var_hosts[int(kwargs.get('_host_index'))]
|
||||
local_var_params = locals()
|
||||
|
||||
@@ -569,7 +573,7 @@ class PetApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params and key != "_host_index":
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method update_pet" % key
|
||||
)
|
||||
@@ -578,7 +582,7 @@ class PetApi(object):
|
||||
# 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
|
||||
raise ApiValueError("Missing the required parameter `pet` when calling `update_pet`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -668,7 +672,7 @@ class PetApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method update_pet_with_form" % key
|
||||
)
|
||||
@@ -677,7 +681,7 @@ class PetApi(object):
|
||||
# verify the required parameter 'pet_id' is set
|
||||
if ('pet_id' not in local_var_params or
|
||||
local_var_params['pet_id'] is None):
|
||||
raise ValueError("Missing the required parameter `pet_id` when calling `update_pet_with_form`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `pet_id` when calling `update_pet_with_form`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -770,7 +774,7 @@ class PetApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method upload_file" % key
|
||||
)
|
||||
@@ -779,7 +783,7 @@ class PetApi(object):
|
||||
# verify the required parameter 'pet_id' is set
|
||||
if ('pet_id' not in local_var_params or
|
||||
local_var_params['pet_id'] is None):
|
||||
raise ValueError("Missing the required parameter `pet_id` when calling `upload_file`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `pet_id` when calling `upload_file`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -876,7 +880,7 @@ class PetApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method upload_file_with_required_file" % key
|
||||
)
|
||||
@@ -885,11 +889,11 @@ class PetApi(object):
|
||||
# verify the required parameter 'pet_id' is set
|
||||
if ('pet_id' not in local_var_params or
|
||||
local_var_params['pet_id'] is None):
|
||||
raise ValueError("Missing the required parameter `pet_id` when calling `upload_file_with_required_file`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `pet_id` when calling `upload_file_with_required_file`") # noqa: E501
|
||||
# verify the required parameter 'required_file' is set
|
||||
if ('required_file' not in local_var_params or
|
||||
local_var_params['required_file'] is None):
|
||||
raise ValueError("Missing the required parameter `required_file` when calling `upload_file_with_required_file`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `required_file` when calling `upload_file_with_required_file`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
|
||||
@@ -18,6 +18,10 @@ import re # noqa: F401
|
||||
import six
|
||||
|
||||
from petstore_api.api_client import ApiClient
|
||||
from petstore_api.exceptions import (
|
||||
ApiTypeError,
|
||||
ApiValueError
|
||||
)
|
||||
|
||||
|
||||
class StoreApi(object):
|
||||
@@ -80,7 +84,7 @@ class StoreApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method delete_order" % key
|
||||
)
|
||||
@@ -89,7 +93,7 @@ class StoreApi(object):
|
||||
# verify the required parameter 'order_id' is set
|
||||
if ('order_id' not in local_var_params or
|
||||
local_var_params['order_id'] is None):
|
||||
raise ValueError("Missing the required parameter `order_id` when calling `delete_order`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `order_id` when calling `delete_order`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -170,7 +174,7 @@ class StoreApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method get_inventory" % key
|
||||
)
|
||||
@@ -260,7 +264,7 @@ class StoreApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method get_order_by_id" % key
|
||||
)
|
||||
@@ -269,12 +273,12 @@ class StoreApi(object):
|
||||
# verify the required parameter 'order_id' is set
|
||||
if ('order_id' not in local_var_params or
|
||||
local_var_params['order_id'] is None):
|
||||
raise ValueError("Missing the required parameter `order_id` when calling `get_order_by_id`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `order_id` when calling `get_order_by_id`") # noqa: E501
|
||||
|
||||
if 'order_id' in local_var_params and local_var_params['order_id'] > 5: # noqa: E501
|
||||
raise ValueError("Invalid value for parameter `order_id` when calling `get_order_by_id`, must be a value less than or equal to `5`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `order_id` when calling `get_order_by_id`, must be a value less than or equal to `5`") # noqa: E501
|
||||
if 'order_id' in local_var_params and local_var_params['order_id'] < 1: # noqa: E501
|
||||
raise ValueError("Invalid value for parameter `order_id` when calling `get_order_by_id`, must be a value greater than or equal to `1`") # noqa: E501
|
||||
raise ApiValueError("Invalid value for parameter `order_id` when calling `get_order_by_id`, must be a value greater than or equal to `1`") # noqa: E501
|
||||
collection_formats = {}
|
||||
|
||||
path_params = {}
|
||||
@@ -358,7 +362,7 @@ class StoreApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method place_order" % key
|
||||
)
|
||||
@@ -367,7 +371,7 @@ class StoreApi(object):
|
||||
# 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
|
||||
raise ApiValueError("Missing the required parameter `order` when calling `place_order`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
|
||||
@@ -18,6 +18,10 @@ import re # noqa: F401
|
||||
import six
|
||||
|
||||
from petstore_api.api_client import ApiClient
|
||||
from petstore_api.exceptions import (
|
||||
ApiTypeError,
|
||||
ApiValueError
|
||||
)
|
||||
|
||||
|
||||
class UserApi(object):
|
||||
@@ -80,7 +84,7 @@ class UserApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method create_user" % key
|
||||
)
|
||||
@@ -89,7 +93,7 @@ class UserApi(object):
|
||||
# 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
|
||||
raise ApiValueError("Missing the required parameter `user` when calling `create_user`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -174,7 +178,7 @@ class UserApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method create_users_with_array_input" % key
|
||||
)
|
||||
@@ -183,7 +187,7 @@ class UserApi(object):
|
||||
# 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
|
||||
raise ApiValueError("Missing the required parameter `user` when calling `create_users_with_array_input`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -268,7 +272,7 @@ class UserApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method create_users_with_list_input" % key
|
||||
)
|
||||
@@ -277,7 +281,7 @@ class UserApi(object):
|
||||
# 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
|
||||
raise ApiValueError("Missing the required parameter `user` when calling `create_users_with_list_input`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -364,7 +368,7 @@ class UserApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method delete_user" % key
|
||||
)
|
||||
@@ -373,7 +377,7 @@ class UserApi(object):
|
||||
# verify the required parameter 'username' is set
|
||||
if ('username' not in local_var_params or
|
||||
local_var_params['username'] is None):
|
||||
raise ValueError("Missing the required parameter `username` when calling `delete_user`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `username` when calling `delete_user`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -454,7 +458,7 @@ class UserApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method get_user_by_name" % key
|
||||
)
|
||||
@@ -463,7 +467,7 @@ class UserApi(object):
|
||||
# verify the required parameter 'username' is set
|
||||
if ('username' not in local_var_params or
|
||||
local_var_params['username'] is None):
|
||||
raise ValueError("Missing the required parameter `username` when calling `get_user_by_name`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `username` when calling `get_user_by_name`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -550,7 +554,7 @@ class UserApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method login_user" % key
|
||||
)
|
||||
@@ -559,11 +563,11 @@ class UserApi(object):
|
||||
# verify the required parameter 'username' is set
|
||||
if ('username' not in local_var_params or
|
||||
local_var_params['username'] is None):
|
||||
raise ValueError("Missing the required parameter `username` when calling `login_user`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `username` when calling `login_user`") # noqa: E501
|
||||
# verify the required parameter 'password' is set
|
||||
if ('password' not in local_var_params or
|
||||
local_var_params['password'] is None):
|
||||
raise ValueError("Missing the required parameter `password` when calling `login_user`") # noqa: E501
|
||||
raise ApiValueError("Missing the required parameter `password` when calling `login_user`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
@@ -648,7 +652,7 @@ class UserApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method logout_user" % key
|
||||
)
|
||||
@@ -736,7 +740,7 @@ class UserApi(object):
|
||||
|
||||
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
raise ApiTypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method update_user" % key
|
||||
)
|
||||
@@ -745,11 +749,11 @@ class UserApi(object):
|
||||
# verify the required parameter 'username' is set
|
||||
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
|
||||
raise ApiValueError("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
|
||||
raise ApiValueError("Missing the required parameter `user` when calling `update_user`") # noqa: E501
|
||||
|
||||
collection_formats = {}
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ from six.moves.urllib.parse import quote
|
||||
from petstore_api.configuration import Configuration
|
||||
import petstore_api.models
|
||||
from petstore_api import rest
|
||||
from petstore_api.exceptions import ApiValueError
|
||||
|
||||
|
||||
class ApiClient(object):
|
||||
@@ -406,7 +407,7 @@ class ApiClient(object):
|
||||
_request_timeout=_request_timeout,
|
||||
body=body)
|
||||
else:
|
||||
raise ValueError(
|
||||
raise ApiValueError(
|
||||
"http method must be `GET`, `HEAD`, `OPTIONS`,"
|
||||
" `POST`, `PATCH`, `PUT` or `DELETE`."
|
||||
)
|
||||
@@ -523,7 +524,7 @@ class ApiClient(object):
|
||||
elif auth_setting['in'] == 'query':
|
||||
querys.append((auth_setting['key'], auth_setting['value']))
|
||||
else:
|
||||
raise ValueError(
|
||||
raise ApiValueError(
|
||||
'Authentication token must be in `query` or `header`'
|
||||
)
|
||||
|
||||
|
||||
@@ -22,11 +22,9 @@ import certifi
|
||||
# python 2 and python 3 compatibility library
|
||||
import six
|
||||
from six.moves.urllib.parse import urlencode
|
||||
import urllib3
|
||||
|
||||
try:
|
||||
import urllib3
|
||||
except ImportError:
|
||||
raise ImportError('OpenAPI Python client requires urllib3.')
|
||||
from petstore_api.exceptions import ApiException, ApiValueError
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -133,7 +131,7 @@ class RESTClientObject(object):
|
||||
'PATCH', 'OPTIONS']
|
||||
|
||||
if post_params and body:
|
||||
raise ValueError(
|
||||
raise ApiValueError(
|
||||
"body parameter cannot be used with post_params parameter."
|
||||
)
|
||||
|
||||
@@ -295,31 +293,3 @@ class RESTClientObject(object):
|
||||
_preload_content=_preload_content,
|
||||
_request_timeout=_request_timeout,
|
||||
body=body)
|
||||
|
||||
|
||||
class ApiException(Exception):
|
||||
|
||||
def __init__(self, status=None, reason=None, http_resp=None):
|
||||
if http_resp:
|
||||
self.status = http_resp.status
|
||||
self.reason = http_resp.reason
|
||||
self.body = http_resp.data
|
||||
self.headers = http_resp.getheaders()
|
||||
else:
|
||||
self.status = status
|
||||
self.reason = reason
|
||||
self.body = None
|
||||
self.headers = None
|
||||
|
||||
def __str__(self):
|
||||
"""Custom error messages for exception"""
|
||||
error_message = "({0})\n"\
|
||||
"Reason: {1}\n".format(self.status, self.reason)
|
||||
if self.headers:
|
||||
error_message += "HTTP response headers: {0}\n".format(
|
||||
self.headers)
|
||||
|
||||
if self.body:
|
||||
error_message += "HTTP response body: {0}\n".format(self.body)
|
||||
|
||||
return error_message
|
||||
|
||||
Reference in New Issue
Block a user