Better logic to handle tags with special characters (#6466)

* better logic to handle tag with special characters

* update test cases

* comment out swift test cases

* restore the swift tests
This commit is contained in:
wing328
2017-09-12 11:41:14 +08:00
committed by GitHub
parent 9e0911b376
commit 591149bcb7
16 changed files with 736 additions and 40 deletions

View File

@@ -52,6 +52,7 @@ from .models.cat import Cat
from .models.dog import Dog
# import apis into sdk package
from .apis.another_fake_api import AnotherFakeApi
from .apis.fake_api import FakeApi
from .apis.fake_classname_tags_123_api import FakeClassnameTags123Api
from .apis.pet_api import PetApi

View File

@@ -1,6 +1,7 @@
from __future__ import absolute_import
# import apis into api package
from .another_fake_api import AnotherFakeApi
from .fake_api import FakeApi
from .fake_classname_tags_123_api import FakeClassnameTags123Api
from .pet_api import PetApi

View File

@@ -0,0 +1,134 @@
# coding: utf-8
"""
Swagger 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: \" \\
OpenAPI spec version: 1.0.0
Contact: apiteam@swagger.io
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import sys
import os
import re
# python 2 and python 3 compatibility library
from six import iteritems
from ..api_client import ApiClient
class AnotherFakeApi(object):
"""
NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
"""
def __init__(self, api_client=None):
if api_client is None:
api_client = ApiClient()
self.api_client = api_client
def test_special_tags(self, body, **kwargs):
"""
To test special tags
To test special tags
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.test_special_tags(body, async=True)
>>> result = thread.get()
:param async bool
:param Client body: client model (required)
:return: Client
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async'):
return self.test_special_tags_with_http_info(body, **kwargs)
else:
(data) = self.test_special_tags_with_http_info(body, **kwargs)
return data
def test_special_tags_with_http_info(self, body, **kwargs):
"""
To test special tags
To test special tags
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.test_special_tags_with_http_info(body, async=True)
>>> result = thread.get()
:param async bool
:param Client body: client model (required)
:return: Client
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['body']
all_params.append('async')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method test_special_tags" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if ('body' not in params) or (params['body'] is None):
raise ValueError("Missing the required parameter `body` when calling `test_special_tags`")
collection_formats = {}
path_params = {}
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
if 'body' in params:
body_params = params['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.\
select_header_accept(['application/json'])
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.\
select_header_content_type(['application/json'])
# Authentication setting
auth_settings = []
return self.api_client.call_api('/another-fake/dummy', 'PATCH',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='Client',
auth_settings=auth_settings,
async=params.get('async'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)