Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 26 additions & 10 deletions modules/openapi-generator/src/main/resources/python/api.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import re # noqa: F401
import six

from {{packageName}}.api_client import ApiClient
from {{packageName}}.exceptions import (
from {{packageName}}.exceptions import ( # noqa: F401
ApiTypeError,
ApiValueError
)
Expand Down Expand Up @@ -99,20 +99,36 @@ class {{classname}}(object):
"""

{{#servers.0}}
local_var_hosts = [{{#servers}}'{{{url}}}'{{^-last}}, {{/-last}}{{/servers}}] # noqa: E501
local_var_hosts = [
{{#servers}}
'{{{url}}}'{{^-last}},{{/-last}}
{{/servers}}
]
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):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kwags should be kwargs

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'))]
_host_index = int(kwargs.get('_host_index'))
if _host_index < 0 or _host_index >= len(local_var_hosts):
raise ApiValueError(
"Invalid host index. Must be 0 <= index < %s"
% len(local_var_host)
)
local_var_host = local_var_hosts[_host_index]
{{/servers.0}}
local_var_params = locals()

all_params = [{{#allParams}}'{{paramName}}'{{#hasMore}}, {{/hasMore}}{{/allParams}}] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params = [
{{#allParams}}
'{{paramName}}'{{#hasMore}},{{/hasMore}}
{{/allParams}}
]
all_params.extend(
[
'async_req',
'_return_http_data_only',
'_preload_content',
'_request_timeout'
]
)

for key, val in six.iteritems(local_var_params['kwargs']):
if key not in all_params{{#servers.0}} and key != "_host_index"{{/servers.0}}:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import six

from petstore_api.api_client import ApiClient
from petstore_api.exceptions import (
from petstore_api.exceptions import ( # noqa: F401
ApiTypeError,
ApiValueError
)
Expand Down Expand Up @@ -88,11 +88,17 @@ def call_123_test_special_tags_with_http_info(self, body, **kwargs): # noqa: E5

local_var_params = locals()

all_params = ['body'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params = [
'body'
]
all_params.extend(
[
'async_req',
'_return_http_data_only',
'_preload_content',
'_request_timeout'
]
)

for key, val in six.iteritems(local_var_params['kwargs']):
if key not in all_params:
Expand Down
Loading