From 36d14064937bd7fdee7f03cc28cb60e7ea29ecc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pa=C5=ADlo=20Ebermann?= Date: Thu, 30 Mar 2017 17:04:49 +0200 Subject: [PATCH 1/3] Update samples for javascript + javascript-promise. (#5241) --- samples/client/petstore/javascript-promise/src/ApiClient.js | 2 +- .../petstore/javascript-promise/src/model/FormatTest.js | 4 ++-- samples/client/petstore/javascript/src/ApiClient.js | 2 +- samples/client/petstore/javascript/src/model/FormatTest.js | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/samples/client/petstore/javascript-promise/src/ApiClient.js b/samples/client/petstore/javascript-promise/src/ApiClient.js index 1b186a42d79..49dd422a8f1 100644 --- a/samples/client/petstore/javascript-promise/src/ApiClient.js +++ b/samples/client/petstore/javascript-promise/src/ApiClient.js @@ -414,7 +414,7 @@ if (accept) { request.accept(accept); } - + if (returnType === 'Blob') { request.responseType('blob'); } diff --git a/samples/client/petstore/javascript-promise/src/model/FormatTest.js b/samples/client/petstore/javascript-promise/src/model/FormatTest.js index b9fd8e93fa9..6e090034954 100644 --- a/samples/client/petstore/javascript-promise/src/model/FormatTest.js +++ b/samples/client/petstore/javascript-promise/src/model/FormatTest.js @@ -97,10 +97,10 @@ obj['string'] = ApiClient.convertToType(data['string'], 'String'); } if (data.hasOwnProperty('byte')) { - obj['byte'] = ApiClient.convertToType(data['byte'], Blob); + obj['byte'] = ApiClient.convertToType(data['byte'], 'Blob'); } if (data.hasOwnProperty('binary')) { - obj['binary'] = ApiClient.convertToType(data['binary'], Blob); + obj['binary'] = ApiClient.convertToType(data['binary'], 'Blob'); } if (data.hasOwnProperty('date')) { obj['date'] = ApiClient.convertToType(data['date'], 'Date'); diff --git a/samples/client/petstore/javascript/src/ApiClient.js b/samples/client/petstore/javascript/src/ApiClient.js index 802c2e24088..5225f9611bf 100644 --- a/samples/client/petstore/javascript/src/ApiClient.js +++ b/samples/client/petstore/javascript/src/ApiClient.js @@ -423,7 +423,7 @@ if (accept) { request.accept(accept); } - + if (returnType === 'Blob') { request.responseType('blob'); } diff --git a/samples/client/petstore/javascript/src/model/FormatTest.js b/samples/client/petstore/javascript/src/model/FormatTest.js index b9fd8e93fa9..6e090034954 100644 --- a/samples/client/petstore/javascript/src/model/FormatTest.js +++ b/samples/client/petstore/javascript/src/model/FormatTest.js @@ -97,10 +97,10 @@ obj['string'] = ApiClient.convertToType(data['string'], 'String'); } if (data.hasOwnProperty('byte')) { - obj['byte'] = ApiClient.convertToType(data['byte'], Blob); + obj['byte'] = ApiClient.convertToType(data['byte'], 'Blob'); } if (data.hasOwnProperty('binary')) { - obj['binary'] = ApiClient.convertToType(data['binary'], Blob); + obj['binary'] = ApiClient.convertToType(data['binary'], 'Blob'); } if (data.hasOwnProperty('date')) { obj['date'] = ApiClient.convertToType(data['date'], 'Date'); From 879edc3a9d908072a503f8437123f2e1baf7abd7 Mon Sep 17 00:00:00 2001 From: wing328 Date: Thu, 30 Mar 2017 23:16:02 +0800 Subject: [PATCH 2/3] Added IBM to the company list --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 2105d348854..4da76d9efe7 100644 --- a/README.md +++ b/README.md @@ -862,6 +862,7 @@ Here are some companies/projects using Swagger Codegen in production. To add you - [HashData](http://www.hashdata.cn/) - [Hewlett Packard Enterprise](https://hpe.com) - [High Technologies Center](http://htc-cs.com) +- [IBM](https://www.ibm.com) - [IMS Health](http://www.imshealth.com/en/solution-areas/technology-and-applications) - [Intent HQ](http://www.intenthq.com) - [Interactive Intelligence](http://developer.mypurecloud.com/) From 08be483dab5d4f65b43fd1314d822be23f654202 Mon Sep 17 00:00:00 2001 From: wing328 Date: Fri, 31 Mar 2017 00:36:51 +0800 Subject: [PATCH 3/3] add new python files --- .../apis/fake_classname_tags_123_api.py | 140 ++++++++++++++++++ .../test/test_fake_classname_tags_123_api.py | 44 ++++++ 2 files changed, 184 insertions(+) create mode 100644 samples/client/petstore/python/petstore_api/apis/fake_classname_tags_123_api.py create mode 100644 samples/client/petstore/python/test/test_fake_classname_tags_123_api.py diff --git a/samples/client/petstore/python/petstore_api/apis/fake_classname_tags_123_api.py b/samples/client/petstore/python/petstore_api/apis/fake_classname_tags_123_api.py new file mode 100644 index 00000000000..6ebdc9b2706 --- /dev/null +++ b/samples/client/petstore/python/petstore_api/apis/fake_classname_tags_123_api.py @@ -0,0 +1,140 @@ +# 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 FakeClassnameTags123Api(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_classname(self, body, **kwargs): + """ + To test class name in snake case + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please define a `callback` function + to be invoked when receiving the response. + >>> def callback_function(response): + >>> pprint(response) + >>> + >>> thread = api.test_classname(body, callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :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('callback'): + return self.test_classname_with_http_info(body, **kwargs) + else: + (data) = self.test_classname_with_http_info(body, **kwargs) + return data + + def test_classname_with_http_info(self, body, **kwargs): + """ + To test class name in snake case + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please define a `callback` function + to be invoked when receiving the response. + >>> def callback_function(response): + >>> pprint(response) + >>> + >>> thread = api.test_classname_with_http_info(body, callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :param Client body: client model (required) + :return: Client + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] + all_params.append('callback') + 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_classname" % 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_classname`") + + + 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('/fake_classname_test', '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, + callback=params.get('callback'), + _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) diff --git a/samples/client/petstore/python/test/test_fake_classname_tags_123_api.py b/samples/client/petstore/python/test/test_fake_classname_tags_123_api.py new file mode 100644 index 00000000000..7a11a2378bf --- /dev/null +++ b/samples/client/petstore/python/test/test_fake_classname_tags_123_api.py @@ -0,0 +1,44 @@ +# 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 os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.apis.fake_classname_tags_123_api import FakeClassnameTags123Api + + +class TestFakeClassnameTags123Api(unittest.TestCase): + """ FakeClassnameTags123Api unit test stubs """ + + def setUp(self): + self.api = petstore_api.apis.fake_classname_tags_123_api.FakeClassnameTags123Api() + + def tearDown(self): + pass + + def test_test_classname(self): + """ + Test case for test_classname + + To test class name in snake case + """ + pass + + +if __name__ == '__main__': + unittest.main()