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
Original file line number Diff line number Diff line change
Expand Up @@ -672,11 +672,8 @@ public String toModelTestFilename(String name) {

@Override
public String toApiFilename(String name) {
// replace - with _ e.g. created-at => created_at
name = name.replaceAll("-", "_");

// e.g. PhoneNumberApi.py => phone_number_api.py
return underscore(name + "_" + apiNameSuffix);
return underscore(toApiName(name));
}

@Override
Expand All @@ -691,10 +688,7 @@ public String toApiName(String name) {

@Override
public String toApiVarName(String name) {
if (name.length() == 0) {
return "default_api";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What happens when name length is 0 with your update?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

after update, it will call method: toApiName(name)

    public String toApiName(String name) {
        if (name.length() == 0) {
            return "DefaultApi";
        }
        return camelize(apiNamePrefix + "_" + name + "_" + apiNameSuffix);
    }

this method will get default name where name length is 0

}
return underscore(name + "_" + apiNameSuffix);
return underscore(toApiName(name));
}

protected static String dropDots(String str) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,10 +297,7 @@ public String toApiName(String name) {
return camelize(name, false) + "Controller";
}

@Override
public String toApiFilename(String name) {
return underscore(toApiName(name));
}


@Override
public String toApiTestFilename(String name) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ petstore_api/__init__.py
petstore_api/api/__init__.py
petstore_api/api/another_fake_api.py
petstore_api/api/fake_api.py
petstore_api/api/fake_classname_tags_123_api.py
petstore_api/api/fake_classname_tags123_api.py
petstore_api/api/pet_api.py
petstore_api/api/store_api.py
petstore_api/api/user_api.py
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# import apis into sdk package
from petstore_api.api.another_fake_api import AnotherFakeApi
from petstore_api.api.fake_api import FakeApi
from petstore_api.api.fake_classname_tags_123_api import FakeClassnameTags123Api
from petstore_api.api.fake_classname_tags123_api import FakeClassnameTags123Api
from petstore_api.api.pet_api import PetApi
from petstore_api.api.store_api import StoreApi
from petstore_api.api.user_api import UserApi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# import apis into api package
from petstore_api.api.another_fake_api import AnotherFakeApi
from petstore_api.api.fake_api import FakeApi
from petstore_api.api.fake_classname_tags_123_api import FakeClassnameTags123Api
from petstore_api.api.fake_classname_tags123_api import FakeClassnameTags123Api
from petstore_api.api.pet_api import PetApi
from petstore_api.api.store_api import StoreApi
from petstore_api.api.user_api import UserApi
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
# coding: utf-8

"""
OpenAPI Petstore

This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501

The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
"""


from __future__ import absolute_import

import re # noqa: F401

# python 2 and python 3 compatibility library
import six

from petstore_api.api_client import ApiClient
from petstore_api.exceptions import ( # noqa: F401
ApiTypeError,
ApiValueError
)


class FakeClassnameTags123Api(object):
"""NOTE: This class is auto generated by OpenAPI Generator
Ref: https://openapi-generator.tech

Do not edit the class manually.
"""

def __init__(self, api_client=None):
if api_client is None:
api_client = ApiClient()
self.api_client = api_client

def test_classname(self, body, **kwargs): # noqa: E501
"""To test class name in snake case # noqa: E501

To test class name in snake case # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True

>>> thread = api.test_classname(body, async_req=True)
>>> result = thread.get()

:param body: client model (required)
:type body: Client
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _preload_content: if False, the urllib3.HTTPResponse object will
be returned without reading/decoding response
data. Default is True.
:type _preload_content: bool, optional
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:return: Returns the result object.
If the method is called asynchronously,
returns the request thread.
:rtype: Client
"""
kwargs['_return_http_data_only'] = True
return self.test_classname_with_http_info(body, **kwargs) # noqa: E501

def test_classname_with_http_info(self, body, **kwargs): # noqa: E501
"""To test class name in snake case # noqa: E501

To test class name in snake case # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True

>>> thread = api.test_classname_with_http_info(body, async_req=True)
>>> result = thread.get()

:param body: client model (required)
:type body: Client
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _return_http_data_only: response data without head status code
and headers
:type _return_http_data_only: bool, optional
:param _preload_content: if False, the urllib3.HTTPResponse object will
be returned without reading/decoding response
data. Default is True.
:type _preload_content: bool, optional
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
:type _request_auth: dict, optional
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object.
If the method is called asynchronously,
returns the request thread.
:rtype: tuple(Client, status_code(int), headers(HTTPHeaderDict))
"""

local_var_params = locals()

all_params = [
'body'
]
all_params.extend(
[
'async_req',
'_return_http_data_only',
'_preload_content',
'_request_timeout',
'_request_auth',
'_content_type'
]
)

for key, val in six.iteritems(local_var_params['kwargs']):
if key not in all_params:
raise ApiTypeError(
"Got an unexpected keyword argument '%s'"
" to method test_classname" % key
)
local_var_params[key] = val
del local_var_params['kwargs']
# verify the required parameter 'body' is set
if self.api_client.client_side_validation and ('body' not in local_var_params or # noqa: E501
local_var_params['body'] is None): # noqa: E501
raise ApiValueError("Missing the required parameter `body` when calling `test_classname`") # noqa: E501

collection_formats = {}

path_params = {}

query_params = []

header_params = {}

form_params = []
local_var_files = {}

body_params = None
if 'body' in local_var_params:
body_params = local_var_params['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']) # noqa: E501

# HTTP header `Content-Type`
header_params['Content-Type'] = local_var_params.get('_content_type',
self.api_client.select_header_content_type(
['application/json'],
'PATCH', body_params)) # noqa: E501

# Authentication setting
auth_settings = ['api_key_query'] # noqa: E501

response_types_map = {
200: "Client",
}

return self.api_client.call_api(
'/fake_classname_test', 'PATCH',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_types_map=response_types_map,
auth_settings=auth_settings,
async_req=local_var_params.get('async_req'),
_return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
_preload_content=local_var_params.get('_preload_content', True),
_request_timeout=local_var_params.get('_request_timeout'),
collection_formats=collection_formats,
_request_auth=local_var_params.get('_request_auth'))
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# coding: utf-8

"""
OpenAPI Petstore

This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501

The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
"""


from __future__ import absolute_import

import unittest

import petstore_api
from petstore_api.api.fake_classname_tags_123_api import FakeClassnameTags123Api # noqa: E501
from petstore_api.rest import ApiException


class TestFakeClassnameTags123Api(unittest.TestCase):
"""FakeClassnameTags123Api unit test stubs"""

def setUp(self):
self.api = petstore_api.api.fake_classname_tags_123_api.FakeClassnameTags123Api() # noqa: E501

def tearDown(self):
pass

def test_test_classname(self):
"""Test case for test_classname

To test class name in snake case # noqa: E501
"""
pass


if __name__ == '__main__':
unittest.main()
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ petstore_api/__init__.py
petstore_api/api/__init__.py
petstore_api/api/another_fake_api.py
petstore_api/api/fake_api.py
petstore_api/api/fake_classname_tags_123_api.py
petstore_api/api/fake_classname_tags123_api.py
petstore_api/api/pet_api.py
petstore_api/api/store_api.py
petstore_api/api/user_api.py
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# import apis into sdk package
from petstore_api.api.another_fake_api import AnotherFakeApi
from petstore_api.api.fake_api import FakeApi
from petstore_api.api.fake_classname_tags_123_api import FakeClassnameTags123Api
from petstore_api.api.fake_classname_tags123_api import FakeClassnameTags123Api
from petstore_api.api.pet_api import PetApi
from petstore_api.api.store_api import StoreApi
from petstore_api.api.user_api import UserApi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# import apis into api package
from petstore_api.api.another_fake_api import AnotherFakeApi
from petstore_api.api.fake_api import FakeApi
from petstore_api.api.fake_classname_tags_123_api import FakeClassnameTags123Api
from petstore_api.api.fake_classname_tags123_api import FakeClassnameTags123Api
from petstore_api.api.pet_api import PetApi
from petstore_api.api.store_api import StoreApi
from petstore_api.api.user_api import UserApi
Loading