From f44e5faf1b73eae2a600e13e0567c5a67cebb623 Mon Sep 17 00:00:00 2001 From: wing328 Date: Sat, 12 Dec 2015 15:58:35 +0800 Subject: [PATCH 01/16] add http info support for python --- .../src/main/resources/python/api.mustache | 46 +- .../main/resources/python/api_client.mustache | 4 +- samples/client/petstore/python/.coverage | 1 + .../petstore/python/dev-requirements.txt.log | 253 ++++++ .../python/swagger_client/api_client.py | 4 +- .../python/swagger_client/apis/pet_api.py | 833 +++++++++--------- .../python/swagger_client/apis/store_api.py | 354 ++++---- .../python/swagger_client/apis/user_api.py | 605 +++++++++---- 8 files changed, 1279 insertions(+), 821 deletions(-) create mode 100644 samples/client/petstore/python/.coverage create mode 100644 samples/client/petstore/python/dev-requirements.txt.log diff --git a/modules/swagger-codegen/src/main/resources/python/api.mustache b/modules/swagger-codegen/src/main/resources/python/api.mustache index 230f05d94af..f395c783dc6 100644 --- a/modules/swagger-codegen/src/main/resources/python/api.mustache +++ b/modules/swagger-codegen/src/main/resources/python/api.mustache @@ -47,7 +47,7 @@ class {{classname}}(object): self.api_client = config.api_client {{#operation}} - def {{nickname}}(self, {{#sortParamsByRequiredFlag}}{{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}{{/sortParamsByRequiredFlag}}**kwargs): + def {{operationId}}(self, {{#sortParamsByRequiredFlag}}{{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}{{/sortParamsByRequiredFlag}}**kwargs): """ {{{summary}}} {{{notes}}} @@ -59,10 +59,43 @@ class {{classname}}(object): >>> pprint(response) >>> {{#sortParamsByRequiredFlag}} - >>> thread = api.{{nickname}}({{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}callback=callback_function) + >>> thread = api.{{operationId}}({{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}callback=callback_function) {{/sortParamsByRequiredFlag}} {{^sortParamsByRequiredFlag}} - >>> thread = api.{{nickname}}({{#allParams}}{{#required}}{{paramName}}={{paramName}}_value, {{/required}}{{/allParams}}callback=callback_function) + >>> thread = api.{{operationId}}({{#allParams}}{{#required}}{{paramName}}={{paramName}}_value, {{/required}}{{/allParams}}callback=callback_function) +{{/sortParamsByRequiredFlag}} + + :param callback function: The callback function + for asynchronous request. (optional) +{{#allParams}} + :param {{dataType}} {{paramName}}: {{{description}}}{{#required}} (required){{/required}}{{#optional}}(optional){{/optional}} +{{/allParams}} + :return: {{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}None{{/returnType}} + If the method is called asynchronously, + returns the request thread. + """ + if kwargs.get('callback'): + return self.{{operationId}}_with_http_info({{#sortParamsByRequiredFlag}}{{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}{{/sortParamsByRequiredFlag}}**kwargs) + else: + (data, status_code, response_headers) = self.{{operationId}}_with_http_info({{#sortParamsByRequiredFlag}}{{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}{{/sortParamsByRequiredFlag}}**kwargs) + return data + + def {{operationId}}_with_http_info(self, {{#sortParamsByRequiredFlag}}{{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}{{/sortParamsByRequiredFlag}}**kwargs): + """ + {{{summary}}} + {{{notes}}} + + 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) + >>> +{{#sortParamsByRequiredFlag}} + >>> thread = api.{{operationId}}_with_http_info({{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}callback=callback_function) +{{/sortParamsByRequiredFlag}} +{{^sortParamsByRequiredFlag}} + >>> thread = api.{{operationId}}_with_http_info({{#allParams}}{{#required}}{{paramName}}={{paramName}}_value, {{/required}}{{/allParams}}callback=callback_function) {{/sortParamsByRequiredFlag}} :param callback function: The callback function @@ -83,7 +116,7 @@ class {{classname}}(object): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" - " to method {{nickname}}" % key + " to method {{operationId}}" % key ) params[key] = val del params['kwargs'] @@ -92,7 +125,7 @@ class {{classname}}(object): {{#required}} # verify the required parameter '{{paramName}}' is set if ('{{paramName}}' not in params) or (params['{{paramName}}'] is None): - raise ValueError("Missing the required parameter `{{paramName}}` when calling `{{nickname}}`") + raise ValueError("Missing the required parameter `{{paramName}}` when calling `{{operationId}}`") {{/required}} {{/allParams}} @@ -141,7 +174,7 @@ class {{classname}}(object): # Authentication setting auth_settings = [{{#authMethods}}'{{name}}'{{#hasMore}}, {{/hasMore}}{{/authMethods}}] - response = self.api_client.call_api(resource_path, '{{httpMethod}}', + return self.api_client.call_api(resource_path, '{{httpMethod}}', path_params, query_params, header_params, @@ -151,6 +184,5 @@ class {{classname}}(object): response_type={{#returnType}}'{{returnType}}'{{/returnType}}{{^returnType}}None{{/returnType}}, auth_settings=auth_settings, callback=params.get('callback')) - return response {{/operation}} {{/operations}} diff --git a/modules/swagger-codegen/src/main/resources/python/api_client.mustache b/modules/swagger-codegen/src/main/resources/python/api_client.mustache index 98fee823591..685580ae839 100644 --- a/modules/swagger-codegen/src/main/resources/python/api_client.mustache +++ b/modules/swagger-codegen/src/main/resources/python/api_client.mustache @@ -157,9 +157,9 @@ class ApiClient(object): deserialized_data = None if callback: - callback(deserialized_data) + callback((deserialized_data, response_data.status, response_data.getheaders())) else: - return deserialized_data + return (deserialized_data, response_data.status, response_data.getheaders()) def to_path_value(self, obj): """ diff --git a/samples/client/petstore/python/.coverage b/samples/client/petstore/python/.coverage new file mode 100644 index 00000000000..0a07b3c83eb --- /dev/null +++ b/samples/client/petstore/python/.coverage @@ -0,0 +1 @@ +!coverage.py: This is a private format, don't read it directly!{"lines": {"/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/python/swagger_client/models/order.py": [130, 172, 141, 173, 19, 21, 22, 152, 25, 29, 30, 161, 163, 39, 40, 41, 42, 43, 44, 45, 174, 175, 48, 49, 50, 51, 180, 53, 54, 52, 58, 59, 60, 61, 62, 191, 64, 202, 75, 86, 57, 176, 222, 97, 228, 178, 234, 108, 240, 119], "/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/python/swagger_client/models/tag.py": [128, 132, 134, 19, 21, 22, 25, 29, 30, 39, 40, 41, 44, 45, 46, 49, 50, 52, 61, 63, 72, 74, 83, 85, 94, 96, 100, 102, 103, 104, 109, 112, 114, 116, 122], "/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/python/swagger_client/models/__init__.py": [1, 4, 5, 6, 7, 8], "/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/python/swagger_client/apis/__init__.py": [1, 4, 5, 6], "/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/python/swagger_client/models/pet.py": [128, 130, 150, 172, 139, 141, 19, 215, 21, 22, 152, 25, 29, 30, 161, 163, 39, 40, 41, 42, 43, 44, 45, 174, 48, 49, 50, 51, 52, 53, 54, 183, 185, 58, 59, 60, 61, 62, 64, 194, 195, 200, 73, 202, 75, 206, 208, 209, 210, 211, 84, 213, 86, 57, 216, 218, 220, 222, 95, 97, 226, 228, 234, 108, 238, 240, 117, 119, 212, 106], "/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/python/swagger_client/configuration.py": [135, 136, 137, 138, 139, 142, 19, 149, 22, 23, 25, 26, 157, 158, 31, 32, 34, 36, 37, 39, 40, 41, 170, 43, 172, 46, 47, 189, 179, 52, 54, 59, 61, 190, 63, 192, 224, 67, 69, 71, 200, 73, 204, 80, 81, 82, 84, 213, 86, 199, 88, 90, 219, 92, 221, 222, 223, 96, 225, 98, 100, 102, 230, 104, 167, 111, 76, 168, 122, 123, 42, 21], "/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/python/swagger_client/apis/store_api.py": [128, 129, 132, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 272, 145, 18, 20, 22, 23, 26, 28, 29, 32, 37, 39, 40, 41, 171, 44, 46, 48, 94, 67, 70, 71, 73, 93, 350, 96, 97, 104, 107, 108, 110, 112, 114, 116, 117, 246, 119, 376, 122, 123, 124], "/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/python/swagger_client/models/category.py": [128, 134, 19, 21, 22, 25, 29, 30, 39, 40, 41, 44, 45, 46, 49, 50, 52, 61, 63, 72, 74, 83, 85, 94, 96, 100, 102, 103, 104, 109, 112, 114, 116, 122], "/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/python/swagger_client/api_client.py": [518, 525, 526, 527, 19, 21, 22, 23, 24, 537, 26, 27, 28, 29, 30, 31, 32, 33, 34, 547, 36, 37, 40, 42, 44, 45, 558, 47, 49, 52, 566, 568, 569, 570, 571, 572, 573, 575, 68, 69, 70, 75, 76, 77, 79, 80, 82, 84, 91, 96, 98, 102, 103, 104, 107, 108, 109, 111, 112, 115, 116, 117, 118, 119, 120, 123, 124, 125, 126, 129, 130, 131, 134, 137, 138, 141, 144, 145, 146, 147, 149, 152, 153, 155, 157, 158, 160, 162, 171, 172, 174, 176, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 204, 205, 212, 213, 214, 216, 217, 219, 231, 235, 236, 240, 242, 251, 252, 254, 255, 256, 257, 258, 260, 261, 262, 263, 267, 268, 269, 272, 274, 275, 276, 278, 279, 280, 281, 283, 286, 287, 288, 316, 317, 318, 319, 320, 322, 323, 324, 325, 326, 327, 328, 329, 330, 332, 333, 337, 338, 339, 340, 341, 345, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 369, 370, 371, 372, 379, 387, 389, 390, 392, 393, 394, 395, 548, 397, 398, 399, 400, 401, 402, 404, 406, 413, 414, 416, 418, 419, 421, 423, 430, 431, 433, 435, 436, 438, 440, 448, 450, 453, 454, 455, 456, 458, 459, 467, 546, 493, 502, 503, 508, 510], "/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/python/swagger_client/apis/pet_api.py": [513, 126, 375, 516, 517, 519, 520, 521, 523, 109, 525, 527, 528, 344, 18, 20, 533, 22, 23, 26, 539, 28, 29, 543, 32, 545, 546, 547, 548, 37, 550, 39, 40, 41, 42, 556, 45, 46, 48, 435, 862, 121, 348, 95, 123, 96, 578, 68, 581, 582, 71, 584, 74, 439, 655, 867, 345, 105, 100, 607, 608, 610, 611, 612, 617, 618, 530, 110, 229, 625, 114, 627, 628, 629, 118, 631, 633, 553, 635, 636, 637, 638, 639, 640, 642, 132, 534, 646, 647, 136, 138, 535, 652, 141, 142, 621, 144, 657, 658, 659, 660, 149, 662, 663, 664, 665, 666, 668, 318, 624, 446, 169, 549, 172, 173, 175, 689, 371, 692, 693, 695, 722, 116, 347, 196, 197, 199, 200, 201, 119, 143, 717, 718, 207, 720, 721, 210, 211, 206, 215, 728, 217, 731, 220, 122, 222, 735, 224, 737, 738, 227, 228, 741, 743, 744, 233, 234, 747, 748, 237, 750, 239, 240, 753, 754, 243, 244, 245, 246, 247, 248, 127, 250, 763, 765, 766, 213, 768, 769, 770, 771, 772, 773, 774, 145, 776, 44, 128, 727, 346, 270, 554, 273, 274, 276, 798, 645, 801, 802, 219, 804, 146, 140, 297, 298, 300, 301, 302, 307, 308, 734, 311, 312, 314, 223, 828, 317, 830, 831, 832, 322, 651, 147, 837, 838, 328, 841, 330, 343, 844, 845, 551, 847, 848, 849, 335, 739, 340, 853, 342, 855, 856, 857, 858, 859, 860, 349, 540, 351, 865, 866, 827, 871, 872, 316, 875, 877, 878, 879, 880, 881, 882, 883, 884, 885, 886, 745, 377, 661, 320, 98, 398, 399, 401, 402, 323, 409, 408, 106, 412, 413, 325, 133, 417, 418, 99, 139, 241, 424, 426, 242, 430, 431, 72, 755, 436, 329, 441, 442, 415, 444, 445, 429, 447, 448, 449, 450, 452, 403, 759, 112, 760, 419, 334, 472, 473, 851, 475, 476, 478, 421, 552, 374, 423, 338, 443, 499, 500, 502, 503, 504, 767, 509, 510, 341], "/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/python/swagger_client/apis/user_api.py": [791, 657, 18, 276, 149, 22, 23, 26, 28, 29, 32, 37, 39, 553, 684, 175, 48, 579, 456, 74, 378, 351, 481, 20, 250, 765], "/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/python/swagger_client/models/user.py": [278, 136, 266, 272, 147, 21, 22, 25, 284, 29, 158, 169, 180, 30, 191, 70, 202, 81, 213, 92, 224, 103, 235, 114, 19, 246, 125], "/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/python/swagger_client/__init__.py": [1, 4, 5, 6, 7, 8, 11, 12, 13, 16, 18, 20], "/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/python/swagger_client/rest.py": [20, 21, 23, 24, 25, 26, 27, 28, 31, 33, 35, 36, 40, 42, 43, 45, 48, 51, 53, 54, 55, 56, 57, 59, 63, 65, 72, 74, 82, 83, 88, 92, 95, 98, 101, 102, 103, 104, 105, 106, 109, 110, 121, 122, 124, 129, 130, 132, 135, 137, 138, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 152, 153, 154, 155, 156, 159, 160, 161, 166, 170, 174, 176, 177, 179, 181, 182, 183, 184, 186, 191, 198, 199, 200, 201, 203, 204, 205, 206, 207, 208, 210, 211, 212, 213, 214, 215, 217, 225, 227, 228, 229, 230, 231, 232, 239, 243, 244, 245, 246, 248, 249, 251]}} \ No newline at end of file diff --git a/samples/client/petstore/python/dev-requirements.txt.log b/samples/client/petstore/python/dev-requirements.txt.log new file mode 100644 index 00000000000..9a337359484 --- /dev/null +++ b/samples/client/petstore/python/dev-requirements.txt.log @@ -0,0 +1,253 @@ +Collecting nose (from -r dev-requirements.txt (line 1)) + Using cached nose-1.3.7-py2-none-any.whl +Collecting tox (from -r dev-requirements.txt (line 2)) + Using cached tox-2.1.1-py2.py3-none-any.whl +Collecting coverage (from -r dev-requirements.txt (line 3)) +Collecting randomize (from -r dev-requirements.txt (line 4)) + Using cached randomize-0.13-py2.py3-none-any.whl +Collecting virtualenv>=1.11.2 (from tox->-r dev-requirements.txt (line 2)) + Using cached virtualenv-13.1.2-py2.py3-none-any.whl +Collecting py>=1.4.17 (from tox->-r dev-requirements.txt (line 2)) + Using cached py-1.4.30-py2.py3-none-any.whl +Collecting pluggy<0.4.0,>=0.3.0 (from tox->-r dev-requirements.txt (line 2)) + Using cached pluggy-0.3.0-py2.py3-none-any.whl +Installing collected packages: nose, virtualenv, py, pluggy, tox, coverage, randomize +Successfully installed coverage-3.7.1 nose-1.3.7 pluggy-0.3.0 py-1.4.30 randomize-0.13 tox-2.1.1 virtualenv-13.1.2 +Requirement already satisfied (use --upgrade to upgrade): nose in ./.venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1)) +Requirement already satisfied (use --upgrade to upgrade): tox in ./.venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): coverage in ./.venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3)) +Requirement already satisfied (use --upgrade to upgrade): randomize in ./.venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4)) +Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./.venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./.venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./.venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1)) +Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3)) +Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4)) +Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1)) +Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3)) +Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4)) +Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1)) +Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3)) +Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4)) +Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1)) +Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3)) +Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4)) +Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1)) +Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3)) +Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4)) +Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1)) +Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3)) +Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4)) +Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1)) +Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3)) +Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4)) +Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Collecting nose (from -r dev-requirements.txt (line 1)) + Using cached nose-1.3.7-py2-none-any.whl +Collecting tox (from -r dev-requirements.txt (line 2)) + Using cached tox-2.2.1-py2.py3-none-any.whl +Collecting coverage (from -r dev-requirements.txt (line 3)) + Downloading coverage-4.0.3.tar.gz (354kB) +Collecting randomize (from -r dev-requirements.txt (line 4)) + Using cached randomize-0.13-py2.py3-none-any.whl +Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in /Library/Python/2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Collecting py>=1.4.17 (from tox->-r dev-requirements.txt (line 2)) + Downloading py-1.4.31-py2.py3-none-any.whl (81kB) +Collecting pluggy<0.4.0,>=0.3.0 (from tox->-r dev-requirements.txt (line 2)) + Using cached pluggy-0.3.1-py2.py3-none-any.whl +Installing collected packages: nose, py, pluggy, tox, coverage, randomize +Collecting nose (from -r dev-requirements.txt (line 1)) + Using cached nose-1.3.7-py2-none-any.whl +Collecting tox (from -r dev-requirements.txt (line 2)) + Using cached tox-2.2.1-py2.py3-none-any.whl +Collecting coverage (from -r dev-requirements.txt (line 3)) + Using cached coverage-4.0.3.tar.gz +Collecting randomize (from -r dev-requirements.txt (line 4)) + Using cached randomize-0.13-py2.py3-none-any.whl +Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in /Library/Python/2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Collecting py>=1.4.17 (from tox->-r dev-requirements.txt (line 2)) + Using cached py-1.4.31-py2.py3-none-any.whl +Collecting pluggy<0.4.0,>=0.3.0 (from tox->-r dev-requirements.txt (line 2)) + Using cached pluggy-0.3.1-py2.py3-none-any.whl +Installing collected packages: nose, py, pluggy, tox, coverage, randomize +Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1)) +Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3)) +Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4)) +Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1)) +Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3)) +Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4)) +Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1)) +Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3)) +Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4)) +Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1)) +Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3)) +Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4)) +Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1)) +Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3)) +Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4)) +Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1)) +Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3)) +Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4)) +Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1)) +Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3)) +Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4)) +Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1)) +Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3)) +Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4)) +Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1)) +Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3)) +Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4)) +Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1)) +Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3)) +Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4)) +Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1)) +Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3)) +Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4)) +Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1)) +Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3)) +Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4)) +Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1)) +Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3)) +Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4)) +Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1)) +Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3)) +Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4)) +Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1)) +Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3)) +Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4)) +Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1)) +Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3)) +Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4)) +Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1)) +Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3)) +Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4)) +Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1)) +Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3)) +Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4)) +Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1)) +Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3)) +Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4)) +Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1)) +Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3)) +Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4)) +Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1)) +Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3)) +Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4)) +Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1)) +Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3)) +Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4)) +Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) diff --git a/samples/client/petstore/python/swagger_client/api_client.py b/samples/client/petstore/python/swagger_client/api_client.py index e598115e319..e5e4738e961 100644 --- a/samples/client/petstore/python/swagger_client/api_client.py +++ b/samples/client/petstore/python/swagger_client/api_client.py @@ -157,9 +157,9 @@ class ApiClient(object): deserialized_data = None if callback: - callback(deserialized_data) + callback((deserialized_data, response_data.status, response_data.getheaders())) else: - return deserialized_data + return (deserialized_data, response_data.status, response_data.getheaders()) def to_path_value(self, obj): """ diff --git a/samples/client/petstore/python/swagger_client/apis/pet_api.py b/samples/client/petstore/python/swagger_client/apis/pet_api.py index 8b081e077dc..134e299c0f9 100644 --- a/samples/client/petstore/python/swagger_client/apis/pet_api.py +++ b/samples/client/petstore/python/swagger_client/apis/pet_api.py @@ -2,7 +2,7 @@ """ PetApi.py -Copyright 2016 SmartBear Software +Copyright 2015 SmartBear Software Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -45,6 +45,107 @@ class PetApi(object): config.api_client = ApiClient() self.api_client = config.api_client + def update_pet(self, **kwargs): + """ + Update an existing pet + + + 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.update_pet(callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :param Pet body: Pet object that needs to be added to the store + :return: None + If the method is called asynchronously, + returns the request thread. + """ + if kwargs.get('callback'): + return self.update_pet_with_http_info(**kwargs) + else: + (data, status_code, response_headers) = self.update_pet_with_http_info(**kwargs) + return data + + def update_pet_with_http_info(self, **kwargs): + """ + Update an existing pet + + + 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.update_pet_with_http_info(callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :param Pet body: Pet object that needs to be added to the store + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] + all_params.append('callback') + + 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 update_pet" % key + ) + params[key] = val + del params['kwargs'] + + + resource_path = '/pet'.replace('{format}', 'json') + method = 'PUT' + + path_params = {} + + query_params = {} + + header_params = {} + + form_params = {} + 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', 'application/xml']) + if not header_params['Accept']: + del header_params['Accept'] + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.\ + select_header_content_type(['application/json', 'application/xml']) + + # Authentication setting + auth_settings = ['petstore_auth'] + + return self.api_client.call_api(resource_path, method, + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=files, + response_type=None, + auth_settings=auth_settings, + callback=params.get('callback')) + def add_pet(self, **kwargs): """ Add a new pet to the store @@ -58,6 +159,32 @@ class PetApi(object): >>> >>> thread = api.add_pet(callback=callback_function) + :param callback function: The callback function + for asynchronous request. (optional) + :param Pet body: Pet object that needs to be added to the store + :return: None + If the method is called asynchronously, + returns the request thread. + """ + if kwargs.get('callback'): + return self.add_pet_with_http_info(**kwargs) + else: + (data, status_code, response_headers) = self.add_pet_with_http_info(**kwargs) + return data + + def add_pet_with_http_info(self, **kwargs): + """ + Add a new pet to the store + + + 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.add_pet_with_http_info(callback=callback_function) + :param callback function: The callback function for asynchronous request. (optional) :param Pet body: Pet object that needs to be added to the store @@ -81,14 +208,16 @@ class PetApi(object): resource_path = '/pet'.replace('{format}', 'json') + method = 'POST' + path_params = {} query_params = {} header_params = {} - form_params = [] - local_var_files = {} + form_params = {} + files = {} body_params = None if 'body' in params: @@ -107,176 +236,21 @@ class PetApi(object): # Authentication setting auth_settings = ['petstore_auth'] - response = self.api_client.call_api(resource_path, 'POST', + return self.api_client.call_api(resource_path, method, path_params, query_params, header_params, body=body_params, post_params=form_params, - files=local_var_files, + files=files, response_type=None, auth_settings=auth_settings, callback=params.get('callback')) - return response - - def add_pet_using_byte_array(self, **kwargs): - """ - Fake endpoint to test byte array in body parameter for adding a new pet to the store - - - 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.add_pet_using_byte_array(callback=callback_function) - - :param callback function: The callback function - for asynchronous request. (optional) - :param str body: Pet object in the form of byte array - :return: None - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body'] - all_params.append('callback') - - 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 add_pet_using_byte_array" % key - ) - params[key] = val - del params['kwargs'] - - - resource_path = '/pet?testing_byte_array=true'.replace('{format}', 'json') - 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', 'application/xml']) - if not header_params['Accept']: - del header_params['Accept'] - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.\ - select_header_content_type(['application/json', 'application/xml']) - - # Authentication setting - auth_settings = ['petstore_auth'] - - response = self.api_client.call_api(resource_path, 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type=None, - auth_settings=auth_settings, - callback=params.get('callback')) - return response - - def delete_pet(self, pet_id, **kwargs): - """ - Deletes a pet - - - 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.delete_pet(pet_id, callback=callback_function) - - :param callback function: The callback function - for asynchronous request. (optional) - :param int pet_id: Pet id to delete (required) - :param str api_key: - :return: None - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['pet_id', 'api_key'] - all_params.append('callback') - - 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 delete_pet" % key - ) - params[key] = val - del params['kwargs'] - - # verify the required parameter 'pet_id' is set - if ('pet_id' not in params) or (params['pet_id'] is None): - raise ValueError("Missing the required parameter `pet_id` when calling `delete_pet`") - - resource_path = '/pet/{petId}'.replace('{format}', 'json') - path_params = {} - if 'pet_id' in params: - path_params['petId'] = params['pet_id'] - - query_params = {} - - header_params = {} - if 'api_key' in params: - header_params['api_key'] = params['api_key'] - - form_params = [] - local_var_files = {} - - body_params = None - - # HTTP header `Accept` - header_params['Accept'] = self.api_client.\ - select_header_accept(['application/json', 'application/xml']) - if not header_params['Accept']: - del header_params['Accept'] - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.\ - select_header_content_type([]) - - # Authentication setting - auth_settings = ['petstore_auth'] - - response = self.api_client.call_api(resource_path, 'DELETE', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type=None, - auth_settings=auth_settings, - callback=params.get('callback')) - return response def find_pets_by_status(self, **kwargs): """ Finds Pets by status - Multiple status values can be provided with comma separated strings + Multiple status values can be provided with comma seperated strings This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function @@ -288,7 +262,33 @@ class PetApi(object): :param callback function: The callback function for asynchronous request. (optional) - :param list[str] status: Status values that need to be considered for query + :param list[str] status: Status values that need to be considered for filter + :return: list[Pet] + If the method is called asynchronously, + returns the request thread. + """ + if kwargs.get('callback'): + return self.find_pets_by_status_with_http_info(**kwargs) + else: + (data, status_code, response_headers) = self.find_pets_by_status_with_http_info(**kwargs) + return data + + def find_pets_by_status_with_http_info(self, **kwargs): + """ + Finds Pets by status + Multiple status values can be provided with comma seperated strings + + 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.find_pets_by_status_with_http_info(callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :param list[str] status: Status values that need to be considered for filter :return: list[Pet] If the method is called asynchronously, returns the request thread. @@ -309,6 +309,8 @@ class PetApi(object): resource_path = '/pet/findByStatus'.replace('{format}', 'json') + method = 'GET' + path_params = {} query_params = {} @@ -317,8 +319,8 @@ class PetApi(object): header_params = {} - form_params = [] - local_var_files = {} + form_params = {} + files = {} body_params = None @@ -335,17 +337,16 @@ class PetApi(object): # Authentication setting auth_settings = ['petstore_auth'] - response = self.api_client.call_api(resource_path, 'GET', + return self.api_client.call_api(resource_path, method, path_params, query_params, header_params, body=body_params, post_params=form_params, - files=local_var_files, + files=files, response_type='list[Pet]', auth_settings=auth_settings, callback=params.get('callback')) - return response def find_pets_by_tags(self, **kwargs): """ @@ -360,6 +361,32 @@ class PetApi(object): >>> >>> thread = api.find_pets_by_tags(callback=callback_function) + :param callback function: The callback function + for asynchronous request. (optional) + :param list[str] tags: Tags to filter by + :return: list[Pet] + If the method is called asynchronously, + returns the request thread. + """ + if kwargs.get('callback'): + return self.find_pets_by_tags_with_http_info(**kwargs) + else: + (data, status_code, response_headers) = self.find_pets_by_tags_with_http_info(**kwargs) + return data + + def find_pets_by_tags_with_http_info(self, **kwargs): + """ + Finds Pets by tags + Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. + + 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.find_pets_by_tags_with_http_info(callback=callback_function) + :param callback function: The callback function for asynchronous request. (optional) :param list[str] tags: Tags to filter by @@ -383,6 +410,8 @@ class PetApi(object): resource_path = '/pet/findByTags'.replace('{format}', 'json') + method = 'GET' + path_params = {} query_params = {} @@ -391,8 +420,8 @@ class PetApi(object): header_params = {} - form_params = [] - local_var_files = {} + form_params = {} + files = {} body_params = None @@ -409,17 +438,16 @@ class PetApi(object): # Authentication setting auth_settings = ['petstore_auth'] - response = self.api_client.call_api(resource_path, 'GET', + return self.api_client.call_api(resource_path, method, path_params, query_params, header_params, body=body_params, post_params=form_params, - files=local_var_files, + files=files, response_type='list[Pet]', auth_settings=auth_settings, callback=params.get('callback')) - return response def get_pet_by_id(self, pet_id, **kwargs): """ @@ -434,6 +462,32 @@ class PetApi(object): >>> >>> thread = api.get_pet_by_id(pet_id, callback=callback_function) + :param callback function: The callback function + for asynchronous request. (optional) + :param int pet_id: ID of pet that needs to be fetched (required) + :return: Pet + If the method is called asynchronously, + returns the request thread. + """ + if kwargs.get('callback'): + return self.get_pet_by_id_with_http_info(pet_id, **kwargs) + else: + (data, status_code, response_headers) = self.get_pet_by_id_with_http_info(pet_id, **kwargs) + return data + + def get_pet_by_id_with_http_info(self, pet_id, **kwargs): + """ + Find pet by ID + Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions + + 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.get_pet_by_id_with_http_info(pet_id, callback=callback_function) + :param callback function: The callback function for asynchronous request. (optional) :param int pet_id: ID of pet that needs to be fetched (required) @@ -460,6 +514,8 @@ class PetApi(object): raise ValueError("Missing the required parameter `pet_id` when calling `get_pet_by_id`") resource_path = '/pet/{petId}'.replace('{format}', 'json') + method = 'GET' + path_params = {} if 'pet_id' in params: path_params['petId'] = params['pet_id'] @@ -468,8 +524,8 @@ class PetApi(object): header_params = {} - form_params = [] - local_var_files = {} + form_params = {} + files = {} body_params = None @@ -484,247 +540,18 @@ class PetApi(object): select_header_content_type([]) # Authentication setting - auth_settings = ['api_key', 'petstore_auth'] + auth_settings = ['api_key'] - response = self.api_client.call_api(resource_path, 'GET', + return self.api_client.call_api(resource_path, method, path_params, query_params, header_params, body=body_params, post_params=form_params, - files=local_var_files, + files=files, response_type='Pet', auth_settings=auth_settings, callback=params.get('callback')) - return response - - def get_pet_by_id_in_object(self, pet_id, **kwargs): - """ - Fake endpoint to test inline arbitrary object return by 'Find pet by ID' - Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - - 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.get_pet_by_id_in_object(pet_id, callback=callback_function) - - :param callback function: The callback function - for asynchronous request. (optional) - :param int pet_id: ID of pet that needs to be fetched (required) - :return: InlineResponse200 - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['pet_id'] - all_params.append('callback') - - 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 get_pet_by_id_in_object" % key - ) - params[key] = val - del params['kwargs'] - - # verify the required parameter 'pet_id' is set - if ('pet_id' not in params) or (params['pet_id'] is None): - raise ValueError("Missing the required parameter `pet_id` when calling `get_pet_by_id_in_object`") - - resource_path = '/pet/{petId}?response=inline_arbitrary_object'.replace('{format}', 'json') - path_params = {} - if 'pet_id' in params: - path_params['petId'] = params['pet_id'] - - query_params = {} - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - - # HTTP header `Accept` - header_params['Accept'] = self.api_client.\ - select_header_accept(['application/json', 'application/xml']) - if not header_params['Accept']: - del header_params['Accept'] - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.\ - select_header_content_type([]) - - # Authentication setting - auth_settings = ['api_key', 'petstore_auth'] - - response = self.api_client.call_api(resource_path, 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='InlineResponse200', - auth_settings=auth_settings, - callback=params.get('callback')) - return response - - def pet_pet_idtesting_byte_arraytrue_get(self, pet_id, **kwargs): - """ - Fake endpoint to test byte array return by 'Find pet by ID' - Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - - 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.pet_pet_idtesting_byte_arraytrue_get(pet_id, callback=callback_function) - - :param callback function: The callback function - for asynchronous request. (optional) - :param int pet_id: ID of pet that needs to be fetched (required) - :return: str - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['pet_id'] - all_params.append('callback') - - 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 pet_pet_idtesting_byte_arraytrue_get" % key - ) - params[key] = val - del params['kwargs'] - - # verify the required parameter 'pet_id' is set - if ('pet_id' not in params) or (params['pet_id'] is None): - raise ValueError("Missing the required parameter `pet_id` when calling `pet_pet_idtesting_byte_arraytrue_get`") - - resource_path = '/pet/{petId}?testing_byte_array=true'.replace('{format}', 'json') - path_params = {} - if 'pet_id' in params: - path_params['petId'] = params['pet_id'] - - query_params = {} - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - - # HTTP header `Accept` - header_params['Accept'] = self.api_client.\ - select_header_accept(['application/json', 'application/xml']) - if not header_params['Accept']: - del header_params['Accept'] - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.\ - select_header_content_type([]) - - # Authentication setting - auth_settings = ['api_key', 'petstore_auth'] - - response = self.api_client.call_api(resource_path, 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='str', - auth_settings=auth_settings, - callback=params.get('callback')) - return response - - def update_pet(self, **kwargs): - """ - Update an existing pet - - - 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.update_pet(callback=callback_function) - - :param callback function: The callback function - for asynchronous request. (optional) - :param Pet body: Pet object that needs to be added to the store - :return: None - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body'] - all_params.append('callback') - - 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 update_pet" % key - ) - params[key] = val - del params['kwargs'] - - - resource_path = '/pet'.replace('{format}', 'json') - 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', 'application/xml']) - if not header_params['Accept']: - del header_params['Accept'] - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.\ - select_header_content_type(['application/json', 'application/xml']) - - # Authentication setting - auth_settings = ['petstore_auth'] - - response = self.api_client.call_api(resource_path, 'PUT', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type=None, - auth_settings=auth_settings, - callback=params.get('callback')) - return response def update_pet_with_form(self, pet_id, **kwargs): """ @@ -739,6 +566,34 @@ class PetApi(object): >>> >>> thread = api.update_pet_with_form(pet_id, callback=callback_function) + :param callback function: The callback function + for asynchronous request. (optional) + :param str pet_id: ID of pet that needs to be updated (required) + :param str name: Updated name of the pet + :param str status: Updated status of the pet + :return: None + If the method is called asynchronously, + returns the request thread. + """ + if kwargs.get('callback'): + return self.update_pet_with_form_with_http_info(pet_id, **kwargs) + else: + (data, status_code, response_headers) = self.update_pet_with_form_with_http_info(pet_id, **kwargs) + return data + + def update_pet_with_form_with_http_info(self, pet_id, **kwargs): + """ + Updates a pet in the store with form data + + + 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.update_pet_with_form_with_http_info(pet_id, callback=callback_function) + :param callback function: The callback function for asynchronous request. (optional) :param str pet_id: ID of pet that needs to be updated (required) @@ -767,6 +622,8 @@ class PetApi(object): raise ValueError("Missing the required parameter `pet_id` when calling `update_pet_with_form`") resource_path = '/pet/{petId}'.replace('{format}', 'json') + method = 'POST' + path_params = {} if 'pet_id' in params: path_params['petId'] = params['pet_id'] @@ -775,12 +632,12 @@ class PetApi(object): header_params = {} - form_params = [] - local_var_files = {} + form_params = {} + files = {} if 'name' in params: - form_params.append(('name', params['name'])) + form_params['name'] = params['name'] if 'status' in params: - form_params.append(('status', params['status'])) + form_params['status'] = params['status'] body_params = None @@ -797,17 +654,124 @@ class PetApi(object): # Authentication setting auth_settings = ['petstore_auth'] - response = self.api_client.call_api(resource_path, 'POST', + return self.api_client.call_api(resource_path, method, path_params, query_params, header_params, body=body_params, post_params=form_params, - files=local_var_files, + files=files, + response_type=None, + auth_settings=auth_settings, + callback=params.get('callback')) + + def delete_pet(self, pet_id, **kwargs): + """ + Deletes a pet + + + 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.delete_pet(pet_id, callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :param int pet_id: Pet id to delete (required) + :param str api_key: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + if kwargs.get('callback'): + return self.delete_pet_with_http_info(pet_id, **kwargs) + else: + (data, status_code, response_headers) = self.delete_pet_with_http_info(pet_id, **kwargs) + return data + + def delete_pet_with_http_info(self, pet_id, **kwargs): + """ + Deletes a pet + + + 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.delete_pet_with_http_info(pet_id, callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :param int pet_id: Pet id to delete (required) + :param str api_key: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['pet_id', 'api_key'] + all_params.append('callback') + + 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 delete_pet" % key + ) + params[key] = val + del params['kwargs'] + + # verify the required parameter 'pet_id' is set + if ('pet_id' not in params) or (params['pet_id'] is None): + raise ValueError("Missing the required parameter `pet_id` when calling `delete_pet`") + + resource_path = '/pet/{petId}'.replace('{format}', 'json') + method = 'DELETE' + + path_params = {} + if 'pet_id' in params: + path_params['petId'] = params['pet_id'] + + query_params = {} + + header_params = {} + if 'api_key' in params: + header_params['api_key'] = params['api_key'] + + form_params = {} + files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.\ + select_header_accept(['application/json', 'application/xml']) + if not header_params['Accept']: + del header_params['Accept'] + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.\ + select_header_content_type([]) + + # Authentication setting + auth_settings = ['petstore_auth'] + + return self.api_client.call_api(resource_path, method, + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=files, response_type=None, auth_settings=auth_settings, callback=params.get('callback')) - return response def upload_file(self, pet_id, **kwargs): """ @@ -822,6 +786,34 @@ class PetApi(object): >>> >>> thread = api.upload_file(pet_id, callback=callback_function) + :param callback function: The callback function + for asynchronous request. (optional) + :param int pet_id: ID of pet to update (required) + :param str additional_metadata: Additional data to pass to server + :param file file: file to upload + :return: None + If the method is called asynchronously, + returns the request thread. + """ + if kwargs.get('callback'): + return self.upload_file_with_http_info(pet_id, **kwargs) + else: + (data, status_code, response_headers) = self.upload_file_with_http_info(pet_id, **kwargs) + return data + + def upload_file_with_http_info(self, pet_id, **kwargs): + """ + uploads an image + + + 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.upload_file_with_http_info(pet_id, callback=callback_function) + :param callback function: The callback function for asynchronous request. (optional) :param int pet_id: ID of pet to update (required) @@ -850,6 +842,8 @@ class PetApi(object): raise ValueError("Missing the required parameter `pet_id` when calling `upload_file`") resource_path = '/pet/{petId}/uploadImage'.replace('{format}', 'json') + method = 'POST' + path_params = {} if 'pet_id' in params: path_params['petId'] = params['pet_id'] @@ -858,12 +852,12 @@ class PetApi(object): header_params = {} - form_params = [] - local_var_files = {} + form_params = {} + files = {} if 'additional_metadata' in params: - form_params.append(('additionalMetadata', params['additional_metadata'])) + form_params['additionalMetadata'] = params['additional_metadata'] if 'file' in params: - local_var_files['file'] = params['file'] + files['file'] = params['file'] body_params = None @@ -880,14 +874,13 @@ class PetApi(object): # Authentication setting auth_settings = ['petstore_auth'] - response = self.api_client.call_api(resource_path, 'POST', + return self.api_client.call_api(resource_path, method, path_params, query_params, header_params, body=body_params, post_params=form_params, - files=local_var_files, + files=files, response_type=None, auth_settings=auth_settings, callback=params.get('callback')) - return response diff --git a/samples/client/petstore/python/swagger_client/apis/store_api.py b/samples/client/petstore/python/swagger_client/apis/store_api.py index 85bb90ed40c..ee6e2f7633d 100644 --- a/samples/client/petstore/python/swagger_client/apis/store_api.py +++ b/samples/client/petstore/python/swagger_client/apis/store_api.py @@ -2,7 +2,7 @@ """ StoreApi.py -Copyright 2016 SmartBear Software +Copyright 2015 SmartBear Software Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -45,157 +45,6 @@ class StoreApi(object): config.api_client = ApiClient() self.api_client = config.api_client - def delete_order(self, order_id, **kwargs): - """ - Delete purchase order by ID - For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - - 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.delete_order(order_id, callback=callback_function) - - :param callback function: The callback function - for asynchronous request. (optional) - :param str order_id: ID of the order that needs to be deleted (required) - :return: None - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['order_id'] - all_params.append('callback') - - 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 delete_order" % key - ) - params[key] = val - del params['kwargs'] - - # verify the required parameter 'order_id' is set - if ('order_id' not in params) or (params['order_id'] is None): - raise ValueError("Missing the required parameter `order_id` when calling `delete_order`") - - resource_path = '/store/order/{orderId}'.replace('{format}', 'json') - path_params = {} - if 'order_id' in params: - path_params['orderId'] = params['order_id'] - - query_params = {} - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - - # HTTP header `Accept` - header_params['Accept'] = self.api_client.\ - select_header_accept(['application/json', 'application/xml']) - if not header_params['Accept']: - del header_params['Accept'] - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.\ - select_header_content_type([]) - - # Authentication setting - auth_settings = [] - - response = self.api_client.call_api(resource_path, 'DELETE', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type=None, - auth_settings=auth_settings, - callback=params.get('callback')) - return response - - def find_orders_by_status(self, **kwargs): - """ - Finds orders by status - A single status value can be provided as a string - - 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.find_orders_by_status(callback=callback_function) - - :param callback function: The callback function - for asynchronous request. (optional) - :param str status: Status value that needs to be considered for query - :return: list[Order] - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['status'] - all_params.append('callback') - - 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 find_orders_by_status" % key - ) - params[key] = val - del params['kwargs'] - - - resource_path = '/store/findByStatus'.replace('{format}', 'json') - path_params = {} - - query_params = {} - if 'status' in params: - query_params['status'] = params['status'] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - - # HTTP header `Accept` - header_params['Accept'] = self.api_client.\ - select_header_accept(['application/json', 'application/xml']) - if not header_params['Accept']: - del header_params['Accept'] - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.\ - select_header_content_type([]) - - # Authentication setting - auth_settings = ['test_api_client_id', 'test_api_client_secret'] - - response = self.api_client.call_api(resource_path, 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='list[Order]', - auth_settings=auth_settings, - callback=params.get('callback')) - return response - def get_inventory(self, **kwargs): """ Returns pet inventories by status @@ -209,6 +58,31 @@ class StoreApi(object): >>> >>> thread = api.get_inventory(callback=callback_function) + :param callback function: The callback function + for asynchronous request. (optional) + :return: dict(str, int) + If the method is called asynchronously, + returns the request thread. + """ + if kwargs.get('callback'): + return self.get_inventory_with_http_info(**kwargs) + else: + (data, status_code, response_headers) = self.get_inventory_with_http_info(**kwargs) + return data + + def get_inventory_with_http_info(self, **kwargs): + """ + Returns pet inventories by status + Returns a map of status codes to quantities + + 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.get_inventory_with_http_info(callback=callback_function) + :param callback function: The callback function for asynchronous request. (optional) :return: dict(str, int) @@ -231,14 +105,16 @@ class StoreApi(object): resource_path = '/store/inventory'.replace('{format}', 'json') + method = 'GET' + path_params = {} query_params = {} header_params = {} - form_params = [] - local_var_files = {} + form_params = {} + files = {} body_params = None @@ -255,22 +131,21 @@ class StoreApi(object): # Authentication setting auth_settings = ['api_key'] - response = self.api_client.call_api(resource_path, 'GET', + return self.api_client.call_api(resource_path, method, path_params, query_params, header_params, body=body_params, post_params=form_params, - files=local_var_files, + files=files, response_type='dict(str, int)', auth_settings=auth_settings, callback=params.get('callback')) - return response - def get_inventory_in_object(self, **kwargs): + def place_order(self, **kwargs): """ - Fake endpoint to test arbitrary object return by 'Get inventory' - Returns an arbitrary object which is actually a map of status codes to quantities + Place an order for a pet + This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function @@ -278,16 +153,43 @@ class StoreApi(object): >>> def callback_function(response): >>> pprint(response) >>> - >>> thread = api.get_inventory_in_object(callback=callback_function) + >>> thread = api.place_order(callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) - :return: object + :param Order body: order placed for purchasing the pet + :return: Order + If the method is called asynchronously, + returns the request thread. + """ + if kwargs.get('callback'): + return self.place_order_with_http_info(**kwargs) + else: + (data, status_code, response_headers) = self.place_order_with_http_info(**kwargs) + return data + + def place_order_with_http_info(self, **kwargs): + """ + Place an order for a pet + + + 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.place_order_with_http_info(callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :param Order body: order placed for purchasing the pet + :return: Order If the method is called asynchronously, returns the request thread. """ - all_params = [] + all_params = ['body'] all_params.append('callback') params = locals() @@ -295,23 +197,27 @@ class StoreApi(object): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" - " to method get_inventory_in_object" % key + " to method place_order" % key ) params[key] = val del params['kwargs'] - resource_path = '/store/inventory?response=arbitrary_object'.replace('{format}', 'json') + resource_path = '/store/order'.replace('{format}', 'json') + method = 'POST' + path_params = {} query_params = {} header_params = {} - form_params = [] - local_var_files = {} + form_params = {} + files = {} body_params = None + if 'body' in params: + body_params = params['body'] # HTTP header `Accept` header_params['Accept'] = self.api_client.\ @@ -324,19 +230,18 @@ class StoreApi(object): select_header_content_type([]) # Authentication setting - auth_settings = ['api_key'] + auth_settings = [] - response = self.api_client.call_api(resource_path, 'GET', + return self.api_client.call_api(resource_path, method, path_params, query_params, header_params, body=body_params, post_params=form_params, - files=local_var_files, - response_type='object', + files=files, + response_type='Order', auth_settings=auth_settings, callback=params.get('callback')) - return response def get_order_by_id(self, order_id, **kwargs): """ @@ -351,6 +256,32 @@ class StoreApi(object): >>> >>> thread = api.get_order_by_id(order_id, callback=callback_function) + :param callback function: The callback function + for asynchronous request. (optional) + :param str order_id: ID of pet that needs to be fetched (required) + :return: Order + If the method is called asynchronously, + returns the request thread. + """ + if kwargs.get('callback'): + return self.get_order_by_id_with_http_info(order_id, **kwargs) + else: + (data, status_code, response_headers) = self.get_order_by_id_with_http_info(order_id, **kwargs) + return data + + def get_order_by_id_with_http_info(self, order_id, **kwargs): + """ + Find purchase order by ID + For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + + 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.get_order_by_id_with_http_info(order_id, callback=callback_function) + :param callback function: The callback function for asynchronous request. (optional) :param str order_id: ID of pet that needs to be fetched (required) @@ -377,6 +308,8 @@ class StoreApi(object): raise ValueError("Missing the required parameter `order_id` when calling `get_order_by_id`") resource_path = '/store/order/{orderId}'.replace('{format}', 'json') + method = 'GET' + path_params = {} if 'order_id' in params: path_params['orderId'] = params['order_id'] @@ -385,8 +318,8 @@ class StoreApi(object): header_params = {} - form_params = [] - local_var_files = {} + form_params = {} + files = {} body_params = None @@ -401,24 +334,23 @@ class StoreApi(object): select_header_content_type([]) # Authentication setting - auth_settings = ['test_api_key_header', 'test_api_key_query'] + auth_settings = [] - response = self.api_client.call_api(resource_path, 'GET', + return self.api_client.call_api(resource_path, method, path_params, query_params, header_params, body=body_params, post_params=form_params, - files=local_var_files, + files=files, response_type='Order', auth_settings=auth_settings, callback=params.get('callback')) - return response - def place_order(self, **kwargs): + def delete_order(self, order_id, **kwargs): """ - Place an order for a pet - + Delete purchase order by ID + For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function @@ -426,17 +358,43 @@ class StoreApi(object): >>> def callback_function(response): >>> pprint(response) >>> - >>> thread = api.place_order(callback=callback_function) + >>> thread = api.delete_order(order_id, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) - :param Order body: order placed for purchasing the pet - :return: Order + :param str order_id: ID of the order that needs to be deleted (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + if kwargs.get('callback'): + return self.delete_order_with_http_info(order_id, **kwargs) + else: + (data, status_code, response_headers) = self.delete_order_with_http_info(order_id, **kwargs) + return data + + def delete_order_with_http_info(self, order_id, **kwargs): + """ + Delete purchase order by ID + For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + + 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.delete_order_with_http_info(order_id, callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :param str order_id: ID of the order that needs to be deleted (required) + :return: None If the method is called asynchronously, returns the request thread. """ - all_params = ['body'] + all_params = ['order_id'] all_params.append('callback') params = locals() @@ -444,25 +402,30 @@ class StoreApi(object): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" - " to method place_order" % key + " to method delete_order" % key ) params[key] = val del params['kwargs'] + # verify the required parameter 'order_id' is set + if ('order_id' not in params) or (params['order_id'] is None): + raise ValueError("Missing the required parameter `order_id` when calling `delete_order`") + + resource_path = '/store/order/{orderId}'.replace('{format}', 'json') + method = 'DELETE' - resource_path = '/store/order'.replace('{format}', 'json') path_params = {} + if 'order_id' in params: + path_params['orderId'] = params['order_id'] query_params = {} header_params = {} - form_params = [] - local_var_files = {} + form_params = {} + files = {} body_params = None - if 'body' in params: - body_params = params['body'] # HTTP header `Accept` header_params['Accept'] = self.api_client.\ @@ -475,16 +438,15 @@ class StoreApi(object): select_header_content_type([]) # Authentication setting - auth_settings = ['test_api_client_id', 'test_api_client_secret'] + auth_settings = [] - response = self.api_client.call_api(resource_path, 'POST', + return self.api_client.call_api(resource_path, method, path_params, query_params, header_params, body=body_params, post_params=form_params, - files=local_var_files, - response_type='Order', + files=files, + response_type=None, auth_settings=auth_settings, callback=params.get('callback')) - return response diff --git a/samples/client/petstore/python/swagger_client/apis/user_api.py b/samples/client/petstore/python/swagger_client/apis/user_api.py index 07d976b0bf5..8ce1ddd151a 100644 --- a/samples/client/petstore/python/swagger_client/apis/user_api.py +++ b/samples/client/petstore/python/swagger_client/apis/user_api.py @@ -2,7 +2,7 @@ """ UserApi.py -Copyright 2016 SmartBear Software +Copyright 2015 SmartBear Software Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -58,6 +58,32 @@ class UserApi(object): >>> >>> thread = api.create_user(callback=callback_function) + :param callback function: The callback function + for asynchronous request. (optional) + :param User body: Created user object + :return: None + If the method is called asynchronously, + returns the request thread. + """ + if kwargs.get('callback'): + return self.create_user_with_http_info(**kwargs) + else: + (data, status_code, response_headers) = self.create_user_with_http_info(**kwargs) + return data + + def create_user_with_http_info(self, **kwargs): + """ + Create user + This can only be done by the logged in user. + + 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.create_user_with_http_info(callback=callback_function) + :param callback function: The callback function for asynchronous request. (optional) :param User body: Created user object @@ -81,14 +107,16 @@ class UserApi(object): resource_path = '/user'.replace('{format}', 'json') + method = 'POST' + path_params = {} query_params = {} header_params = {} - form_params = [] - local_var_files = {} + form_params = {} + files = {} body_params = None if 'body' in params: @@ -107,17 +135,16 @@ class UserApi(object): # Authentication setting auth_settings = [] - response = self.api_client.call_api(resource_path, 'POST', + return self.api_client.call_api(resource_path, method, path_params, query_params, header_params, body=body_params, post_params=form_params, - files=local_var_files, + files=files, response_type=None, auth_settings=auth_settings, callback=params.get('callback')) - return response def create_users_with_array_input(self, **kwargs): """ @@ -132,6 +159,32 @@ class UserApi(object): >>> >>> thread = api.create_users_with_array_input(callback=callback_function) + :param callback function: The callback function + for asynchronous request. (optional) + :param list[User] body: List of user object + :return: None + If the method is called asynchronously, + returns the request thread. + """ + if kwargs.get('callback'): + return self.create_users_with_array_input_with_http_info(**kwargs) + else: + (data, status_code, response_headers) = self.create_users_with_array_input_with_http_info(**kwargs) + return data + + def create_users_with_array_input_with_http_info(self, **kwargs): + """ + Creates list of users with given input array + + + 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.create_users_with_array_input_with_http_info(callback=callback_function) + :param callback function: The callback function for asynchronous request. (optional) :param list[User] body: List of user object @@ -155,14 +208,16 @@ class UserApi(object): resource_path = '/user/createWithArray'.replace('{format}', 'json') + method = 'POST' + path_params = {} query_params = {} header_params = {} - form_params = [] - local_var_files = {} + form_params = {} + files = {} body_params = None if 'body' in params: @@ -181,17 +236,16 @@ class UserApi(object): # Authentication setting auth_settings = [] - response = self.api_client.call_api(resource_path, 'POST', + return self.api_client.call_api(resource_path, method, path_params, query_params, header_params, body=body_params, post_params=form_params, - files=local_var_files, + files=files, response_type=None, auth_settings=auth_settings, callback=params.get('callback')) - return response def create_users_with_list_input(self, **kwargs): """ @@ -206,6 +260,32 @@ class UserApi(object): >>> >>> thread = api.create_users_with_list_input(callback=callback_function) + :param callback function: The callback function + for asynchronous request. (optional) + :param list[User] body: List of user object + :return: None + If the method is called asynchronously, + returns the request thread. + """ + if kwargs.get('callback'): + return self.create_users_with_list_input_with_http_info(**kwargs) + else: + (data, status_code, response_headers) = self.create_users_with_list_input_with_http_info(**kwargs) + return data + + def create_users_with_list_input_with_http_info(self, **kwargs): + """ + Creates list of users with given input array + + + 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.create_users_with_list_input_with_http_info(callback=callback_function) + :param callback function: The callback function for asynchronous request. (optional) :param list[User] body: List of user object @@ -229,14 +309,16 @@ class UserApi(object): resource_path = '/user/createWithList'.replace('{format}', 'json') + method = 'POST' + path_params = {} query_params = {} header_params = {} - form_params = [] - local_var_files = {} + form_params = {} + files = {} body_params = None if 'body' in params: @@ -255,22 +337,21 @@ class UserApi(object): # Authentication setting auth_settings = [] - response = self.api_client.call_api(resource_path, 'POST', + return self.api_client.call_api(resource_path, method, path_params, query_params, header_params, body=body_params, post_params=form_params, - files=local_var_files, + files=files, response_type=None, auth_settings=auth_settings, callback=params.get('callback')) - return response - def delete_user(self, username, **kwargs): + def login_user(self, **kwargs): """ - Delete user - This can only be done by the logged in user. + Logs user into the system + This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function @@ -278,17 +359,45 @@ class UserApi(object): >>> def callback_function(response): >>> pprint(response) >>> - >>> thread = api.delete_user(username, callback=callback_function) + >>> thread = api.login_user(callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) - :param str username: The name that needs to be deleted (required) - :return: None + :param str username: The user name for login + :param str password: The password for login in clear text + :return: str + If the method is called asynchronously, + returns the request thread. + """ + if kwargs.get('callback'): + return self.login_user_with_http_info(**kwargs) + else: + (data, status_code, response_headers) = self.login_user_with_http_info(**kwargs) + return data + + def login_user_with_http_info(self, **kwargs): + """ + Logs user into the system + + + 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.login_user_with_http_info(callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :param str username: The user name for login + :param str password: The password for login in clear text + :return: str If the method is called asynchronously, returns the request thread. """ - all_params = ['username'] + all_params = ['username', 'password'] all_params.append('callback') params = locals() @@ -296,26 +405,27 @@ class UserApi(object): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" - " to method delete_user" % key + " to method login_user" % key ) params[key] = val del params['kwargs'] - # verify the required parameter 'username' is set - if ('username' not in params) or (params['username'] is None): - raise ValueError("Missing the required parameter `username` when calling `delete_user`") - resource_path = '/user/{username}'.replace('{format}', 'json') + resource_path = '/user/login'.replace('{format}', 'json') + method = 'GET' + path_params = {} - if 'username' in params: - path_params['username'] = params['username'] query_params = {} + if 'username' in params: + query_params['username'] = params['username'] + if 'password' in params: + query_params['password'] = params['password'] header_params = {} - form_params = [] - local_var_files = {} + form_params = {} + files = {} body_params = None @@ -330,19 +440,115 @@ class UserApi(object): select_header_content_type([]) # Authentication setting - auth_settings = ['test_http_basic'] + auth_settings = [] - response = self.api_client.call_api(resource_path, 'DELETE', + return self.api_client.call_api(resource_path, method, path_params, query_params, header_params, body=body_params, post_params=form_params, - files=local_var_files, + files=files, + response_type='str', + auth_settings=auth_settings, + callback=params.get('callback')) + + def logout_user(self, **kwargs): + """ + Logs out current logged in user session + + + 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.logout_user(callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + if kwargs.get('callback'): + return self.logout_user_with_http_info(**kwargs) + else: + (data, status_code, response_headers) = self.logout_user_with_http_info(**kwargs) + return data + + def logout_user_with_http_info(self, **kwargs): + """ + Logs out current logged in user session + + + 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.logout_user_with_http_info(callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] + all_params.append('callback') + + 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 logout_user" % key + ) + params[key] = val + del params['kwargs'] + + + resource_path = '/user/logout'.replace('{format}', 'json') + method = 'GET' + + path_params = {} + + query_params = {} + + header_params = {} + + form_params = {} + files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.\ + select_header_accept(['application/json', 'application/xml']) + if not header_params['Accept']: + del header_params['Accept'] + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.\ + select_header_content_type([]) + + # Authentication setting + auth_settings = [] + + return self.api_client.call_api(resource_path, method, + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=files, response_type=None, auth_settings=auth_settings, callback=params.get('callback')) - return response def get_user_by_name(self, username, **kwargs): """ @@ -357,6 +563,32 @@ class UserApi(object): >>> >>> thread = api.get_user_by_name(username, callback=callback_function) + :param callback function: The callback function + for asynchronous request. (optional) + :param str username: The name that needs to be fetched. Use user1 for testing. (required) + :return: User + If the method is called asynchronously, + returns the request thread. + """ + if kwargs.get('callback'): + return self.get_user_by_name_with_http_info(username, **kwargs) + else: + (data, status_code, response_headers) = self.get_user_by_name_with_http_info(username, **kwargs) + return data + + def get_user_by_name_with_http_info(self, username, **kwargs): + """ + Get user by user name + + + 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.get_user_by_name_with_http_info(username, callback=callback_function) + :param callback function: The callback function for asynchronous request. (optional) :param str username: The name that needs to be fetched. Use user1 for testing. (required) @@ -383,6 +615,8 @@ class UserApi(object): raise ValueError("Missing the required parameter `username` when calling `get_user_by_name`") resource_path = '/user/{username}'.replace('{format}', 'json') + method = 'GET' + path_params = {} if 'username' in params: path_params['username'] = params['username'] @@ -391,8 +625,8 @@ class UserApi(object): header_params = {} - form_params = [] - local_var_files = {} + form_params = {} + files = {} body_params = None @@ -409,165 +643,16 @@ class UserApi(object): # Authentication setting auth_settings = [] - response = self.api_client.call_api(resource_path, 'GET', + return self.api_client.call_api(resource_path, method, path_params, query_params, header_params, body=body_params, post_params=form_params, - files=local_var_files, + files=files, response_type='User', auth_settings=auth_settings, callback=params.get('callback')) - return response - - def login_user(self, **kwargs): - """ - Logs user into the system - - - 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.login_user(callback=callback_function) - - :param callback function: The callback function - for asynchronous request. (optional) - :param str username: The user name for login - :param str password: The password for login in clear text - :return: str - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['username', 'password'] - all_params.append('callback') - - 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 login_user" % key - ) - params[key] = val - del params['kwargs'] - - - resource_path = '/user/login'.replace('{format}', 'json') - path_params = {} - - query_params = {} - if 'username' in params: - query_params['username'] = params['username'] - if 'password' in params: - query_params['password'] = params['password'] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - - # HTTP header `Accept` - header_params['Accept'] = self.api_client.\ - select_header_accept(['application/json', 'application/xml']) - if not header_params['Accept']: - del header_params['Accept'] - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.\ - select_header_content_type([]) - - # Authentication setting - auth_settings = [] - - response = self.api_client.call_api(resource_path, 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='str', - auth_settings=auth_settings, - callback=params.get('callback')) - return response - - def logout_user(self, **kwargs): - """ - Logs out current logged in user session - - - 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.logout_user(callback=callback_function) - - :param callback function: The callback function - for asynchronous request. (optional) - :return: None - If the method is called asynchronously, - returns the request thread. - """ - - all_params = [] - all_params.append('callback') - - 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 logout_user" % key - ) - params[key] = val - del params['kwargs'] - - - resource_path = '/user/logout'.replace('{format}', 'json') - path_params = {} - - query_params = {} - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - - # HTTP header `Accept` - header_params['Accept'] = self.api_client.\ - select_header_accept(['application/json', 'application/xml']) - if not header_params['Accept']: - del header_params['Accept'] - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.\ - select_header_content_type([]) - - # Authentication setting - auth_settings = [] - - response = self.api_client.call_api(resource_path, 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type=None, - auth_settings=auth_settings, - callback=params.get('callback')) - return response def update_user(self, username, **kwargs): """ @@ -582,6 +667,33 @@ class UserApi(object): >>> >>> thread = api.update_user(username, callback=callback_function) + :param callback function: The callback function + for asynchronous request. (optional) + :param str username: name that need to be deleted (required) + :param User body: Updated user object + :return: None + If the method is called asynchronously, + returns the request thread. + """ + if kwargs.get('callback'): + return self.update_user_with_http_info(username, **kwargs) + else: + (data, status_code, response_headers) = self.update_user_with_http_info(username, **kwargs) + return data + + def update_user_with_http_info(self, username, **kwargs): + """ + Updated user + This can only be done by the logged in user. + + 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.update_user_with_http_info(username, callback=callback_function) + :param callback function: The callback function for asynchronous request. (optional) :param str username: name that need to be deleted (required) @@ -609,6 +721,8 @@ class UserApi(object): raise ValueError("Missing the required parameter `username` when calling `update_user`") resource_path = '/user/{username}'.replace('{format}', 'json') + method = 'PUT' + path_params = {} if 'username' in params: path_params['username'] = params['username'] @@ -617,8 +731,8 @@ class UserApi(object): header_params = {} - form_params = [] - local_var_files = {} + form_params = {} + files = {} body_params = None if 'body' in params: @@ -637,14 +751,117 @@ class UserApi(object): # Authentication setting auth_settings = [] - response = self.api_client.call_api(resource_path, 'PUT', + return self.api_client.call_api(resource_path, method, path_params, query_params, header_params, body=body_params, post_params=form_params, - files=local_var_files, + files=files, + response_type=None, + auth_settings=auth_settings, + callback=params.get('callback')) + + def delete_user(self, username, **kwargs): + """ + Delete user + This can only be done by the logged in user. + + 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.delete_user(username, callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :param str username: The name that needs to be deleted (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + if kwargs.get('callback'): + return self.delete_user_with_http_info(username, **kwargs) + else: + (data, status_code, response_headers) = self.delete_user_with_http_info(username, **kwargs) + return data + + def delete_user_with_http_info(self, username, **kwargs): + """ + Delete user + This can only be done by the logged in user. + + 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.delete_user_with_http_info(username, callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :param str username: The name that needs to be deleted (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['username'] + all_params.append('callback') + + 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 delete_user" % key + ) + params[key] = val + del params['kwargs'] + + # verify the required parameter 'username' is set + if ('username' not in params) or (params['username'] is None): + raise ValueError("Missing the required parameter `username` when calling `delete_user`") + + resource_path = '/user/{username}'.replace('{format}', 'json') + method = 'DELETE' + + path_params = {} + if 'username' in params: + path_params['username'] = params['username'] + + query_params = {} + + header_params = {} + + form_params = {} + files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.\ + select_header_accept(['application/json', 'application/xml']) + if not header_params['Accept']: + del header_params['Accept'] + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.\ + select_header_content_type([]) + + # Authentication setting + auth_settings = [] + + return self.api_client.call_api(resource_path, method, + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=files, response_type=None, auth_settings=auth_settings, callback=params.get('callback')) - return response From 10de0b5c5b3fe556cf2ec91f50b00ff713b41428 Mon Sep 17 00:00:00 2001 From: wing328 Date: Fri, 8 Apr 2016 23:54:47 +0800 Subject: [PATCH 02/16] update python sample after rebase --- samples/client/petstore/python/.coverage | 2 +- .../petstore/python/dev-requirements.txt.log | 7 + .../python/swagger_client/__init__.py | 3 + .../python/swagger_client/apis/pet_api.py | 797 ++++++++++++------ .../python/swagger_client/apis/store_api.py | 328 +++++-- .../python/swagger_client/apis/user_api.py | 474 +++++------ .../python/swagger_client/models/__init__.py | 3 + .../python/swagger_client/models/name.py | 29 +- 8 files changed, 1069 insertions(+), 574 deletions(-) diff --git a/samples/client/petstore/python/.coverage b/samples/client/petstore/python/.coverage index 0a07b3c83eb..554238217d0 100644 --- a/samples/client/petstore/python/.coverage +++ b/samples/client/petstore/python/.coverage @@ -1 +1 @@ -!coverage.py: This is a private format, don't read it directly!{"lines": {"/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/python/swagger_client/models/order.py": [130, 172, 141, 173, 19, 21, 22, 152, 25, 29, 30, 161, 163, 39, 40, 41, 42, 43, 44, 45, 174, 175, 48, 49, 50, 51, 180, 53, 54, 52, 58, 59, 60, 61, 62, 191, 64, 202, 75, 86, 57, 176, 222, 97, 228, 178, 234, 108, 240, 119], "/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/python/swagger_client/models/tag.py": [128, 132, 134, 19, 21, 22, 25, 29, 30, 39, 40, 41, 44, 45, 46, 49, 50, 52, 61, 63, 72, 74, 83, 85, 94, 96, 100, 102, 103, 104, 109, 112, 114, 116, 122], "/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/python/swagger_client/models/__init__.py": [1, 4, 5, 6, 7, 8], "/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/python/swagger_client/apis/__init__.py": [1, 4, 5, 6], "/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/python/swagger_client/models/pet.py": [128, 130, 150, 172, 139, 141, 19, 215, 21, 22, 152, 25, 29, 30, 161, 163, 39, 40, 41, 42, 43, 44, 45, 174, 48, 49, 50, 51, 52, 53, 54, 183, 185, 58, 59, 60, 61, 62, 64, 194, 195, 200, 73, 202, 75, 206, 208, 209, 210, 211, 84, 213, 86, 57, 216, 218, 220, 222, 95, 97, 226, 228, 234, 108, 238, 240, 117, 119, 212, 106], "/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/python/swagger_client/configuration.py": [135, 136, 137, 138, 139, 142, 19, 149, 22, 23, 25, 26, 157, 158, 31, 32, 34, 36, 37, 39, 40, 41, 170, 43, 172, 46, 47, 189, 179, 52, 54, 59, 61, 190, 63, 192, 224, 67, 69, 71, 200, 73, 204, 80, 81, 82, 84, 213, 86, 199, 88, 90, 219, 92, 221, 222, 223, 96, 225, 98, 100, 102, 230, 104, 167, 111, 76, 168, 122, 123, 42, 21], "/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/python/swagger_client/apis/store_api.py": [128, 129, 132, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 272, 145, 18, 20, 22, 23, 26, 28, 29, 32, 37, 39, 40, 41, 171, 44, 46, 48, 94, 67, 70, 71, 73, 93, 350, 96, 97, 104, 107, 108, 110, 112, 114, 116, 117, 246, 119, 376, 122, 123, 124], "/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/python/swagger_client/models/category.py": [128, 134, 19, 21, 22, 25, 29, 30, 39, 40, 41, 44, 45, 46, 49, 50, 52, 61, 63, 72, 74, 83, 85, 94, 96, 100, 102, 103, 104, 109, 112, 114, 116, 122], "/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/python/swagger_client/api_client.py": [518, 525, 526, 527, 19, 21, 22, 23, 24, 537, 26, 27, 28, 29, 30, 31, 32, 33, 34, 547, 36, 37, 40, 42, 44, 45, 558, 47, 49, 52, 566, 568, 569, 570, 571, 572, 573, 575, 68, 69, 70, 75, 76, 77, 79, 80, 82, 84, 91, 96, 98, 102, 103, 104, 107, 108, 109, 111, 112, 115, 116, 117, 118, 119, 120, 123, 124, 125, 126, 129, 130, 131, 134, 137, 138, 141, 144, 145, 146, 147, 149, 152, 153, 155, 157, 158, 160, 162, 171, 172, 174, 176, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 204, 205, 212, 213, 214, 216, 217, 219, 231, 235, 236, 240, 242, 251, 252, 254, 255, 256, 257, 258, 260, 261, 262, 263, 267, 268, 269, 272, 274, 275, 276, 278, 279, 280, 281, 283, 286, 287, 288, 316, 317, 318, 319, 320, 322, 323, 324, 325, 326, 327, 328, 329, 330, 332, 333, 337, 338, 339, 340, 341, 345, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 369, 370, 371, 372, 379, 387, 389, 390, 392, 393, 394, 395, 548, 397, 398, 399, 400, 401, 402, 404, 406, 413, 414, 416, 418, 419, 421, 423, 430, 431, 433, 435, 436, 438, 440, 448, 450, 453, 454, 455, 456, 458, 459, 467, 546, 493, 502, 503, 508, 510], "/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/python/swagger_client/apis/pet_api.py": [513, 126, 375, 516, 517, 519, 520, 521, 523, 109, 525, 527, 528, 344, 18, 20, 533, 22, 23, 26, 539, 28, 29, 543, 32, 545, 546, 547, 548, 37, 550, 39, 40, 41, 42, 556, 45, 46, 48, 435, 862, 121, 348, 95, 123, 96, 578, 68, 581, 582, 71, 584, 74, 439, 655, 867, 345, 105, 100, 607, 608, 610, 611, 612, 617, 618, 530, 110, 229, 625, 114, 627, 628, 629, 118, 631, 633, 553, 635, 636, 637, 638, 639, 640, 642, 132, 534, 646, 647, 136, 138, 535, 652, 141, 142, 621, 144, 657, 658, 659, 660, 149, 662, 663, 664, 665, 666, 668, 318, 624, 446, 169, 549, 172, 173, 175, 689, 371, 692, 693, 695, 722, 116, 347, 196, 197, 199, 200, 201, 119, 143, 717, 718, 207, 720, 721, 210, 211, 206, 215, 728, 217, 731, 220, 122, 222, 735, 224, 737, 738, 227, 228, 741, 743, 744, 233, 234, 747, 748, 237, 750, 239, 240, 753, 754, 243, 244, 245, 246, 247, 248, 127, 250, 763, 765, 766, 213, 768, 769, 770, 771, 772, 773, 774, 145, 776, 44, 128, 727, 346, 270, 554, 273, 274, 276, 798, 645, 801, 802, 219, 804, 146, 140, 297, 298, 300, 301, 302, 307, 308, 734, 311, 312, 314, 223, 828, 317, 830, 831, 832, 322, 651, 147, 837, 838, 328, 841, 330, 343, 844, 845, 551, 847, 848, 849, 335, 739, 340, 853, 342, 855, 856, 857, 858, 859, 860, 349, 540, 351, 865, 866, 827, 871, 872, 316, 875, 877, 878, 879, 880, 881, 882, 883, 884, 885, 886, 745, 377, 661, 320, 98, 398, 399, 401, 402, 323, 409, 408, 106, 412, 413, 325, 133, 417, 418, 99, 139, 241, 424, 426, 242, 430, 431, 72, 755, 436, 329, 441, 442, 415, 444, 445, 429, 447, 448, 449, 450, 452, 403, 759, 112, 760, 419, 334, 472, 473, 851, 475, 476, 478, 421, 552, 374, 423, 338, 443, 499, 500, 502, 503, 504, 767, 509, 510, 341], "/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/python/swagger_client/apis/user_api.py": [791, 657, 18, 276, 149, 22, 23, 26, 28, 29, 32, 37, 39, 553, 684, 175, 48, 579, 456, 74, 378, 351, 481, 20, 250, 765], "/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/python/swagger_client/models/user.py": [278, 136, 266, 272, 147, 21, 22, 25, 284, 29, 158, 169, 180, 30, 191, 70, 202, 81, 213, 92, 224, 103, 235, 114, 19, 246, 125], "/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/python/swagger_client/__init__.py": [1, 4, 5, 6, 7, 8, 11, 12, 13, 16, 18, 20], "/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/python/swagger_client/rest.py": [20, 21, 23, 24, 25, 26, 27, 28, 31, 33, 35, 36, 40, 42, 43, 45, 48, 51, 53, 54, 55, 56, 57, 59, 63, 65, 72, 74, 82, 83, 88, 92, 95, 98, 101, 102, 103, 104, 105, 106, 109, 110, 121, 122, 124, 129, 130, 132, 135, 137, 138, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 152, 153, 154, 155, 156, 159, 160, 161, 166, 170, 174, 176, 177, 179, 181, 182, 183, 184, 186, 191, 198, 199, 200, 201, 203, 204, 205, 206, 207, 208, 210, 211, 212, 213, 214, 215, 217, 225, 227, 228, 229, 230, 231, 232, 239, 243, 244, 245, 246, 248, 249, 251]}} \ No newline at end of file +!coverage.py: This is a private format, don't read it directly!{"lines": {"/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/python/swagger_client/apis/user_api.py": [774, 652, 272, 18, 147, 20, 22, 23, 26, 28, 29, 32, 37, 39, 173, 48, 447, 576, 74, 473, 549, 747, 677, 371, 246, 345], "/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/python/swagger_client/__init__.py": [1, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 19, 20, 21, 24, 26, 28], "/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/python/swagger_client/rest.py": [20, 21, 23, 24, 25, 26, 27, 28, 31, 33, 35, 36, 40, 42, 43, 45, 48, 51, 53, 54, 55, 56, 57, 59, 63, 65, 72, 74, 82, 83, 88, 92, 95, 98, 101, 102, 103, 104, 105, 106, 109, 110, 121, 122, 124, 129, 130, 132, 135, 137, 138, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 152, 153, 154, 155, 156, 159, 160, 161, 162, 166, 170, 174, 176, 177, 179, 181, 182, 183, 184, 186, 191, 198, 199, 200, 201, 203, 204, 205, 206, 207, 208, 210, 211, 212, 213, 214, 215, 217, 225, 227, 228, 229, 230, 231, 232, 239, 243, 244, 245, 246, 248, 249, 251], "/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/python/swagger_client/apis/__init__.py": [1, 4, 5, 6], "/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/python/swagger_client/models/model_200_response.py": [97, 115, 71, 103, 109, 49, 19, 21, 22, 25, 60, 29, 30], "/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/python/swagger_client/models/animal.py": [97, 115, 71, 103, 109, 49, 19, 21, 22, 25, 60, 29, 30], "/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/python/swagger_client/models/special_model_name.py": [97, 115, 71, 103, 109, 49, 19, 21, 22, 25, 60, 29, 30], "/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/python/swagger_client/models/category.py": [128, 134, 140, 19, 21, 22, 25, 29, 30, 39, 40, 41, 44, 45, 46, 49, 50, 52, 61, 63, 72, 74, 83, 85, 94, 96, 122], "/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/python/swagger_client/models/user.py": [278, 136, 272, 147, 21, 22, 25, 284, 29, 158, 290, 169, 180, 30, 191, 70, 202, 81, 213, 92, 224, 103, 235, 114, 19, 246, 125], "/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/python/swagger_client/models/cat.py": [96, 128, 134, 74, 140, 19, 52, 21, 22, 85, 25, 122, 29, 30, 63], "/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/python/swagger_client/apis/store_api.py": [150, 274, 20, 22, 23, 26, 28, 541, 32, 48, 37, 39, 29, 176, 567, 74, 439, 465, 344, 18, 369, 249], "/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/python/swagger_client/models/name.py": [96, 128, 134, 74, 140, 19, 52, 21, 22, 85, 25, 122, 29, 30, 63], "/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/python/swagger_client/models/inline_response_200.py": [130, 141, 19, 21, 22, 25, 29, 158, 169, 180, 30, 191, 64, 202, 75, 86, 97, 228, 234, 108, 240, 246, 119], "/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/python/swagger_client/api_client.py": [513, 521, 528, 529, 530, 19, 21, 22, 23, 24, 26, 27, 28, 29, 30, 31, 32, 33, 34, 36, 37, 550, 551, 40, 42, 44, 45, 47, 561, 52, 569, 571, 572, 573, 574, 575, 576, 578, 68, 69, 74, 75, 76, 78, 79, 81, 82, 84, 86, 93, 98, 100, 104, 105, 106, 109, 110, 111, 113, 114, 117, 118, 119, 120, 121, 122, 125, 126, 127, 128, 131, 132, 133, 136, 139, 140, 143, 146, 147, 148, 149, 151, 154, 155, 157, 159, 162, 164, 540, 173, 174, 176, 178, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 206, 207, 214, 215, 216, 218, 219, 221, 549, 233, 237, 238, 242, 244, 253, 254, 256, 257, 258, 259, 260, 262, 263, 264, 265, 269, 270, 271, 274, 276, 277, 278, 280, 281, 282, 283, 285, 288, 289, 290, 49, 318, 319, 320, 321, 322, 334, 335, 339, 340, 341, 342, 343, 347, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 371, 372, 373, 374, 381, 389, 391, 392, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 407, 409, 416, 417, 419, 421, 422, 424, 426, 433, 434, 436, 438, 439, 441, 443, 451, 453, 456, 457, 458, 459, 461, 462, 470, 496, 505, 506, 511], "/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/python/swagger_client/models/__init__.py": [1, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16], "/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/python/swagger_client/apis/pet_api.py": [1024, 1025, 1026, 617, 1030, 1032, 1033, 1034, 1035, 1036, 1037, 1039, 344, 18, 1043, 20, 430, 22, 23, 1048, 1028, 26, 1143, 28, 29, 410, 1055, 32, 944, 1058, 1059, 1060, 37, 550, 39, 40, 1065, 42, 1136, 45, 46, 48, 435, 570, 1119, 573, 574, 1087, 576, 608, 1090, 1091, 68, 1093, 650, 71, 72, 74, 951, 1134, 440, 611, 597, 598, 441, 600, 601, 1116, 1117, 95, 96, 1121, 98, 99, 100, 1126, 614, 615, 616, 105, 106, 619, 109, 110, 623, 112, 114, 1061, 116, 117, 630, 119, 120, 121, 1146, 635, 124, 125, 126, 639, 1152, 641, 130, 131, 644, 645, 134, 647, 136, 137, 138, 139, 652, 141, 142, 143, 144, 145, 1164, 147, 1172, 1130, 1049, 1135, 624, 678, 1052, 434, 173, 1165, 449, 1054, 1044, 1140, 629, 1056, 1142, 1057, 631, 1166, 1149, 1144, 1145, 621, 1147, 1062, 636, 1063, 1167, 1133, 754, 246, 41, 438, 1153, 44, 267, 780, 642, 270, 271, 273, 643, 646, 295, 296, 1127, 298, 299, 300, 402, 648, 306, 309, 649, 312, 313, 314, 315, 317, 319, 320, 321, 323, 324, 326, 140, 330, 331, 1042, 335, 336, 339, 341, 342, 343, 856, 345, 346, 347, 348, 349, 350, 352, 1168, 1154, 1169, 1120, 876, 1170, 879, 880, 882, 1171, 372, 626, 375, 376, 378, 1173, 1138, 903, 904, 906, 907, 908, 399, 400, 913, 914, 403, 404, 917, 918, 920, 409, 922, 924, 925, 414, 927, 928, 929, 418, 932, 933, 934, 423, 425, 938, 939, 428, 429, 942, 413, 1162, 945, 946, 947, 948, 949, 950, 329, 952, 953, 442, 955, 444, 445, 446, 447, 448, 416, 451, 417, 305, 977, 980, 981, 983, 420, 477, 1158, 422, 1020, 1006, 1007, 1009, 1010, 1011, 1016, 1017, 1159, 443, 1023], "/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/python/swagger_client/configuration.py": [19, 21, 22, 23, 25, 26, 31, 32, 34, 36, 37, 39, 40, 41, 42, 43, 46, 47, 52, 54, 59, 61, 63, 67, 69, 71, 73, 76, 80, 81, 82, 84, 86, 88, 90, 92, 96, 98, 100, 102, 104, 111, 122, 123, 135, 136, 137, 138, 139, 142, 149, 157, 158, 167, 168, 170, 172, 179, 189, 190, 192, 199, 200, 201, 204, 210, 211, 213, 219, 221, 222, 223, 224, 225, 228, 229, 230, 231, 232, 235, 236, 237, 238, 239, 242, 243, 244, 245, 246, 249, 250, 251, 252, 253, 256, 257, 258, 259, 260, 265], "/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/python/swagger_client/models/order.py": [130, 172, 141, 173, 19, 21, 22, 152, 25, 29, 30, 161, 163, 39, 40, 41, 42, 43, 44, 45, 174, 175, 48, 49, 50, 51, 180, 53, 54, 52, 58, 59, 60, 61, 62, 191, 64, 202, 75, 86, 57, 176, 97, 228, 178, 234, 108, 240, 246, 119], "/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/python/swagger_client/models/tag.py": [128, 134, 140, 19, 21, 22, 25, 29, 30, 39, 40, 41, 44, 45, 46, 49, 50, 52, 61, 63, 72, 74, 83, 85, 94, 96, 122], "/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/python/swagger_client/models/pet.py": [128, 130, 150, 172, 139, 141, 19, 21, 22, 152, 25, 29, 30, 161, 163, 39, 40, 41, 42, 43, 44, 45, 174, 48, 49, 50, 51, 52, 53, 54, 183, 185, 58, 59, 60, 61, 62, 64, 194, 195, 200, 73, 202, 75, 84, 86, 57, 95, 97, 228, 234, 108, 240, 117, 246, 119, 106], "/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/python/swagger_client/models/model_return.py": [97, 115, 71, 103, 109, 49, 19, 21, 22, 25, 60, 29, 30], "/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/python/swagger_client/models/dog.py": [96, 128, 134, 74, 140, 19, 52, 21, 22, 85, 25, 122, 29, 30, 63]}} \ No newline at end of file diff --git a/samples/client/petstore/python/dev-requirements.txt.log b/samples/client/petstore/python/dev-requirements.txt.log index 9a337359484..6c260212adc 100644 --- a/samples/client/petstore/python/dev-requirements.txt.log +++ b/samples/client/petstore/python/dev-requirements.txt.log @@ -251,3 +251,10 @@ Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/li Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1)) +Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3)) +Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4)) +Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) diff --git a/samples/client/petstore/python/swagger_client/__init__.py b/samples/client/petstore/python/swagger_client/__init__.py index 3b52f200834..dbdd791ada2 100644 --- a/samples/client/petstore/python/swagger_client/__init__.py +++ b/samples/client/petstore/python/swagger_client/__init__.py @@ -1,7 +1,10 @@ from __future__ import absolute_import # import models into sdk package +from .models.animal import Animal +from .models.cat import Cat from .models.category import Category +from .models.dog import Dog from .models.inline_response_200 import InlineResponse200 from .models.model_200_response import Model200Response from .models.model_return import ModelReturn diff --git a/samples/client/petstore/python/swagger_client/apis/pet_api.py b/samples/client/petstore/python/swagger_client/apis/pet_api.py index 134e299c0f9..ae7a828e959 100644 --- a/samples/client/petstore/python/swagger_client/apis/pet_api.py +++ b/samples/client/petstore/python/swagger_client/apis/pet_api.py @@ -2,7 +2,7 @@ """ PetApi.py -Copyright 2015 SmartBear Software +Copyright 2016 SmartBear Software Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -45,107 +45,6 @@ class PetApi(object): config.api_client = ApiClient() self.api_client = config.api_client - def update_pet(self, **kwargs): - """ - Update an existing pet - - - 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.update_pet(callback=callback_function) - - :param callback function: The callback function - for asynchronous request. (optional) - :param Pet body: Pet object that needs to be added to the store - :return: None - If the method is called asynchronously, - returns the request thread. - """ - if kwargs.get('callback'): - return self.update_pet_with_http_info(**kwargs) - else: - (data, status_code, response_headers) = self.update_pet_with_http_info(**kwargs) - return data - - def update_pet_with_http_info(self, **kwargs): - """ - Update an existing pet - - - 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.update_pet_with_http_info(callback=callback_function) - - :param callback function: The callback function - for asynchronous request. (optional) - :param Pet body: Pet object that needs to be added to the store - :return: None - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body'] - all_params.append('callback') - - 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 update_pet" % key - ) - params[key] = val - del params['kwargs'] - - - resource_path = '/pet'.replace('{format}', 'json') - method = 'PUT' - - path_params = {} - - query_params = {} - - header_params = {} - - form_params = {} - 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', 'application/xml']) - if not header_params['Accept']: - del header_params['Accept'] - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.\ - select_header_content_type(['application/json', 'application/xml']) - - # Authentication setting - auth_settings = ['petstore_auth'] - - return self.api_client.call_api(resource_path, method, - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=files, - response_type=None, - auth_settings=auth_settings, - callback=params.get('callback')) - def add_pet(self, **kwargs): """ Add a new pet to the store @@ -208,16 +107,14 @@ class PetApi(object): resource_path = '/pet'.replace('{format}', 'json') - method = 'POST' - path_params = {} query_params = {} header_params = {} - form_params = {} - files = {} + form_params = [] + local_var_files = {} body_params = None if 'body' in params: @@ -236,13 +133,218 @@ class PetApi(object): # Authentication setting auth_settings = ['petstore_auth'] - return self.api_client.call_api(resource_path, method, + return self.api_client.call_api(resource_path, 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, - files=files, + files=local_var_files, + response_type=None, + auth_settings=auth_settings, + callback=params.get('callback')) + + def add_pet_using_byte_array(self, **kwargs): + """ + Fake endpoint to test byte array in body parameter for adding a new pet to the store + + + 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.add_pet_using_byte_array(callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :param str body: Pet object in the form of byte array + :return: None + If the method is called asynchronously, + returns the request thread. + """ + if kwargs.get('callback'): + return self.add_pet_using_byte_array_with_http_info(**kwargs) + else: + (data, status_code, response_headers) = self.add_pet_using_byte_array_with_http_info(**kwargs) + return data + + def add_pet_using_byte_array_with_http_info(self, **kwargs): + """ + Fake endpoint to test byte array in body parameter for adding a new pet to the store + + + 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.add_pet_using_byte_array_with_http_info(callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :param str body: Pet object in the form of byte array + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] + all_params.append('callback') + + 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 add_pet_using_byte_array" % key + ) + params[key] = val + del params['kwargs'] + + + resource_path = '/pet?testing_byte_array=true'.replace('{format}', 'json') + 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', 'application/xml']) + if not header_params['Accept']: + del header_params['Accept'] + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.\ + select_header_content_type(['application/json', 'application/xml']) + + # Authentication setting + auth_settings = ['petstore_auth'] + + return self.api_client.call_api(resource_path, 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, + auth_settings=auth_settings, + callback=params.get('callback')) + + def delete_pet(self, pet_id, **kwargs): + """ + Deletes a pet + + + 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.delete_pet(pet_id, callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :param int pet_id: Pet id to delete (required) + :param str api_key: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + if kwargs.get('callback'): + return self.delete_pet_with_http_info(pet_id, **kwargs) + else: + (data, status_code, response_headers) = self.delete_pet_with_http_info(pet_id, **kwargs) + return data + + def delete_pet_with_http_info(self, pet_id, **kwargs): + """ + Deletes a pet + + + 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.delete_pet_with_http_info(pet_id, callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :param int pet_id: Pet id to delete (required) + :param str api_key: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['pet_id', 'api_key'] + all_params.append('callback') + + 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 delete_pet" % key + ) + params[key] = val + del params['kwargs'] + + # verify the required parameter 'pet_id' is set + if ('pet_id' not in params) or (params['pet_id'] is None): + raise ValueError("Missing the required parameter `pet_id` when calling `delete_pet`") + + resource_path = '/pet/{petId}'.replace('{format}', 'json') + path_params = {} + if 'pet_id' in params: + path_params['petId'] = params['pet_id'] + + query_params = {} + + header_params = {} + if 'api_key' in params: + header_params['api_key'] = params['api_key'] + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.\ + select_header_accept(['application/json', 'application/xml']) + if not header_params['Accept']: + del header_params['Accept'] + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.\ + select_header_content_type([]) + + # Authentication setting + auth_settings = ['petstore_auth'] + + return self.api_client.call_api(resource_path, 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, response_type=None, auth_settings=auth_settings, callback=params.get('callback')) @@ -250,7 +352,7 @@ class PetApi(object): def find_pets_by_status(self, **kwargs): """ Finds Pets by status - Multiple status values can be provided with comma seperated strings + Multiple status values can be provided with comma separated strings This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function @@ -262,7 +364,7 @@ class PetApi(object): :param callback function: The callback function for asynchronous request. (optional) - :param list[str] status: Status values that need to be considered for filter + :param list[str] status: Status values that need to be considered for query :return: list[Pet] If the method is called asynchronously, returns the request thread. @@ -276,7 +378,7 @@ class PetApi(object): def find_pets_by_status_with_http_info(self, **kwargs): """ Finds Pets by status - Multiple status values can be provided with comma seperated strings + Multiple status values can be provided with comma separated strings This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function @@ -288,7 +390,7 @@ class PetApi(object): :param callback function: The callback function for asynchronous request. (optional) - :param list[str] status: Status values that need to be considered for filter + :param list[str] status: Status values that need to be considered for query :return: list[Pet] If the method is called asynchronously, returns the request thread. @@ -309,8 +411,6 @@ class PetApi(object): resource_path = '/pet/findByStatus'.replace('{format}', 'json') - method = 'GET' - path_params = {} query_params = {} @@ -319,8 +419,8 @@ class PetApi(object): header_params = {} - form_params = {} - files = {} + form_params = [] + local_var_files = {} body_params = None @@ -337,13 +437,13 @@ class PetApi(object): # Authentication setting auth_settings = ['petstore_auth'] - return self.api_client.call_api(resource_path, method, + return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, - files=files, + files=local_var_files, response_type='list[Pet]', auth_settings=auth_settings, callback=params.get('callback')) @@ -410,8 +510,6 @@ class PetApi(object): resource_path = '/pet/findByTags'.replace('{format}', 'json') - method = 'GET' - path_params = {} query_params = {} @@ -420,8 +518,8 @@ class PetApi(object): header_params = {} - form_params = {} - files = {} + form_params = [] + local_var_files = {} body_params = None @@ -438,13 +536,13 @@ class PetApi(object): # Authentication setting auth_settings = ['petstore_auth'] - return self.api_client.call_api(resource_path, method, + return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, - files=files, + files=local_var_files, response_type='list[Pet]', auth_settings=auth_settings, callback=params.get('callback')) @@ -514,8 +612,6 @@ class PetApi(object): raise ValueError("Missing the required parameter `pet_id` when calling `get_pet_by_id`") resource_path = '/pet/{petId}'.replace('{format}', 'json') - method = 'GET' - path_params = {} if 'pet_id' in params: path_params['petId'] = params['pet_id'] @@ -524,8 +620,8 @@ class PetApi(object): header_params = {} - form_params = {} - files = {} + form_params = [] + local_var_files = {} body_params = None @@ -540,19 +636,322 @@ class PetApi(object): select_header_content_type([]) # Authentication setting - auth_settings = ['api_key'] + auth_settings = ['api_key', 'petstore_auth'] - return self.api_client.call_api(resource_path, method, + return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, - files=files, + files=local_var_files, response_type='Pet', auth_settings=auth_settings, callback=params.get('callback')) + def get_pet_by_id_in_object(self, pet_id, **kwargs): + """ + Fake endpoint to test inline arbitrary object return by 'Find pet by ID' + Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions + + 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.get_pet_by_id_in_object(pet_id, callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :param int pet_id: ID of pet that needs to be fetched (required) + :return: InlineResponse200 + If the method is called asynchronously, + returns the request thread. + """ + if kwargs.get('callback'): + return self.get_pet_by_id_in_object_with_http_info(pet_id, **kwargs) + else: + (data, status_code, response_headers) = self.get_pet_by_id_in_object_with_http_info(pet_id, **kwargs) + return data + + def get_pet_by_id_in_object_with_http_info(self, pet_id, **kwargs): + """ + Fake endpoint to test inline arbitrary object return by 'Find pet by ID' + Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions + + 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.get_pet_by_id_in_object_with_http_info(pet_id, callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :param int pet_id: ID of pet that needs to be fetched (required) + :return: InlineResponse200 + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['pet_id'] + all_params.append('callback') + + 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 get_pet_by_id_in_object" % key + ) + params[key] = val + del params['kwargs'] + + # verify the required parameter 'pet_id' is set + if ('pet_id' not in params) or (params['pet_id'] is None): + raise ValueError("Missing the required parameter `pet_id` when calling `get_pet_by_id_in_object`") + + resource_path = '/pet/{petId}?response=inline_arbitrary_object'.replace('{format}', 'json') + path_params = {} + if 'pet_id' in params: + path_params['petId'] = params['pet_id'] + + query_params = {} + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.\ + select_header_accept(['application/json', 'application/xml']) + if not header_params['Accept']: + del header_params['Accept'] + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.\ + select_header_content_type([]) + + # Authentication setting + auth_settings = ['api_key', 'petstore_auth'] + + return self.api_client.call_api(resource_path, 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='InlineResponse200', + auth_settings=auth_settings, + callback=params.get('callback')) + + def pet_pet_idtesting_byte_arraytrue_get(self, pet_id, **kwargs): + """ + Fake endpoint to test byte array return by 'Find pet by ID' + Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions + + 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.pet_pet_idtesting_byte_arraytrue_get(pet_id, callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :param int pet_id: ID of pet that needs to be fetched (required) + :return: str + If the method is called asynchronously, + returns the request thread. + """ + if kwargs.get('callback'): + return self.pet_pet_idtesting_byte_arraytrue_get_with_http_info(pet_id, **kwargs) + else: + (data, status_code, response_headers) = self.pet_pet_idtesting_byte_arraytrue_get_with_http_info(pet_id, **kwargs) + return data + + def pet_pet_idtesting_byte_arraytrue_get_with_http_info(self, pet_id, **kwargs): + """ + Fake endpoint to test byte array return by 'Find pet by ID' + Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions + + 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.pet_pet_idtesting_byte_arraytrue_get_with_http_info(pet_id, callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :param int pet_id: ID of pet that needs to be fetched (required) + :return: str + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['pet_id'] + all_params.append('callback') + + 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 pet_pet_idtesting_byte_arraytrue_get" % key + ) + params[key] = val + del params['kwargs'] + + # verify the required parameter 'pet_id' is set + if ('pet_id' not in params) or (params['pet_id'] is None): + raise ValueError("Missing the required parameter `pet_id` when calling `pet_pet_idtesting_byte_arraytrue_get`") + + resource_path = '/pet/{petId}?testing_byte_array=true'.replace('{format}', 'json') + path_params = {} + if 'pet_id' in params: + path_params['petId'] = params['pet_id'] + + query_params = {} + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.\ + select_header_accept(['application/json', 'application/xml']) + if not header_params['Accept']: + del header_params['Accept'] + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.\ + select_header_content_type([]) + + # Authentication setting + auth_settings = ['api_key', 'petstore_auth'] + + return self.api_client.call_api(resource_path, 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='str', + auth_settings=auth_settings, + callback=params.get('callback')) + + def update_pet(self, **kwargs): + """ + Update an existing pet + + + 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.update_pet(callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :param Pet body: Pet object that needs to be added to the store + :return: None + If the method is called asynchronously, + returns the request thread. + """ + if kwargs.get('callback'): + return self.update_pet_with_http_info(**kwargs) + else: + (data, status_code, response_headers) = self.update_pet_with_http_info(**kwargs) + return data + + def update_pet_with_http_info(self, **kwargs): + """ + Update an existing pet + + + 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.update_pet_with_http_info(callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :param Pet body: Pet object that needs to be added to the store + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] + all_params.append('callback') + + 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 update_pet" % key + ) + params[key] = val + del params['kwargs'] + + + resource_path = '/pet'.replace('{format}', 'json') + 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', 'application/xml']) + if not header_params['Accept']: + del header_params['Accept'] + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.\ + select_header_content_type(['application/json', 'application/xml']) + + # Authentication setting + auth_settings = ['petstore_auth'] + + return self.api_client.call_api(resource_path, 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, + auth_settings=auth_settings, + callback=params.get('callback')) + def update_pet_with_form(self, pet_id, **kwargs): """ Updates a pet in the store with form data @@ -622,8 +1021,6 @@ class PetApi(object): raise ValueError("Missing the required parameter `pet_id` when calling `update_pet_with_form`") resource_path = '/pet/{petId}'.replace('{format}', 'json') - method = 'POST' - path_params = {} if 'pet_id' in params: path_params['petId'] = params['pet_id'] @@ -632,12 +1029,12 @@ class PetApi(object): header_params = {} - form_params = {} - files = {} + form_params = [] + local_var_files = {} if 'name' in params: - form_params['name'] = params['name'] + form_params.append(('name', params['name'])) if 'status' in params: - form_params['status'] = params['status'] + form_params.append(('status', params['status'])) body_params = None @@ -654,121 +1051,13 @@ class PetApi(object): # Authentication setting auth_settings = ['petstore_auth'] - return self.api_client.call_api(resource_path, method, + return self.api_client.call_api(resource_path, 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, - files=files, - response_type=None, - auth_settings=auth_settings, - callback=params.get('callback')) - - def delete_pet(self, pet_id, **kwargs): - """ - Deletes a pet - - - 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.delete_pet(pet_id, callback=callback_function) - - :param callback function: The callback function - for asynchronous request. (optional) - :param int pet_id: Pet id to delete (required) - :param str api_key: - :return: None - If the method is called asynchronously, - returns the request thread. - """ - if kwargs.get('callback'): - return self.delete_pet_with_http_info(pet_id, **kwargs) - else: - (data, status_code, response_headers) = self.delete_pet_with_http_info(pet_id, **kwargs) - return data - - def delete_pet_with_http_info(self, pet_id, **kwargs): - """ - Deletes a pet - - - 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.delete_pet_with_http_info(pet_id, callback=callback_function) - - :param callback function: The callback function - for asynchronous request. (optional) - :param int pet_id: Pet id to delete (required) - :param str api_key: - :return: None - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['pet_id', 'api_key'] - all_params.append('callback') - - 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 delete_pet" % key - ) - params[key] = val - del params['kwargs'] - - # verify the required parameter 'pet_id' is set - if ('pet_id' not in params) or (params['pet_id'] is None): - raise ValueError("Missing the required parameter `pet_id` when calling `delete_pet`") - - resource_path = '/pet/{petId}'.replace('{format}', 'json') - method = 'DELETE' - - path_params = {} - if 'pet_id' in params: - path_params['petId'] = params['pet_id'] - - query_params = {} - - header_params = {} - if 'api_key' in params: - header_params['api_key'] = params['api_key'] - - form_params = {} - files = {} - - body_params = None - - # HTTP header `Accept` - header_params['Accept'] = self.api_client.\ - select_header_accept(['application/json', 'application/xml']) - if not header_params['Accept']: - del header_params['Accept'] - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.\ - select_header_content_type([]) - - # Authentication setting - auth_settings = ['petstore_auth'] - - return self.api_client.call_api(resource_path, method, - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=files, + files=local_var_files, response_type=None, auth_settings=auth_settings, callback=params.get('callback')) @@ -842,8 +1131,6 @@ class PetApi(object): raise ValueError("Missing the required parameter `pet_id` when calling `upload_file`") resource_path = '/pet/{petId}/uploadImage'.replace('{format}', 'json') - method = 'POST' - path_params = {} if 'pet_id' in params: path_params['petId'] = params['pet_id'] @@ -852,12 +1139,12 @@ class PetApi(object): header_params = {} - form_params = {} - files = {} + form_params = [] + local_var_files = {} if 'additional_metadata' in params: - form_params['additionalMetadata'] = params['additional_metadata'] + form_params.append(('additionalMetadata', params['additional_metadata'])) if 'file' in params: - files['file'] = params['file'] + local_var_files['file'] = params['file'] body_params = None @@ -874,13 +1161,13 @@ class PetApi(object): # Authentication setting auth_settings = ['petstore_auth'] - return self.api_client.call_api(resource_path, method, + return self.api_client.call_api(resource_path, 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, - files=files, + files=local_var_files, response_type=None, auth_settings=auth_settings, callback=params.get('callback')) diff --git a/samples/client/petstore/python/swagger_client/apis/store_api.py b/samples/client/petstore/python/swagger_client/apis/store_api.py index ee6e2f7633d..4d4ffca2ce5 100644 --- a/samples/client/petstore/python/swagger_client/apis/store_api.py +++ b/samples/client/petstore/python/swagger_client/apis/store_api.py @@ -2,7 +2,7 @@ """ StoreApi.py -Copyright 2015 SmartBear Software +Copyright 2016 SmartBear Software Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -45,6 +45,207 @@ class StoreApi(object): config.api_client = ApiClient() self.api_client = config.api_client + def delete_order(self, order_id, **kwargs): + """ + Delete purchase order by ID + For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + + 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.delete_order(order_id, callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :param str order_id: ID of the order that needs to be deleted (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + if kwargs.get('callback'): + return self.delete_order_with_http_info(order_id, **kwargs) + else: + (data, status_code, response_headers) = self.delete_order_with_http_info(order_id, **kwargs) + return data + + def delete_order_with_http_info(self, order_id, **kwargs): + """ + Delete purchase order by ID + For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + + 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.delete_order_with_http_info(order_id, callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :param str order_id: ID of the order that needs to be deleted (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['order_id'] + all_params.append('callback') + + 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 delete_order" % key + ) + params[key] = val + del params['kwargs'] + + # verify the required parameter 'order_id' is set + if ('order_id' not in params) or (params['order_id'] is None): + raise ValueError("Missing the required parameter `order_id` when calling `delete_order`") + + resource_path = '/store/order/{orderId}'.replace('{format}', 'json') + path_params = {} + if 'order_id' in params: + path_params['orderId'] = params['order_id'] + + query_params = {} + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.\ + select_header_accept(['application/json', 'application/xml']) + if not header_params['Accept']: + del header_params['Accept'] + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.\ + select_header_content_type([]) + + # Authentication setting + auth_settings = [] + + return self.api_client.call_api(resource_path, 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, + auth_settings=auth_settings, + callback=params.get('callback')) + + def find_orders_by_status(self, **kwargs): + """ + Finds orders by status + A single status value can be provided as a string + + 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.find_orders_by_status(callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :param str status: Status value that needs to be considered for query + :return: list[Order] + If the method is called asynchronously, + returns the request thread. + """ + if kwargs.get('callback'): + return self.find_orders_by_status_with_http_info(**kwargs) + else: + (data, status_code, response_headers) = self.find_orders_by_status_with_http_info(**kwargs) + return data + + def find_orders_by_status_with_http_info(self, **kwargs): + """ + Finds orders by status + A single status value can be provided as a string + + 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.find_orders_by_status_with_http_info(callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :param str status: Status value that needs to be considered for query + :return: list[Order] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['status'] + all_params.append('callback') + + 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 find_orders_by_status" % key + ) + params[key] = val + del params['kwargs'] + + + resource_path = '/store/findByStatus'.replace('{format}', 'json') + path_params = {} + + query_params = {} + if 'status' in params: + query_params['status'] = params['status'] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.\ + select_header_accept(['application/json', 'application/xml']) + if not header_params['Accept']: + del header_params['Accept'] + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.\ + select_header_content_type([]) + + # Authentication setting + auth_settings = ['test_api_client_id', 'test_api_client_secret'] + + return self.api_client.call_api(resource_path, 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[Order]', + auth_settings=auth_settings, + callback=params.get('callback')) + def get_inventory(self, **kwargs): """ Returns pet inventories by status @@ -105,16 +306,14 @@ class StoreApi(object): resource_path = '/store/inventory'.replace('{format}', 'json') - method = 'GET' - path_params = {} query_params = {} header_params = {} - form_params = {} - files = {} + form_params = [] + local_var_files = {} body_params = None @@ -131,21 +330,21 @@ class StoreApi(object): # Authentication setting auth_settings = ['api_key'] - return self.api_client.call_api(resource_path, method, + return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, - files=files, + files=local_var_files, response_type='dict(str, int)', auth_settings=auth_settings, callback=params.get('callback')) - def place_order(self, **kwargs): + def get_inventory_in_object(self, **kwargs): """ - Place an order for a pet - + Fake endpoint to test arbitrary object return by 'Get inventory' + Returns an arbitrary object which is actually a map of status codes to quantities This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function @@ -153,25 +352,24 @@ class StoreApi(object): >>> def callback_function(response): >>> pprint(response) >>> - >>> thread = api.place_order(callback=callback_function) + >>> thread = api.get_inventory_in_object(callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) - :param Order body: order placed for purchasing the pet - :return: Order + :return: object If the method is called asynchronously, returns the request thread. """ if kwargs.get('callback'): - return self.place_order_with_http_info(**kwargs) + return self.get_inventory_in_object_with_http_info(**kwargs) else: - (data, status_code, response_headers) = self.place_order_with_http_info(**kwargs) + (data, status_code, response_headers) = self.get_inventory_in_object_with_http_info(**kwargs) return data - def place_order_with_http_info(self, **kwargs): + def get_inventory_in_object_with_http_info(self, **kwargs): """ - Place an order for a pet - + Fake endpoint to test arbitrary object return by 'Get inventory' + Returns an arbitrary object which is actually a map of status codes to quantities This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function @@ -179,17 +377,16 @@ class StoreApi(object): >>> def callback_function(response): >>> pprint(response) >>> - >>> thread = api.place_order_with_http_info(callback=callback_function) + >>> thread = api.get_inventory_in_object_with_http_info(callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) - :param Order body: order placed for purchasing the pet - :return: Order + :return: object If the method is called asynchronously, returns the request thread. """ - all_params = ['body'] + all_params = [] all_params.append('callback') params = locals() @@ -197,27 +394,23 @@ class StoreApi(object): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" - " to method place_order" % key + " to method get_inventory_in_object" % key ) params[key] = val del params['kwargs'] - resource_path = '/store/order'.replace('{format}', 'json') - method = 'POST' - + resource_path = '/store/inventory?response=arbitrary_object'.replace('{format}', 'json') path_params = {} query_params = {} header_params = {} - form_params = {} - files = {} + 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.\ @@ -230,16 +423,16 @@ class StoreApi(object): select_header_content_type([]) # Authentication setting - auth_settings = [] + auth_settings = ['api_key'] - return self.api_client.call_api(resource_path, method, + return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, - files=files, - response_type='Order', + files=local_var_files, + response_type='object', auth_settings=auth_settings, callback=params.get('callback')) @@ -308,8 +501,6 @@ class StoreApi(object): raise ValueError("Missing the required parameter `order_id` when calling `get_order_by_id`") resource_path = '/store/order/{orderId}'.replace('{format}', 'json') - method = 'GET' - path_params = {} if 'order_id' in params: path_params['orderId'] = params['order_id'] @@ -318,8 +509,8 @@ class StoreApi(object): header_params = {} - form_params = {} - files = {} + form_params = [] + local_var_files = {} body_params = None @@ -334,23 +525,23 @@ class StoreApi(object): select_header_content_type([]) # Authentication setting - auth_settings = [] + auth_settings = ['test_api_key_header', 'test_api_key_query'] - return self.api_client.call_api(resource_path, method, + return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, - files=files, + files=local_var_files, response_type='Order', auth_settings=auth_settings, callback=params.get('callback')) - def delete_order(self, order_id, **kwargs): + def place_order(self, **kwargs): """ - Delete purchase order by ID - For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + Place an order for a pet + This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function @@ -358,25 +549,25 @@ class StoreApi(object): >>> def callback_function(response): >>> pprint(response) >>> - >>> thread = api.delete_order(order_id, callback=callback_function) + >>> thread = api.place_order(callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) - :param str order_id: ID of the order that needs to be deleted (required) - :return: None + :param Order body: order placed for purchasing the pet + :return: Order If the method is called asynchronously, returns the request thread. """ if kwargs.get('callback'): - return self.delete_order_with_http_info(order_id, **kwargs) + return self.place_order_with_http_info(**kwargs) else: - (data, status_code, response_headers) = self.delete_order_with_http_info(order_id, **kwargs) + (data, status_code, response_headers) = self.place_order_with_http_info(**kwargs) return data - def delete_order_with_http_info(self, order_id, **kwargs): + def place_order_with_http_info(self, **kwargs): """ - Delete purchase order by ID - For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + Place an order for a pet + This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function @@ -384,17 +575,17 @@ class StoreApi(object): >>> def callback_function(response): >>> pprint(response) >>> - >>> thread = api.delete_order_with_http_info(order_id, callback=callback_function) + >>> thread = api.place_order_with_http_info(callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) - :param str order_id: ID of the order that needs to be deleted (required) - :return: None + :param Order body: order placed for purchasing the pet + :return: Order If the method is called asynchronously, returns the request thread. """ - all_params = ['order_id'] + all_params = ['body'] all_params.append('callback') params = locals() @@ -402,30 +593,25 @@ class StoreApi(object): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" - " to method delete_order" % key + " to method place_order" % key ) params[key] = val del params['kwargs'] - # verify the required parameter 'order_id' is set - if ('order_id' not in params) or (params['order_id'] is None): - raise ValueError("Missing the required parameter `order_id` when calling `delete_order`") - - resource_path = '/store/order/{orderId}'.replace('{format}', 'json') - method = 'DELETE' + resource_path = '/store/order'.replace('{format}', 'json') path_params = {} - if 'order_id' in params: - path_params['orderId'] = params['order_id'] query_params = {} header_params = {} - form_params = {} - files = {} + 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.\ @@ -438,15 +624,15 @@ class StoreApi(object): select_header_content_type([]) # Authentication setting - auth_settings = [] + auth_settings = ['test_api_client_id', 'test_api_client_secret'] - return self.api_client.call_api(resource_path, method, + return self.api_client.call_api(resource_path, 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, - files=files, - response_type=None, + files=local_var_files, + response_type='Order', auth_settings=auth_settings, callback=params.get('callback')) diff --git a/samples/client/petstore/python/swagger_client/apis/user_api.py b/samples/client/petstore/python/swagger_client/apis/user_api.py index 8ce1ddd151a..39ab9148a15 100644 --- a/samples/client/petstore/python/swagger_client/apis/user_api.py +++ b/samples/client/petstore/python/swagger_client/apis/user_api.py @@ -2,7 +2,7 @@ """ UserApi.py -Copyright 2015 SmartBear Software +Copyright 2016 SmartBear Software Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -107,16 +107,14 @@ class UserApi(object): resource_path = '/user'.replace('{format}', 'json') - method = 'POST' - path_params = {} query_params = {} header_params = {} - form_params = {} - files = {} + form_params = [] + local_var_files = {} body_params = None if 'body' in params: @@ -135,13 +133,13 @@ class UserApi(object): # Authentication setting auth_settings = [] - return self.api_client.call_api(resource_path, method, + return self.api_client.call_api(resource_path, 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, - files=files, + files=local_var_files, response_type=None, auth_settings=auth_settings, callback=params.get('callback')) @@ -208,16 +206,14 @@ class UserApi(object): resource_path = '/user/createWithArray'.replace('{format}', 'json') - method = 'POST' - path_params = {} query_params = {} header_params = {} - form_params = {} - files = {} + form_params = [] + local_var_files = {} body_params = None if 'body' in params: @@ -236,13 +232,13 @@ class UserApi(object): # Authentication setting auth_settings = [] - return self.api_client.call_api(resource_path, method, + return self.api_client.call_api(resource_path, 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, - files=files, + files=local_var_files, response_type=None, auth_settings=auth_settings, callback=params.get('callback')) @@ -309,16 +305,14 @@ class UserApi(object): resource_path = '/user/createWithList'.replace('{format}', 'json') - method = 'POST' - path_params = {} query_params = {} header_params = {} - form_params = {} - files = {} + form_params = [] + local_var_files = {} body_params = None if 'body' in params: @@ -337,17 +331,221 @@ class UserApi(object): # Authentication setting auth_settings = [] - return self.api_client.call_api(resource_path, method, + return self.api_client.call_api(resource_path, 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, - files=files, + files=local_var_files, response_type=None, auth_settings=auth_settings, callback=params.get('callback')) + def delete_user(self, username, **kwargs): + """ + Delete user + This can only be done by the logged in user. + + 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.delete_user(username, callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :param str username: The name that needs to be deleted (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + if kwargs.get('callback'): + return self.delete_user_with_http_info(username, **kwargs) + else: + (data, status_code, response_headers) = self.delete_user_with_http_info(username, **kwargs) + return data + + def delete_user_with_http_info(self, username, **kwargs): + """ + Delete user + This can only be done by the logged in user. + + 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.delete_user_with_http_info(username, callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :param str username: The name that needs to be deleted (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['username'] + all_params.append('callback') + + 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 delete_user" % key + ) + params[key] = val + del params['kwargs'] + + # verify the required parameter 'username' is set + if ('username' not in params) or (params['username'] is None): + raise ValueError("Missing the required parameter `username` when calling `delete_user`") + + resource_path = '/user/{username}'.replace('{format}', 'json') + path_params = {} + if 'username' in params: + path_params['username'] = params['username'] + + query_params = {} + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.\ + select_header_accept(['application/json', 'application/xml']) + if not header_params['Accept']: + del header_params['Accept'] + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.\ + select_header_content_type([]) + + # Authentication setting + auth_settings = ['test_http_basic'] + + return self.api_client.call_api(resource_path, 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, + auth_settings=auth_settings, + callback=params.get('callback')) + + def get_user_by_name(self, username, **kwargs): + """ + Get user by user name + + + 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.get_user_by_name(username, callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :param str username: The name that needs to be fetched. Use user1 for testing. (required) + :return: User + If the method is called asynchronously, + returns the request thread. + """ + if kwargs.get('callback'): + return self.get_user_by_name_with_http_info(username, **kwargs) + else: + (data, status_code, response_headers) = self.get_user_by_name_with_http_info(username, **kwargs) + return data + + def get_user_by_name_with_http_info(self, username, **kwargs): + """ + Get user by user name + + + 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.get_user_by_name_with_http_info(username, callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :param str username: The name that needs to be fetched. Use user1 for testing. (required) + :return: User + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['username'] + all_params.append('callback') + + 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 get_user_by_name" % key + ) + params[key] = val + del params['kwargs'] + + # verify the required parameter 'username' is set + if ('username' not in params) or (params['username'] is None): + raise ValueError("Missing the required parameter `username` when calling `get_user_by_name`") + + resource_path = '/user/{username}'.replace('{format}', 'json') + path_params = {} + if 'username' in params: + path_params['username'] = params['username'] + + query_params = {} + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.\ + select_header_accept(['application/json', 'application/xml']) + if not header_params['Accept']: + del header_params['Accept'] + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.\ + select_header_content_type([]) + + # Authentication setting + auth_settings = [] + + return self.api_client.call_api(resource_path, 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='User', + auth_settings=auth_settings, + callback=params.get('callback')) + def login_user(self, **kwargs): """ Logs user into the system @@ -412,8 +610,6 @@ class UserApi(object): resource_path = '/user/login'.replace('{format}', 'json') - method = 'GET' - path_params = {} query_params = {} @@ -424,8 +620,8 @@ class UserApi(object): header_params = {} - form_params = {} - files = {} + form_params = [] + local_var_files = {} body_params = None @@ -442,13 +638,13 @@ class UserApi(object): # Authentication setting auth_settings = [] - return self.api_client.call_api(resource_path, method, + return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, - files=files, + files=local_var_files, response_type='str', auth_settings=auth_settings, callback=params.get('callback')) @@ -513,16 +709,14 @@ class UserApi(object): resource_path = '/user/logout'.replace('{format}', 'json') - method = 'GET' - path_params = {} query_params = {} header_params = {} - form_params = {} - files = {} + form_params = [] + local_var_files = {} body_params = None @@ -539,121 +733,17 @@ class UserApi(object): # Authentication setting auth_settings = [] - return self.api_client.call_api(resource_path, method, + return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, - files=files, + files=local_var_files, response_type=None, auth_settings=auth_settings, callback=params.get('callback')) - def get_user_by_name(self, username, **kwargs): - """ - Get user by user name - - - 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.get_user_by_name(username, callback=callback_function) - - :param callback function: The callback function - for asynchronous request. (optional) - :param str username: The name that needs to be fetched. Use user1 for testing. (required) - :return: User - If the method is called asynchronously, - returns the request thread. - """ - if kwargs.get('callback'): - return self.get_user_by_name_with_http_info(username, **kwargs) - else: - (data, status_code, response_headers) = self.get_user_by_name_with_http_info(username, **kwargs) - return data - - def get_user_by_name_with_http_info(self, username, **kwargs): - """ - Get user by user name - - - 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.get_user_by_name_with_http_info(username, callback=callback_function) - - :param callback function: The callback function - for asynchronous request. (optional) - :param str username: The name that needs to be fetched. Use user1 for testing. (required) - :return: User - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['username'] - all_params.append('callback') - - 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 get_user_by_name" % key - ) - params[key] = val - del params['kwargs'] - - # verify the required parameter 'username' is set - if ('username' not in params) or (params['username'] is None): - raise ValueError("Missing the required parameter `username` when calling `get_user_by_name`") - - resource_path = '/user/{username}'.replace('{format}', 'json') - method = 'GET' - - path_params = {} - if 'username' in params: - path_params['username'] = params['username'] - - query_params = {} - - header_params = {} - - form_params = {} - files = {} - - body_params = None - - # HTTP header `Accept` - header_params['Accept'] = self.api_client.\ - select_header_accept(['application/json', 'application/xml']) - if not header_params['Accept']: - del header_params['Accept'] - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.\ - select_header_content_type([]) - - # Authentication setting - auth_settings = [] - - return self.api_client.call_api(resource_path, method, - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=files, - response_type='User', - auth_settings=auth_settings, - callback=params.get('callback')) - def update_user(self, username, **kwargs): """ Updated user @@ -721,8 +811,6 @@ class UserApi(object): raise ValueError("Missing the required parameter `username` when calling `update_user`") resource_path = '/user/{username}'.replace('{format}', 'json') - method = 'PUT' - path_params = {} if 'username' in params: path_params['username'] = params['username'] @@ -731,8 +819,8 @@ class UserApi(object): header_params = {} - form_params = {} - files = {} + form_params = [] + local_var_files = {} body_params = None if 'body' in params: @@ -751,117 +839,13 @@ class UserApi(object): # Authentication setting auth_settings = [] - return self.api_client.call_api(resource_path, method, + return self.api_client.call_api(resource_path, 'PUT', path_params, query_params, header_params, body=body_params, post_params=form_params, - files=files, - response_type=None, - auth_settings=auth_settings, - callback=params.get('callback')) - - def delete_user(self, username, **kwargs): - """ - Delete user - This can only be done by the logged in user. - - 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.delete_user(username, callback=callback_function) - - :param callback function: The callback function - for asynchronous request. (optional) - :param str username: The name that needs to be deleted (required) - :return: None - If the method is called asynchronously, - returns the request thread. - """ - if kwargs.get('callback'): - return self.delete_user_with_http_info(username, **kwargs) - else: - (data, status_code, response_headers) = self.delete_user_with_http_info(username, **kwargs) - return data - - def delete_user_with_http_info(self, username, **kwargs): - """ - Delete user - This can only be done by the logged in user. - - 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.delete_user_with_http_info(username, callback=callback_function) - - :param callback function: The callback function - for asynchronous request. (optional) - :param str username: The name that needs to be deleted (required) - :return: None - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['username'] - all_params.append('callback') - - 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 delete_user" % key - ) - params[key] = val - del params['kwargs'] - - # verify the required parameter 'username' is set - if ('username' not in params) or (params['username'] is None): - raise ValueError("Missing the required parameter `username` when calling `delete_user`") - - resource_path = '/user/{username}'.replace('{format}', 'json') - method = 'DELETE' - - path_params = {} - if 'username' in params: - path_params['username'] = params['username'] - - query_params = {} - - header_params = {} - - form_params = {} - files = {} - - body_params = None - - # HTTP header `Accept` - header_params['Accept'] = self.api_client.\ - select_header_accept(['application/json', 'application/xml']) - if not header_params['Accept']: - del header_params['Accept'] - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.\ - select_header_content_type([]) - - # Authentication setting - auth_settings = [] - - return self.api_client.call_api(resource_path, method, - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=files, + files=local_var_files, response_type=None, auth_settings=auth_settings, callback=params.get('callback')) diff --git a/samples/client/petstore/python/swagger_client/models/__init__.py b/samples/client/petstore/python/swagger_client/models/__init__.py index baccc53b4d6..c441500bc40 100644 --- a/samples/client/petstore/python/swagger_client/models/__init__.py +++ b/samples/client/petstore/python/swagger_client/models/__init__.py @@ -1,7 +1,10 @@ from __future__ import absolute_import # import models into model package +from .animal import Animal +from .cat import Cat from .category import Category +from .dog import Dog from .inline_response_200 import InlineResponse200 from .model_200_response import Model200Response from .model_return import ModelReturn diff --git a/samples/client/petstore/python/swagger_client/models/name.py b/samples/client/petstore/python/swagger_client/models/name.py index 52187bd7bc5..068bca97eea 100644 --- a/samples/client/petstore/python/swagger_client/models/name.py +++ b/samples/client/petstore/python/swagger_client/models/name.py @@ -37,14 +37,17 @@ class Name(object): and the value is json key in definition. """ self.swagger_types = { - 'name': 'int' + 'name': 'int', + 'snake_case': 'int' } self.attribute_map = { - 'name': 'name' + 'name': 'name', + 'snake_case': 'snake_case' } self._name = None + self._snake_case = None @property def name(self): @@ -68,6 +71,28 @@ class Name(object): """ self._name = name + @property + def snake_case(self): + """ + Gets the snake_case of this Name. + + + :return: The snake_case of this Name. + :rtype: int + """ + return self._snake_case + + @snake_case.setter + def snake_case(self, snake_case): + """ + Sets the snake_case of this Name. + + + :param snake_case: The snake_case of this Name. + :type: int + """ + self._snake_case = snake_case + def to_dict(self): """ Returns the model properties as a dict From 67c3f98d96c9c6ed8bcf2490a2c1449084a352ca Mon Sep 17 00:00:00 2001 From: zhenjun115 Date: Sat, 4 Jun 2016 23:30:10 +0800 Subject: [PATCH 03/16] enable python api client to return just data without http header info when need; --- .../src/main/resources/python/api.mustache | 8 +- .../main/resources/python/api_client.mustache | 14 +- samples/client/petstore/python/.coverage | 2 +- .../petstore/python/dev-requirements.txt.log | 260 +----------------- .../python/swagger_client/api_client.py | 14 +- .../python/swagger_client/apis/pet_api.py | 88 ++++-- .../python/swagger_client/apis/store_api.py | 48 +++- .../python/swagger_client/apis/user_api.py | 64 +++-- .../python/swagger_client/models/animal.py | 120 ++++++++ .../python/swagger_client/models/cat.py | 145 ++++++++++ .../python/swagger_client/models/dog.py | 145 ++++++++++ .../petstore/python/tests/test_pet_api.py | 9 + 12 files changed, 602 insertions(+), 315 deletions(-) create mode 100644 samples/client/petstore/python/swagger_client/models/animal.py create mode 100644 samples/client/petstore/python/swagger_client/models/cat.py create mode 100644 samples/client/petstore/python/swagger_client/models/dog.py diff --git a/modules/swagger-codegen/src/main/resources/python/api.mustache b/modules/swagger-codegen/src/main/resources/python/api.mustache index f395c783dc6..8545b08f7ce 100644 --- a/modules/swagger-codegen/src/main/resources/python/api.mustache +++ b/modules/swagger-codegen/src/main/resources/python/api.mustache @@ -48,6 +48,7 @@ class {{classname}}(object): {{#operation}} def {{operationId}}(self, {{#sortParamsByRequiredFlag}}{{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}{{/sortParamsByRequiredFlag}}**kwargs): + _return_http_data_only = True """ {{{summary}}} {{{notes}}} @@ -74,10 +75,11 @@ class {{classname}}(object): If the method is called asynchronously, returns the request thread. """ + kwargs['_return_http_data_only'] = _return_http_data_only if kwargs.get('callback'): return self.{{operationId}}_with_http_info({{#sortParamsByRequiredFlag}}{{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}{{/sortParamsByRequiredFlag}}**kwargs) else: - (data, status_code, response_headers) = self.{{operationId}}_with_http_info({{#sortParamsByRequiredFlag}}{{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}{{/sortParamsByRequiredFlag}}**kwargs) + (data) = self.{{operationId}}_with_http_info({{#sortParamsByRequiredFlag}}{{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}{{/sortParamsByRequiredFlag}}**kwargs) return data def {{operationId}}_with_http_info(self, {{#sortParamsByRequiredFlag}}{{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}{{/sortParamsByRequiredFlag}}**kwargs): @@ -110,6 +112,7 @@ class {{classname}}(object): all_params = [{{#allParams}}'{{paramName}}'{{#hasMore}}, {{/hasMore}}{{/allParams}}] all_params.append('callback') + all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): @@ -183,6 +186,7 @@ class {{classname}}(object): files=local_var_files, response_type={{#returnType}}'{{returnType}}'{{/returnType}}{{^returnType}}None{{/returnType}}, auth_settings=auth_settings, - callback=params.get('callback')) + callback=params.get('callback'), + _return_http_data_only=params.get('_return_http_data_only')) {{/operation}} {{/operations}} diff --git a/modules/swagger-codegen/src/main/resources/python/api_client.mustache b/modules/swagger-codegen/src/main/resources/python/api_client.mustache index 685580ae839..311d1d34b66 100644 --- a/modules/swagger-codegen/src/main/resources/python/api_client.mustache +++ b/modules/swagger-codegen/src/main/resources/python/api_client.mustache @@ -103,7 +103,7 @@ class ApiClient(object): def __call_api(self, resource_path, method, path_params=None, query_params=None, header_params=None, body=None, post_params=None, files=None, - response_type=None, auth_settings=None, callback=None): + response_type=None, auth_settings=None, callback=None, _return_http_data_only=None): # headers parameters header_params = header_params or {} @@ -157,9 +157,12 @@ class ApiClient(object): deserialized_data = None if callback: - callback((deserialized_data, response_data.status, response_data.getheaders())) + callback(deserialized_data) if _return_http_data_only else callback((deserialized_data, response_data.status, response_data.getheaders())) + elif _return_http_data_only: + return ( deserialized_data ); else: return (deserialized_data, response_data.status, response_data.getheaders()) + def to_path_value(self, obj): """ @@ -287,7 +290,7 @@ class ApiClient(object): def call_api(self, resource_path, method, path_params=None, query_params=None, header_params=None, body=None, post_params=None, files=None, - response_type=None, auth_settings=None, callback=None): + response_type=None, auth_settings=None, callback=None, _return_http_data_only=None): """ Makes the HTTP request (synchronous) and return the deserialized data. To make an async request, define a function for callback. @@ -308,6 +311,7 @@ class ApiClient(object): :param callback function: Callback function for asynchronous request. If provide this parameter, the request will be called asynchronously. + :param _return_http_data_only: response data without head status code and headers :return: If provide parameter callback, the request will be called asynchronously. @@ -319,7 +323,7 @@ class ApiClient(object): return self.__call_api(resource_path, method, path_params, query_params, header_params, body, post_params, files, - response_type, auth_settings, callback) + response_type, auth_settings, callback, _return_http_data_only) else: thread = threading.Thread(target=self.__call_api, args=(resource_path, method, @@ -327,7 +331,7 @@ class ApiClient(object): header_params, body, post_params, files, response_type, auth_settings, - callback)) + callback,_return_http_data_only)) thread.start() return thread diff --git a/samples/client/petstore/python/.coverage b/samples/client/petstore/python/.coverage index 554238217d0..6ec2ece7d7a 100644 --- a/samples/client/petstore/python/.coverage +++ b/samples/client/petstore/python/.coverage @@ -1 +1 @@ -!coverage.py: This is a private format, don't read it directly!{"lines": {"/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/python/swagger_client/apis/user_api.py": [774, 652, 272, 18, 147, 20, 22, 23, 26, 28, 29, 32, 37, 39, 173, 48, 447, 576, 74, 473, 549, 747, 677, 371, 246, 345], "/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/python/swagger_client/__init__.py": [1, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 19, 20, 21, 24, 26, 28], "/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/python/swagger_client/rest.py": [20, 21, 23, 24, 25, 26, 27, 28, 31, 33, 35, 36, 40, 42, 43, 45, 48, 51, 53, 54, 55, 56, 57, 59, 63, 65, 72, 74, 82, 83, 88, 92, 95, 98, 101, 102, 103, 104, 105, 106, 109, 110, 121, 122, 124, 129, 130, 132, 135, 137, 138, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 152, 153, 154, 155, 156, 159, 160, 161, 162, 166, 170, 174, 176, 177, 179, 181, 182, 183, 184, 186, 191, 198, 199, 200, 201, 203, 204, 205, 206, 207, 208, 210, 211, 212, 213, 214, 215, 217, 225, 227, 228, 229, 230, 231, 232, 239, 243, 244, 245, 246, 248, 249, 251], "/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/python/swagger_client/apis/__init__.py": [1, 4, 5, 6], "/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/python/swagger_client/models/model_200_response.py": [97, 115, 71, 103, 109, 49, 19, 21, 22, 25, 60, 29, 30], "/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/python/swagger_client/models/animal.py": [97, 115, 71, 103, 109, 49, 19, 21, 22, 25, 60, 29, 30], "/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/python/swagger_client/models/special_model_name.py": [97, 115, 71, 103, 109, 49, 19, 21, 22, 25, 60, 29, 30], "/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/python/swagger_client/models/category.py": [128, 134, 140, 19, 21, 22, 25, 29, 30, 39, 40, 41, 44, 45, 46, 49, 50, 52, 61, 63, 72, 74, 83, 85, 94, 96, 122], "/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/python/swagger_client/models/user.py": [278, 136, 272, 147, 21, 22, 25, 284, 29, 158, 290, 169, 180, 30, 191, 70, 202, 81, 213, 92, 224, 103, 235, 114, 19, 246, 125], "/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/python/swagger_client/models/cat.py": [96, 128, 134, 74, 140, 19, 52, 21, 22, 85, 25, 122, 29, 30, 63], "/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/python/swagger_client/apis/store_api.py": [150, 274, 20, 22, 23, 26, 28, 541, 32, 48, 37, 39, 29, 176, 567, 74, 439, 465, 344, 18, 369, 249], "/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/python/swagger_client/models/name.py": [96, 128, 134, 74, 140, 19, 52, 21, 22, 85, 25, 122, 29, 30, 63], "/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/python/swagger_client/models/inline_response_200.py": [130, 141, 19, 21, 22, 25, 29, 158, 169, 180, 30, 191, 64, 202, 75, 86, 97, 228, 234, 108, 240, 246, 119], "/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/python/swagger_client/api_client.py": [513, 521, 528, 529, 530, 19, 21, 22, 23, 24, 26, 27, 28, 29, 30, 31, 32, 33, 34, 36, 37, 550, 551, 40, 42, 44, 45, 47, 561, 52, 569, 571, 572, 573, 574, 575, 576, 578, 68, 69, 74, 75, 76, 78, 79, 81, 82, 84, 86, 93, 98, 100, 104, 105, 106, 109, 110, 111, 113, 114, 117, 118, 119, 120, 121, 122, 125, 126, 127, 128, 131, 132, 133, 136, 139, 140, 143, 146, 147, 148, 149, 151, 154, 155, 157, 159, 162, 164, 540, 173, 174, 176, 178, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 206, 207, 214, 215, 216, 218, 219, 221, 549, 233, 237, 238, 242, 244, 253, 254, 256, 257, 258, 259, 260, 262, 263, 264, 265, 269, 270, 271, 274, 276, 277, 278, 280, 281, 282, 283, 285, 288, 289, 290, 49, 318, 319, 320, 321, 322, 334, 335, 339, 340, 341, 342, 343, 347, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 371, 372, 373, 374, 381, 389, 391, 392, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 407, 409, 416, 417, 419, 421, 422, 424, 426, 433, 434, 436, 438, 439, 441, 443, 451, 453, 456, 457, 458, 459, 461, 462, 470, 496, 505, 506, 511], "/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/python/swagger_client/models/__init__.py": [1, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16], "/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/python/swagger_client/apis/pet_api.py": [1024, 1025, 1026, 617, 1030, 1032, 1033, 1034, 1035, 1036, 1037, 1039, 344, 18, 1043, 20, 430, 22, 23, 1048, 1028, 26, 1143, 28, 29, 410, 1055, 32, 944, 1058, 1059, 1060, 37, 550, 39, 40, 1065, 42, 1136, 45, 46, 48, 435, 570, 1119, 573, 574, 1087, 576, 608, 1090, 1091, 68, 1093, 650, 71, 72, 74, 951, 1134, 440, 611, 597, 598, 441, 600, 601, 1116, 1117, 95, 96, 1121, 98, 99, 100, 1126, 614, 615, 616, 105, 106, 619, 109, 110, 623, 112, 114, 1061, 116, 117, 630, 119, 120, 121, 1146, 635, 124, 125, 126, 639, 1152, 641, 130, 131, 644, 645, 134, 647, 136, 137, 138, 139, 652, 141, 142, 143, 144, 145, 1164, 147, 1172, 1130, 1049, 1135, 624, 678, 1052, 434, 173, 1165, 449, 1054, 1044, 1140, 629, 1056, 1142, 1057, 631, 1166, 1149, 1144, 1145, 621, 1147, 1062, 636, 1063, 1167, 1133, 754, 246, 41, 438, 1153, 44, 267, 780, 642, 270, 271, 273, 643, 646, 295, 296, 1127, 298, 299, 300, 402, 648, 306, 309, 649, 312, 313, 314, 315, 317, 319, 320, 321, 323, 324, 326, 140, 330, 331, 1042, 335, 336, 339, 341, 342, 343, 856, 345, 346, 347, 348, 349, 350, 352, 1168, 1154, 1169, 1120, 876, 1170, 879, 880, 882, 1171, 372, 626, 375, 376, 378, 1173, 1138, 903, 904, 906, 907, 908, 399, 400, 913, 914, 403, 404, 917, 918, 920, 409, 922, 924, 925, 414, 927, 928, 929, 418, 932, 933, 934, 423, 425, 938, 939, 428, 429, 942, 413, 1162, 945, 946, 947, 948, 949, 950, 329, 952, 953, 442, 955, 444, 445, 446, 447, 448, 416, 451, 417, 305, 977, 980, 981, 983, 420, 477, 1158, 422, 1020, 1006, 1007, 1009, 1010, 1011, 1016, 1017, 1159, 443, 1023], "/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/python/swagger_client/configuration.py": [19, 21, 22, 23, 25, 26, 31, 32, 34, 36, 37, 39, 40, 41, 42, 43, 46, 47, 52, 54, 59, 61, 63, 67, 69, 71, 73, 76, 80, 81, 82, 84, 86, 88, 90, 92, 96, 98, 100, 102, 104, 111, 122, 123, 135, 136, 137, 138, 139, 142, 149, 157, 158, 167, 168, 170, 172, 179, 189, 190, 192, 199, 200, 201, 204, 210, 211, 213, 219, 221, 222, 223, 224, 225, 228, 229, 230, 231, 232, 235, 236, 237, 238, 239, 242, 243, 244, 245, 246, 249, 250, 251, 252, 253, 256, 257, 258, 259, 260, 265], "/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/python/swagger_client/models/order.py": [130, 172, 141, 173, 19, 21, 22, 152, 25, 29, 30, 161, 163, 39, 40, 41, 42, 43, 44, 45, 174, 175, 48, 49, 50, 51, 180, 53, 54, 52, 58, 59, 60, 61, 62, 191, 64, 202, 75, 86, 57, 176, 97, 228, 178, 234, 108, 240, 246, 119], "/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/python/swagger_client/models/tag.py": [128, 134, 140, 19, 21, 22, 25, 29, 30, 39, 40, 41, 44, 45, 46, 49, 50, 52, 61, 63, 72, 74, 83, 85, 94, 96, 122], "/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/python/swagger_client/models/pet.py": [128, 130, 150, 172, 139, 141, 19, 21, 22, 152, 25, 29, 30, 161, 163, 39, 40, 41, 42, 43, 44, 45, 174, 48, 49, 50, 51, 52, 53, 54, 183, 185, 58, 59, 60, 61, 62, 64, 194, 195, 200, 73, 202, 75, 84, 86, 57, 95, 97, 228, 234, 108, 240, 117, 246, 119, 106], "/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/python/swagger_client/models/model_return.py": [97, 115, 71, 103, 109, 49, 19, 21, 22, 25, 60, 29, 30], "/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/python/swagger_client/models/dog.py": [96, 128, 134, 74, 140, 19, 52, 21, 22, 85, 25, 122, 29, 30, 63]}} \ No newline at end of file +!coverage.py: This is a private format, don't read it directly!{"lines": {"/Users/huangzhenjun/Public/git/PartTime/swagger-codegen/samples/client/petstore/python/swagger_client/apis/user_api.py": [385, 775, 23, 18, 20, 22, 151, 282, 28, 26, 32, 676, 37, 39, 29, 48, 179, 569, 703, 76, 463, 598, 804, 357, 491, 254], "/Users/huangzhenjun/Public/git/PartTime/swagger-codegen/samples/client/petstore/python/swagger_client/models/name.py": [96, 128, 134, 74, 140, 19, 52, 21, 22, 85, 25, 122, 29, 30, 63], "/Users/huangzhenjun/Public/git/PartTime/swagger-codegen/samples/client/petstore/python/swagger_client/models/category.py": [128, 134, 140, 19, 21, 22, 25, 29, 30, 39, 40, 41, 44, 45, 46, 49, 50, 52, 61, 63, 72, 74, 83, 85, 94, 96, 100, 102, 103, 104, 109, 111, 118, 120, 122], "/Users/huangzhenjun/Public/git/PartTime/swagger-codegen/samples/client/petstore/python/swagger_client/models/cat.py": [96, 128, 134, 74, 140, 19, 52, 21, 22, 85, 25, 122, 29, 30, 63], "/Users/huangzhenjun/Public/git/PartTime/swagger-codegen/samples/client/petstore/python/swagger_client/api_client.py": [409, 515, 517, 525, 19, 532, 21, 22, 23, 24, 26, 27, 28, 29, 30, 31, 32, 33, 34, 36, 37, 40, 553, 42, 555, 44, 45, 47, 49, 52, 565, 573, 575, 576, 577, 578, 579, 68, 69, 582, 74, 75, 76, 78, 79, 81, 82, 84, 86, 93, 98, 100, 104, 105, 106, 109, 110, 111, 113, 114, 117, 118, 119, 120, 121, 122, 125, 126, 533, 128, 131, 132, 133, 136, 139, 140, 143, 146, 147, 148, 149, 151, 154, 155, 157, 159, 160, 161, 162, 164, 167, 534, 176, 177, 179, 181, 544, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 209, 210, 217, 218, 219, 221, 222, 224, 236, 240, 241, 245, 247, 127, 554, 256, 257, 259, 260, 261, 262, 263, 265, 266, 267, 268, 272, 273, 274, 277, 279, 280, 281, 283, 284, 285, 286, 288, 291, 292, 293, 322, 323, 324, 325, 326, 328, 329, 330, 331, 332, 333, 334, 335, 336, 338, 339, 343, 344, 345, 346, 347, 351, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 375, 376, 377, 378, 385, 393, 395, 396, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 580, 411, 413, 420, 421, 423, 425, 426, 428, 430, 437, 438, 440, 442, 443, 445, 447, 455, 457, 460, 461, 462, 463, 465, 466, 474, 500, 509, 510], "/Users/huangzhenjun/Public/git/PartTime/swagger-codegen/samples/client/petstore/python/swagger_client/apis/pet_api.py": [18, 20, 22, 23, 26, 28, 29, 32, 37, 39, 40, 41, 42, 44, 45, 46, 48, 49, 69, 70, 73, 74, 76, 97, 98, 99, 101, 102, 103, 108, 109, 112, 113, 115, 117, 119, 120, 122, 123, 124, 127, 128, 129, 133, 134, 137, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 151, 179, 254, 255, 276, 277, 280, 281, 283, 305, 306, 307, 309, 310, 311, 316, 317, 320, 323, 324, 325, 326, 328, 330, 331, 332, 334, 335, 337, 340, 341, 342, 346, 347, 350, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 364, 365, 385, 386, 389, 390, 392, 413, 414, 415, 417, 418, 419, 424, 425, 428, 429, 431, 432, 433, 435, 437, 438, 440, 443, 444, 445, 449, 450, 453, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 467, 468, 488, 489, 492, 493, 495, 516, 517, 518, 520, 521, 522, 527, 528, 531, 532, 534, 535, 536, 538, 540, 541, 543, 546, 547, 548, 552, 553, 556, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 570, 571, 591, 592, 593, 595, 596, 598, 619, 620, 621, 623, 624, 625, 630, 631, 634, 637, 638, 639, 640, 642, 644, 646, 647, 649, 652, 653, 654, 658, 659, 662, 664, 665, 666, 667, 668, 669, 670, 671, 672, 673, 674, 676, 704, 782, 810, 888, 889, 909, 910, 913, 914, 916, 937, 938, 939, 941, 942, 943, 948, 949, 952, 953, 955, 957, 959, 960, 962, 963, 964, 967, 968, 969, 973, 974, 977, 979, 980, 981, 982, 983, 984, 985, 986, 987, 988, 989, 991, 992, 1014, 1015, 1018, 1019, 1021, 1044, 1045, 1046, 1048, 1049, 1050, 1055, 1056, 1059, 1062, 1063, 1064, 1065, 1067, 1069, 1071, 1072, 1073, 1074, 1075, 1076, 1078, 1081, 1082, 1083, 1087, 1088, 1091, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1105, 1106, 1128, 1129, 1132, 1133, 1135, 1158, 1159, 1160, 1162, 1163, 1164, 1169, 1170, 1173, 1176, 1177, 1178, 1179, 1181, 1183, 1185, 1186, 1187, 1188, 1189, 1190, 1192, 1195, 1196, 1197, 1201, 1202, 1205, 1207, 1208, 1209, 1210, 1211, 1212, 1213, 1214, 1215, 1216, 1217], "/Users/huangzhenjun/Public/git/PartTime/swagger-codegen/samples/client/petstore/python/swagger_client/models/model_return.py": [97, 115, 71, 103, 109, 49, 19, 21, 22, 25, 60, 29, 30], "/Users/huangzhenjun/Public/git/PartTime/swagger-codegen/samples/client/petstore/python/swagger_client/rest.py": [20, 21, 23, 24, 25, 26, 27, 28, 31, 33, 35, 36, 40, 42, 43, 45, 48, 51, 53, 54, 55, 56, 57, 59, 63, 65, 72, 74, 82, 83, 88, 92, 95, 98, 101, 102, 103, 104, 105, 106, 109, 110, 121, 122, 124, 129, 130, 132, 135, 137, 138, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 152, 153, 154, 155, 156, 159, 160, 161, 166, 170, 174, 176, 177, 179, 181, 182, 183, 184, 186, 191, 198, 199, 200, 201, 203, 204, 205, 206, 207, 208, 210, 211, 212, 213, 214, 215, 217, 225, 227, 228, 229, 230, 231, 232, 239, 243, 244, 245, 246, 248, 249, 251], "/Users/huangzhenjun/Public/git/PartTime/swagger-codegen/samples/client/petstore/python/swagger_client/models/order.py": [130, 172, 141, 173, 19, 21, 22, 152, 25, 29, 30, 161, 163, 39, 40, 41, 42, 43, 44, 45, 174, 175, 48, 49, 50, 51, 180, 53, 54, 52, 58, 59, 60, 61, 62, 191, 64, 202, 75, 86, 57, 176, 97, 228, 178, 234, 108, 240, 246, 119], "/Users/huangzhenjun/Public/git/PartTime/swagger-codegen/samples/client/petstore/python/swagger_client/apis/__init__.py": [1, 4, 5, 6], "/Users/huangzhenjun/Public/git/PartTime/swagger-codegen/samples/client/petstore/python/swagger_client/models/dog.py": [96, 128, 134, 74, 140, 19, 52, 21, 22, 85, 25, 122, 29, 30, 63], "/Users/huangzhenjun/Public/git/PartTime/swagger-codegen/samples/client/petstore/python/swagger_client/__init__.py": [1, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 19, 20, 21, 24, 26, 28], "/Users/huangzhenjun/Public/git/PartTime/swagger-codegen/samples/client/petstore/python/swagger_client/models/__init__.py": [1, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16], "/Users/huangzhenjun/Public/git/PartTime/swagger-codegen/samples/client/petstore/python/swagger_client/models/special_model_name.py": [97, 115, 71, 103, 109, 49, 19, 21, 22, 25, 60, 29, 30], "/Users/huangzhenjun/Public/git/PartTime/swagger-codegen/samples/client/petstore/python/swagger_client/apis/store_api.py": [257, 258, 282, 278, 305, 18, 20, 277, 22, 23, 281, 154, 284, 26, 32, 304, 37, 39, 40, 28, 327, 44, 46, 29, 48, 561, 306, 308, 309, 182, 315, 316, 319, 320, 322, 324, 310, 326, 455, 329, 76, 589, 334, 333, 338, 339, 342, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 483, 356, 41, 332, 383], "/Users/huangzhenjun/Public/git/PartTime/swagger-codegen/samples/client/petstore/python/swagger_client/models/inline_response_200.py": [130, 141, 19, 21, 22, 25, 29, 158, 169, 180, 30, 191, 64, 202, 75, 86, 97, 228, 234, 108, 240, 246, 119], "/Users/huangzhenjun/Public/git/PartTime/swagger-codegen/samples/client/petstore/python/swagger_client/models/animal.py": [97, 115, 71, 103, 109, 49, 19, 21, 22, 25, 60, 29, 30], "/Users/huangzhenjun/Public/git/PartTime/swagger-codegen/samples/client/petstore/python/swagger_client/configuration.py": [19, 21, 22, 23, 25, 26, 31, 32, 34, 36, 37, 39, 40, 41, 42, 43, 46, 47, 52, 54, 59, 61, 63, 67, 69, 71, 73, 76, 80, 81, 82, 84, 86, 88, 90, 92, 96, 98, 100, 102, 104, 111, 122, 123, 135, 136, 137, 138, 139, 142, 149, 157, 158, 167, 168, 170, 172, 179, 189, 190, 192, 199, 200, 201, 204, 210, 211, 213, 219, 221, 222, 223, 224, 225, 228, 229, 230, 231, 232, 235, 236, 237, 238, 239, 242, 243, 244, 245, 246, 249, 250, 251, 252, 253, 256, 257, 258, 259, 260, 265], "/Users/huangzhenjun/Public/git/PartTime/swagger-codegen/samples/client/petstore/python/swagger_client/models/pet.py": [128, 130, 150, 172, 139, 141, 19, 215, 21, 22, 152, 25, 29, 30, 161, 163, 39, 40, 41, 42, 43, 44, 45, 174, 48, 49, 50, 51, 52, 53, 54, 183, 185, 58, 59, 60, 61, 62, 64, 194, 195, 200, 73, 202, 75, 206, 208, 209, 210, 211, 84, 213, 86, 57, 216, 217, 95, 224, 97, 226, 228, 232, 234, 108, 240, 244, 117, 246, 119, 212, 106], "/Users/huangzhenjun/Public/git/PartTime/swagger-codegen/samples/client/petstore/python/swagger_client/models/tag.py": [128, 134, 138, 140, 19, 21, 22, 25, 29, 30, 39, 40, 41, 44, 45, 46, 49, 50, 52, 61, 63, 72, 74, 83, 85, 94, 96, 100, 102, 103, 104, 109, 111, 118, 120, 122], "/Users/huangzhenjun/Public/git/PartTime/swagger-codegen/samples/client/petstore/python/swagger_client/models/user.py": [278, 136, 272, 147, 21, 22, 25, 284, 29, 158, 290, 169, 180, 30, 191, 70, 202, 81, 213, 92, 224, 103, 235, 114, 19, 246, 125], "/Users/huangzhenjun/Public/git/PartTime/swagger-codegen/samples/client/petstore/python/swagger_client/models/model_200_response.py": [97, 115, 71, 103, 109, 49, 19, 21, 22, 25, 60, 29, 30]}} \ No newline at end of file diff --git a/samples/client/petstore/python/dev-requirements.txt.log b/samples/client/petstore/python/dev-requirements.txt.log index 6c260212adc..23fed21daa7 100644 --- a/samples/client/petstore/python/dev-requirements.txt.log +++ b/samples/client/petstore/python/dev-requirements.txt.log @@ -1,260 +1,16 @@ Collecting nose (from -r dev-requirements.txt (line 1)) - Using cached nose-1.3.7-py2-none-any.whl + Downloading nose-1.3.7-py2-none-any.whl (154kB) Collecting tox (from -r dev-requirements.txt (line 2)) - Using cached tox-2.1.1-py2.py3-none-any.whl + Downloading tox-2.3.1-py2.py3-none-any.whl (40kB) Collecting coverage (from -r dev-requirements.txt (line 3)) + Downloading coverage-4.1-cp27-cp27m-macosx_10_10_x86_64.whl (164kB) Collecting randomize (from -r dev-requirements.txt (line 4)) - Using cached randomize-0.13-py2.py3-none-any.whl + Downloading randomize-0.13-py2.py3-none-any.whl Collecting virtualenv>=1.11.2 (from tox->-r dev-requirements.txt (line 2)) - Using cached virtualenv-13.1.2-py2.py3-none-any.whl -Collecting py>=1.4.17 (from tox->-r dev-requirements.txt (line 2)) - Using cached py-1.4.30-py2.py3-none-any.whl -Collecting pluggy<0.4.0,>=0.3.0 (from tox->-r dev-requirements.txt (line 2)) - Using cached pluggy-0.3.0-py2.py3-none-any.whl -Installing collected packages: nose, virtualenv, py, pluggy, tox, coverage, randomize -Successfully installed coverage-3.7.1 nose-1.3.7 pluggy-0.3.0 py-1.4.30 randomize-0.13 tox-2.1.1 virtualenv-13.1.2 -Requirement already satisfied (use --upgrade to upgrade): nose in ./.venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1)) -Requirement already satisfied (use --upgrade to upgrade): tox in ./.venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): coverage in ./.venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3)) -Requirement already satisfied (use --upgrade to upgrade): randomize in ./.venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4)) -Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./.venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./.venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./.venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1)) -Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3)) -Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4)) -Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1)) -Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3)) -Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4)) -Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1)) -Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3)) -Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4)) -Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1)) -Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3)) -Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4)) -Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1)) -Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3)) -Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4)) -Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1)) -Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3)) -Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4)) -Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1)) -Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3)) -Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4)) -Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Collecting nose (from -r dev-requirements.txt (line 1)) - Using cached nose-1.3.7-py2-none-any.whl -Collecting tox (from -r dev-requirements.txt (line 2)) - Using cached tox-2.2.1-py2.py3-none-any.whl -Collecting coverage (from -r dev-requirements.txt (line 3)) - Downloading coverage-4.0.3.tar.gz (354kB) -Collecting randomize (from -r dev-requirements.txt (line 4)) - Using cached randomize-0.13-py2.py3-none-any.whl -Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in /Library/Python/2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) + Downloading virtualenv-15.0.2-py2.py3-none-any.whl (1.8MB) Collecting py>=1.4.17 (from tox->-r dev-requirements.txt (line 2)) Downloading py-1.4.31-py2.py3-none-any.whl (81kB) Collecting pluggy<0.4.0,>=0.3.0 (from tox->-r dev-requirements.txt (line 2)) - Using cached pluggy-0.3.1-py2.py3-none-any.whl -Installing collected packages: nose, py, pluggy, tox, coverage, randomize -Collecting nose (from -r dev-requirements.txt (line 1)) - Using cached nose-1.3.7-py2-none-any.whl -Collecting tox (from -r dev-requirements.txt (line 2)) - Using cached tox-2.2.1-py2.py3-none-any.whl -Collecting coverage (from -r dev-requirements.txt (line 3)) - Using cached coverage-4.0.3.tar.gz -Collecting randomize (from -r dev-requirements.txt (line 4)) - Using cached randomize-0.13-py2.py3-none-any.whl -Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in /Library/Python/2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Collecting py>=1.4.17 (from tox->-r dev-requirements.txt (line 2)) - Using cached py-1.4.31-py2.py3-none-any.whl -Collecting pluggy<0.4.0,>=0.3.0 (from tox->-r dev-requirements.txt (line 2)) - Using cached pluggy-0.3.1-py2.py3-none-any.whl -Installing collected packages: nose, py, pluggy, tox, coverage, randomize -Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1)) -Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3)) -Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4)) -Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1)) -Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3)) -Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4)) -Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1)) -Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3)) -Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4)) -Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1)) -Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3)) -Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4)) -Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1)) -Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3)) -Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4)) -Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1)) -Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3)) -Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4)) -Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1)) -Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3)) -Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4)) -Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1)) -Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3)) -Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4)) -Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1)) -Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3)) -Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4)) -Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1)) -Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3)) -Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4)) -Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1)) -Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3)) -Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4)) -Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1)) -Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3)) -Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4)) -Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1)) -Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3)) -Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4)) -Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1)) -Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3)) -Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4)) -Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1)) -Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3)) -Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4)) -Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1)) -Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3)) -Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4)) -Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1)) -Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3)) -Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4)) -Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1)) -Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3)) -Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4)) -Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1)) -Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3)) -Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4)) -Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1)) -Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3)) -Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4)) -Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1)) -Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3)) -Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4)) -Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1)) -Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3)) -Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4)) -Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1)) -Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3)) -Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4)) -Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) -Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) + Downloading pluggy-0.3.1-py2.py3-none-any.whl +Installing collected packages: nose, virtualenv, py, pluggy, tox, coverage, randomize +Successfully installed coverage-4.1 nose-1.3.7 pluggy-0.3.1 py-1.4.31 randomize-0.13 tox-2.3.1 virtualenv-15.0.2 diff --git a/samples/client/petstore/python/swagger_client/api_client.py b/samples/client/petstore/python/swagger_client/api_client.py index e5e4738e961..f4351250056 100644 --- a/samples/client/petstore/python/swagger_client/api_client.py +++ b/samples/client/petstore/python/swagger_client/api_client.py @@ -103,7 +103,7 @@ class ApiClient(object): def __call_api(self, resource_path, method, path_params=None, query_params=None, header_params=None, body=None, post_params=None, files=None, - response_type=None, auth_settings=None, callback=None): + response_type=None, auth_settings=None, callback=None, _return_http_data_only=None): # headers parameters header_params = header_params or {} @@ -157,9 +157,12 @@ class ApiClient(object): deserialized_data = None if callback: - callback((deserialized_data, response_data.status, response_data.getheaders())) + callback(deserialized_data) if _return_http_data_only else callback((deserialized_data, response_data.status, response_data.getheaders())) + elif _return_http_data_only: + return ( deserialized_data ); else: return (deserialized_data, response_data.status, response_data.getheaders()) + def to_path_value(self, obj): """ @@ -287,7 +290,7 @@ class ApiClient(object): def call_api(self, resource_path, method, path_params=None, query_params=None, header_params=None, body=None, post_params=None, files=None, - response_type=None, auth_settings=None, callback=None): + response_type=None, auth_settings=None, callback=None, _return_http_data_only=None): """ Makes the HTTP request (synchronous) and return the deserialized data. To make an async request, define a function for callback. @@ -308,6 +311,7 @@ class ApiClient(object): :param callback function: Callback function for asynchronous request. If provide this parameter, the request will be called asynchronously. + :param _return_http_data_only: response data without head status code and headers :return: If provide parameter callback, the request will be called asynchronously. @@ -319,7 +323,7 @@ class ApiClient(object): return self.__call_api(resource_path, method, path_params, query_params, header_params, body, post_params, files, - response_type, auth_settings, callback) + response_type, auth_settings, callback, _return_http_data_only) else: thread = threading.Thread(target=self.__call_api, args=(resource_path, method, @@ -327,7 +331,7 @@ class ApiClient(object): header_params, body, post_params, files, response_type, auth_settings, - callback)) + callback,_return_http_data_only)) thread.start() return thread diff --git a/samples/client/petstore/python/swagger_client/apis/pet_api.py b/samples/client/petstore/python/swagger_client/apis/pet_api.py index ae7a828e959..b61af397f70 100644 --- a/samples/client/petstore/python/swagger_client/apis/pet_api.py +++ b/samples/client/petstore/python/swagger_client/apis/pet_api.py @@ -46,6 +46,7 @@ class PetApi(object): self.api_client = config.api_client def add_pet(self, **kwargs): + _return_http_data_only = True """ Add a new pet to the store @@ -65,10 +66,11 @@ class PetApi(object): If the method is called asynchronously, returns the request thread. """ + kwargs['_return_http_data_only'] = _return_http_data_only if kwargs.get('callback'): return self.add_pet_with_http_info(**kwargs) else: - (data, status_code, response_headers) = self.add_pet_with_http_info(**kwargs) + (data) = self.add_pet_with_http_info(**kwargs) return data def add_pet_with_http_info(self, **kwargs): @@ -94,6 +96,7 @@ class PetApi(object): all_params = ['body'] all_params.append('callback') + all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): @@ -142,9 +145,11 @@ class PetApi(object): files=local_var_files, response_type=None, auth_settings=auth_settings, - callback=params.get('callback')) + callback=params.get('callback'), + _return_http_data_only=params.get('_return_http_data_only')) def add_pet_using_byte_array(self, **kwargs): + _return_http_data_only = True """ Fake endpoint to test byte array in body parameter for adding a new pet to the store @@ -164,10 +169,11 @@ class PetApi(object): If the method is called asynchronously, returns the request thread. """ + kwargs['_return_http_data_only'] = _return_http_data_only if kwargs.get('callback'): return self.add_pet_using_byte_array_with_http_info(**kwargs) else: - (data, status_code, response_headers) = self.add_pet_using_byte_array_with_http_info(**kwargs) + (data) = self.add_pet_using_byte_array_with_http_info(**kwargs) return data def add_pet_using_byte_array_with_http_info(self, **kwargs): @@ -193,6 +199,7 @@ class PetApi(object): all_params = ['body'] all_params.append('callback') + all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): @@ -241,9 +248,11 @@ class PetApi(object): files=local_var_files, response_type=None, auth_settings=auth_settings, - callback=params.get('callback')) + callback=params.get('callback'), + _return_http_data_only=params.get('_return_http_data_only')) def delete_pet(self, pet_id, **kwargs): + _return_http_data_only = True """ Deletes a pet @@ -264,10 +273,11 @@ class PetApi(object): If the method is called asynchronously, returns the request thread. """ + kwargs['_return_http_data_only'] = _return_http_data_only if kwargs.get('callback'): return self.delete_pet_with_http_info(pet_id, **kwargs) else: - (data, status_code, response_headers) = self.delete_pet_with_http_info(pet_id, **kwargs) + (data) = self.delete_pet_with_http_info(pet_id, **kwargs) return data def delete_pet_with_http_info(self, pet_id, **kwargs): @@ -294,6 +304,7 @@ class PetApi(object): all_params = ['pet_id', 'api_key'] all_params.append('callback') + all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): @@ -347,9 +358,11 @@ class PetApi(object): files=local_var_files, response_type=None, auth_settings=auth_settings, - callback=params.get('callback')) + callback=params.get('callback'), + _return_http_data_only=params.get('_return_http_data_only')) def find_pets_by_status(self, **kwargs): + _return_http_data_only = True """ Finds Pets by status Multiple status values can be provided with comma separated strings @@ -369,10 +382,11 @@ class PetApi(object): If the method is called asynchronously, returns the request thread. """ + kwargs['_return_http_data_only'] = _return_http_data_only if kwargs.get('callback'): return self.find_pets_by_status_with_http_info(**kwargs) else: - (data, status_code, response_headers) = self.find_pets_by_status_with_http_info(**kwargs) + (data) = self.find_pets_by_status_with_http_info(**kwargs) return data def find_pets_by_status_with_http_info(self, **kwargs): @@ -398,6 +412,7 @@ class PetApi(object): all_params = ['status'] all_params.append('callback') + all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): @@ -446,9 +461,11 @@ class PetApi(object): files=local_var_files, response_type='list[Pet]', auth_settings=auth_settings, - callback=params.get('callback')) + callback=params.get('callback'), + _return_http_data_only=params.get('_return_http_data_only')) def find_pets_by_tags(self, **kwargs): + _return_http_data_only = True """ Finds Pets by tags Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. @@ -468,10 +485,11 @@ class PetApi(object): If the method is called asynchronously, returns the request thread. """ + kwargs['_return_http_data_only'] = _return_http_data_only if kwargs.get('callback'): return self.find_pets_by_tags_with_http_info(**kwargs) else: - (data, status_code, response_headers) = self.find_pets_by_tags_with_http_info(**kwargs) + (data) = self.find_pets_by_tags_with_http_info(**kwargs) return data def find_pets_by_tags_with_http_info(self, **kwargs): @@ -497,6 +515,7 @@ class PetApi(object): all_params = ['tags'] all_params.append('callback') + all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): @@ -545,9 +564,11 @@ class PetApi(object): files=local_var_files, response_type='list[Pet]', auth_settings=auth_settings, - callback=params.get('callback')) + callback=params.get('callback'), + _return_http_data_only=params.get('_return_http_data_only')) def get_pet_by_id(self, pet_id, **kwargs): + _return_http_data_only = True """ Find pet by ID Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions @@ -567,10 +588,11 @@ class PetApi(object): If the method is called asynchronously, returns the request thread. """ + kwargs['_return_http_data_only'] = _return_http_data_only if kwargs.get('callback'): return self.get_pet_by_id_with_http_info(pet_id, **kwargs) else: - (data, status_code, response_headers) = self.get_pet_by_id_with_http_info(pet_id, **kwargs) + (data) = self.get_pet_by_id_with_http_info(pet_id, **kwargs) return data def get_pet_by_id_with_http_info(self, pet_id, **kwargs): @@ -596,6 +618,7 @@ class PetApi(object): all_params = ['pet_id'] all_params.append('callback') + all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): @@ -647,9 +670,11 @@ class PetApi(object): files=local_var_files, response_type='Pet', auth_settings=auth_settings, - callback=params.get('callback')) + callback=params.get('callback'), + _return_http_data_only=params.get('_return_http_data_only')) def get_pet_by_id_in_object(self, pet_id, **kwargs): + _return_http_data_only = True """ Fake endpoint to test inline arbitrary object return by 'Find pet by ID' Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions @@ -669,10 +694,11 @@ class PetApi(object): If the method is called asynchronously, returns the request thread. """ + kwargs['_return_http_data_only'] = _return_http_data_only if kwargs.get('callback'): return self.get_pet_by_id_in_object_with_http_info(pet_id, **kwargs) else: - (data, status_code, response_headers) = self.get_pet_by_id_in_object_with_http_info(pet_id, **kwargs) + (data) = self.get_pet_by_id_in_object_with_http_info(pet_id, **kwargs) return data def get_pet_by_id_in_object_with_http_info(self, pet_id, **kwargs): @@ -698,6 +724,7 @@ class PetApi(object): all_params = ['pet_id'] all_params.append('callback') + all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): @@ -749,9 +776,11 @@ class PetApi(object): files=local_var_files, response_type='InlineResponse200', auth_settings=auth_settings, - callback=params.get('callback')) + callback=params.get('callback'), + _return_http_data_only=params.get('_return_http_data_only')) def pet_pet_idtesting_byte_arraytrue_get(self, pet_id, **kwargs): + _return_http_data_only = True """ Fake endpoint to test byte array return by 'Find pet by ID' Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions @@ -771,10 +800,11 @@ class PetApi(object): If the method is called asynchronously, returns the request thread. """ + kwargs['_return_http_data_only'] = _return_http_data_only if kwargs.get('callback'): return self.pet_pet_idtesting_byte_arraytrue_get_with_http_info(pet_id, **kwargs) else: - (data, status_code, response_headers) = self.pet_pet_idtesting_byte_arraytrue_get_with_http_info(pet_id, **kwargs) + (data) = self.pet_pet_idtesting_byte_arraytrue_get_with_http_info(pet_id, **kwargs) return data def pet_pet_idtesting_byte_arraytrue_get_with_http_info(self, pet_id, **kwargs): @@ -800,6 +830,7 @@ class PetApi(object): all_params = ['pet_id'] all_params.append('callback') + all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): @@ -851,9 +882,11 @@ class PetApi(object): files=local_var_files, response_type='str', auth_settings=auth_settings, - callback=params.get('callback')) + callback=params.get('callback'), + _return_http_data_only=params.get('_return_http_data_only')) def update_pet(self, **kwargs): + _return_http_data_only = True """ Update an existing pet @@ -873,10 +906,11 @@ class PetApi(object): If the method is called asynchronously, returns the request thread. """ + kwargs['_return_http_data_only'] = _return_http_data_only if kwargs.get('callback'): return self.update_pet_with_http_info(**kwargs) else: - (data, status_code, response_headers) = self.update_pet_with_http_info(**kwargs) + (data) = self.update_pet_with_http_info(**kwargs) return data def update_pet_with_http_info(self, **kwargs): @@ -902,6 +936,7 @@ class PetApi(object): all_params = ['body'] all_params.append('callback') + all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): @@ -950,9 +985,11 @@ class PetApi(object): files=local_var_files, response_type=None, auth_settings=auth_settings, - callback=params.get('callback')) + callback=params.get('callback'), + _return_http_data_only=params.get('_return_http_data_only')) def update_pet_with_form(self, pet_id, **kwargs): + _return_http_data_only = True """ Updates a pet in the store with form data @@ -974,10 +1011,11 @@ class PetApi(object): If the method is called asynchronously, returns the request thread. """ + kwargs['_return_http_data_only'] = _return_http_data_only if kwargs.get('callback'): return self.update_pet_with_form_with_http_info(pet_id, **kwargs) else: - (data, status_code, response_headers) = self.update_pet_with_form_with_http_info(pet_id, **kwargs) + (data) = self.update_pet_with_form_with_http_info(pet_id, **kwargs) return data def update_pet_with_form_with_http_info(self, pet_id, **kwargs): @@ -1005,6 +1043,7 @@ class PetApi(object): all_params = ['pet_id', 'name', 'status'] all_params.append('callback') + all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): @@ -1060,9 +1099,11 @@ class PetApi(object): files=local_var_files, response_type=None, auth_settings=auth_settings, - callback=params.get('callback')) + callback=params.get('callback'), + _return_http_data_only=params.get('_return_http_data_only')) def upload_file(self, pet_id, **kwargs): + _return_http_data_only = True """ uploads an image @@ -1084,10 +1125,11 @@ class PetApi(object): If the method is called asynchronously, returns the request thread. """ + kwargs['_return_http_data_only'] = _return_http_data_only if kwargs.get('callback'): return self.upload_file_with_http_info(pet_id, **kwargs) else: - (data, status_code, response_headers) = self.upload_file_with_http_info(pet_id, **kwargs) + (data) = self.upload_file_with_http_info(pet_id, **kwargs) return data def upload_file_with_http_info(self, pet_id, **kwargs): @@ -1115,6 +1157,7 @@ class PetApi(object): all_params = ['pet_id', 'additional_metadata', 'file'] all_params.append('callback') + all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): @@ -1170,4 +1213,5 @@ class PetApi(object): files=local_var_files, response_type=None, auth_settings=auth_settings, - callback=params.get('callback')) + callback=params.get('callback'), + _return_http_data_only=params.get('_return_http_data_only')) diff --git a/samples/client/petstore/python/swagger_client/apis/store_api.py b/samples/client/petstore/python/swagger_client/apis/store_api.py index 4d4ffca2ce5..938b16b66be 100644 --- a/samples/client/petstore/python/swagger_client/apis/store_api.py +++ b/samples/client/petstore/python/swagger_client/apis/store_api.py @@ -46,6 +46,7 @@ class StoreApi(object): self.api_client = config.api_client def delete_order(self, order_id, **kwargs): + _return_http_data_only = True """ Delete purchase order by ID For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors @@ -65,10 +66,11 @@ class StoreApi(object): If the method is called asynchronously, returns the request thread. """ + kwargs['_return_http_data_only'] = _return_http_data_only if kwargs.get('callback'): return self.delete_order_with_http_info(order_id, **kwargs) else: - (data, status_code, response_headers) = self.delete_order_with_http_info(order_id, **kwargs) + (data) = self.delete_order_with_http_info(order_id, **kwargs) return data def delete_order_with_http_info(self, order_id, **kwargs): @@ -94,6 +96,7 @@ class StoreApi(object): all_params = ['order_id'] all_params.append('callback') + all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): @@ -145,9 +148,11 @@ class StoreApi(object): files=local_var_files, response_type=None, auth_settings=auth_settings, - callback=params.get('callback')) + callback=params.get('callback'), + _return_http_data_only=params.get('_return_http_data_only')) def find_orders_by_status(self, **kwargs): + _return_http_data_only = True """ Finds orders by status A single status value can be provided as a string @@ -167,10 +172,11 @@ class StoreApi(object): If the method is called asynchronously, returns the request thread. """ + kwargs['_return_http_data_only'] = _return_http_data_only if kwargs.get('callback'): return self.find_orders_by_status_with_http_info(**kwargs) else: - (data, status_code, response_headers) = self.find_orders_by_status_with_http_info(**kwargs) + (data) = self.find_orders_by_status_with_http_info(**kwargs) return data def find_orders_by_status_with_http_info(self, **kwargs): @@ -196,6 +202,7 @@ class StoreApi(object): all_params = ['status'] all_params.append('callback') + all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): @@ -244,9 +251,11 @@ class StoreApi(object): files=local_var_files, response_type='list[Order]', auth_settings=auth_settings, - callback=params.get('callback')) + callback=params.get('callback'), + _return_http_data_only=params.get('_return_http_data_only')) def get_inventory(self, **kwargs): + _return_http_data_only = True """ Returns pet inventories by status Returns a map of status codes to quantities @@ -265,10 +274,11 @@ class StoreApi(object): If the method is called asynchronously, returns the request thread. """ + kwargs['_return_http_data_only'] = _return_http_data_only if kwargs.get('callback'): return self.get_inventory_with_http_info(**kwargs) else: - (data, status_code, response_headers) = self.get_inventory_with_http_info(**kwargs) + (data) = self.get_inventory_with_http_info(**kwargs) return data def get_inventory_with_http_info(self, **kwargs): @@ -293,6 +303,7 @@ class StoreApi(object): all_params = [] all_params.append('callback') + all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): @@ -339,9 +350,11 @@ class StoreApi(object): files=local_var_files, response_type='dict(str, int)', auth_settings=auth_settings, - callback=params.get('callback')) + callback=params.get('callback'), + _return_http_data_only=params.get('_return_http_data_only')) def get_inventory_in_object(self, **kwargs): + _return_http_data_only = True """ Fake endpoint to test arbitrary object return by 'Get inventory' Returns an arbitrary object which is actually a map of status codes to quantities @@ -360,10 +373,11 @@ class StoreApi(object): If the method is called asynchronously, returns the request thread. """ + kwargs['_return_http_data_only'] = _return_http_data_only if kwargs.get('callback'): return self.get_inventory_in_object_with_http_info(**kwargs) else: - (data, status_code, response_headers) = self.get_inventory_in_object_with_http_info(**kwargs) + (data) = self.get_inventory_in_object_with_http_info(**kwargs) return data def get_inventory_in_object_with_http_info(self, **kwargs): @@ -388,6 +402,7 @@ class StoreApi(object): all_params = [] all_params.append('callback') + all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): @@ -434,9 +449,11 @@ class StoreApi(object): files=local_var_files, response_type='object', auth_settings=auth_settings, - callback=params.get('callback')) + callback=params.get('callback'), + _return_http_data_only=params.get('_return_http_data_only')) def get_order_by_id(self, order_id, **kwargs): + _return_http_data_only = True """ Find purchase order by ID For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions @@ -456,10 +473,11 @@ class StoreApi(object): If the method is called asynchronously, returns the request thread. """ + kwargs['_return_http_data_only'] = _return_http_data_only if kwargs.get('callback'): return self.get_order_by_id_with_http_info(order_id, **kwargs) else: - (data, status_code, response_headers) = self.get_order_by_id_with_http_info(order_id, **kwargs) + (data) = self.get_order_by_id_with_http_info(order_id, **kwargs) return data def get_order_by_id_with_http_info(self, order_id, **kwargs): @@ -485,6 +503,7 @@ class StoreApi(object): all_params = ['order_id'] all_params.append('callback') + all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): @@ -536,9 +555,11 @@ class StoreApi(object): files=local_var_files, response_type='Order', auth_settings=auth_settings, - callback=params.get('callback')) + callback=params.get('callback'), + _return_http_data_only=params.get('_return_http_data_only')) def place_order(self, **kwargs): + _return_http_data_only = True """ Place an order for a pet @@ -558,10 +579,11 @@ class StoreApi(object): If the method is called asynchronously, returns the request thread. """ + kwargs['_return_http_data_only'] = _return_http_data_only if kwargs.get('callback'): return self.place_order_with_http_info(**kwargs) else: - (data, status_code, response_headers) = self.place_order_with_http_info(**kwargs) + (data) = self.place_order_with_http_info(**kwargs) return data def place_order_with_http_info(self, **kwargs): @@ -587,6 +609,7 @@ class StoreApi(object): all_params = ['body'] all_params.append('callback') + all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): @@ -635,4 +658,5 @@ class StoreApi(object): files=local_var_files, response_type='Order', auth_settings=auth_settings, - callback=params.get('callback')) + callback=params.get('callback'), + _return_http_data_only=params.get('_return_http_data_only')) diff --git a/samples/client/petstore/python/swagger_client/apis/user_api.py b/samples/client/petstore/python/swagger_client/apis/user_api.py index 39ab9148a15..b26264178c1 100644 --- a/samples/client/petstore/python/swagger_client/apis/user_api.py +++ b/samples/client/petstore/python/swagger_client/apis/user_api.py @@ -46,6 +46,7 @@ class UserApi(object): self.api_client = config.api_client def create_user(self, **kwargs): + _return_http_data_only = True """ Create user This can only be done by the logged in user. @@ -65,10 +66,11 @@ class UserApi(object): If the method is called asynchronously, returns the request thread. """ + kwargs['_return_http_data_only'] = _return_http_data_only if kwargs.get('callback'): return self.create_user_with_http_info(**kwargs) else: - (data, status_code, response_headers) = self.create_user_with_http_info(**kwargs) + (data) = self.create_user_with_http_info(**kwargs) return data def create_user_with_http_info(self, **kwargs): @@ -94,6 +96,7 @@ class UserApi(object): all_params = ['body'] all_params.append('callback') + all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): @@ -142,9 +145,11 @@ class UserApi(object): files=local_var_files, response_type=None, auth_settings=auth_settings, - callback=params.get('callback')) + callback=params.get('callback'), + _return_http_data_only=params.get('_return_http_data_only')) def create_users_with_array_input(self, **kwargs): + _return_http_data_only = True """ Creates list of users with given input array @@ -164,10 +169,11 @@ class UserApi(object): If the method is called asynchronously, returns the request thread. """ + kwargs['_return_http_data_only'] = _return_http_data_only if kwargs.get('callback'): return self.create_users_with_array_input_with_http_info(**kwargs) else: - (data, status_code, response_headers) = self.create_users_with_array_input_with_http_info(**kwargs) + (data) = self.create_users_with_array_input_with_http_info(**kwargs) return data def create_users_with_array_input_with_http_info(self, **kwargs): @@ -193,6 +199,7 @@ class UserApi(object): all_params = ['body'] all_params.append('callback') + all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): @@ -241,9 +248,11 @@ class UserApi(object): files=local_var_files, response_type=None, auth_settings=auth_settings, - callback=params.get('callback')) + callback=params.get('callback'), + _return_http_data_only=params.get('_return_http_data_only')) def create_users_with_list_input(self, **kwargs): + _return_http_data_only = True """ Creates list of users with given input array @@ -263,10 +272,11 @@ class UserApi(object): If the method is called asynchronously, returns the request thread. """ + kwargs['_return_http_data_only'] = _return_http_data_only if kwargs.get('callback'): return self.create_users_with_list_input_with_http_info(**kwargs) else: - (data, status_code, response_headers) = self.create_users_with_list_input_with_http_info(**kwargs) + (data) = self.create_users_with_list_input_with_http_info(**kwargs) return data def create_users_with_list_input_with_http_info(self, **kwargs): @@ -292,6 +302,7 @@ class UserApi(object): all_params = ['body'] all_params.append('callback') + all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): @@ -340,9 +351,11 @@ class UserApi(object): files=local_var_files, response_type=None, auth_settings=auth_settings, - callback=params.get('callback')) + callback=params.get('callback'), + _return_http_data_only=params.get('_return_http_data_only')) def delete_user(self, username, **kwargs): + _return_http_data_only = True """ Delete user This can only be done by the logged in user. @@ -362,10 +375,11 @@ class UserApi(object): If the method is called asynchronously, returns the request thread. """ + kwargs['_return_http_data_only'] = _return_http_data_only if kwargs.get('callback'): return self.delete_user_with_http_info(username, **kwargs) else: - (data, status_code, response_headers) = self.delete_user_with_http_info(username, **kwargs) + (data) = self.delete_user_with_http_info(username, **kwargs) return data def delete_user_with_http_info(self, username, **kwargs): @@ -391,6 +405,7 @@ class UserApi(object): all_params = ['username'] all_params.append('callback') + all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): @@ -442,9 +457,11 @@ class UserApi(object): files=local_var_files, response_type=None, auth_settings=auth_settings, - callback=params.get('callback')) + callback=params.get('callback'), + _return_http_data_only=params.get('_return_http_data_only')) def get_user_by_name(self, username, **kwargs): + _return_http_data_only = True """ Get user by user name @@ -464,10 +481,11 @@ class UserApi(object): If the method is called asynchronously, returns the request thread. """ + kwargs['_return_http_data_only'] = _return_http_data_only if kwargs.get('callback'): return self.get_user_by_name_with_http_info(username, **kwargs) else: - (data, status_code, response_headers) = self.get_user_by_name_with_http_info(username, **kwargs) + (data) = self.get_user_by_name_with_http_info(username, **kwargs) return data def get_user_by_name_with_http_info(self, username, **kwargs): @@ -493,6 +511,7 @@ class UserApi(object): all_params = ['username'] all_params.append('callback') + all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): @@ -544,9 +563,11 @@ class UserApi(object): files=local_var_files, response_type='User', auth_settings=auth_settings, - callback=params.get('callback')) + callback=params.get('callback'), + _return_http_data_only=params.get('_return_http_data_only')) def login_user(self, **kwargs): + _return_http_data_only = True """ Logs user into the system @@ -567,10 +588,11 @@ class UserApi(object): If the method is called asynchronously, returns the request thread. """ + kwargs['_return_http_data_only'] = _return_http_data_only if kwargs.get('callback'): return self.login_user_with_http_info(**kwargs) else: - (data, status_code, response_headers) = self.login_user_with_http_info(**kwargs) + (data) = self.login_user_with_http_info(**kwargs) return data def login_user_with_http_info(self, **kwargs): @@ -597,6 +619,7 @@ class UserApi(object): all_params = ['username', 'password'] all_params.append('callback') + all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): @@ -647,9 +670,11 @@ class UserApi(object): files=local_var_files, response_type='str', auth_settings=auth_settings, - callback=params.get('callback')) + callback=params.get('callback'), + _return_http_data_only=params.get('_return_http_data_only')) def logout_user(self, **kwargs): + _return_http_data_only = True """ Logs out current logged in user session @@ -668,10 +693,11 @@ class UserApi(object): If the method is called asynchronously, returns the request thread. """ + kwargs['_return_http_data_only'] = _return_http_data_only if kwargs.get('callback'): return self.logout_user_with_http_info(**kwargs) else: - (data, status_code, response_headers) = self.logout_user_with_http_info(**kwargs) + (data) = self.logout_user_with_http_info(**kwargs) return data def logout_user_with_http_info(self, **kwargs): @@ -696,6 +722,7 @@ class UserApi(object): all_params = [] all_params.append('callback') + all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): @@ -742,9 +769,11 @@ class UserApi(object): files=local_var_files, response_type=None, auth_settings=auth_settings, - callback=params.get('callback')) + callback=params.get('callback'), + _return_http_data_only=params.get('_return_http_data_only')) def update_user(self, username, **kwargs): + _return_http_data_only = True """ Updated user This can only be done by the logged in user. @@ -765,10 +794,11 @@ class UserApi(object): If the method is called asynchronously, returns the request thread. """ + kwargs['_return_http_data_only'] = _return_http_data_only if kwargs.get('callback'): return self.update_user_with_http_info(username, **kwargs) else: - (data, status_code, response_headers) = self.update_user_with_http_info(username, **kwargs) + (data) = self.update_user_with_http_info(username, **kwargs) return data def update_user_with_http_info(self, username, **kwargs): @@ -795,6 +825,7 @@ class UserApi(object): all_params = ['username', 'body'] all_params.append('callback') + all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): @@ -848,4 +879,5 @@ class UserApi(object): files=local_var_files, response_type=None, auth_settings=auth_settings, - callback=params.get('callback')) + callback=params.get('callback'), + _return_http_data_only=params.get('_return_http_data_only')) diff --git a/samples/client/petstore/python/swagger_client/models/animal.py b/samples/client/petstore/python/swagger_client/models/animal.py new file mode 100644 index 00000000000..762e3df5b37 --- /dev/null +++ b/samples/client/petstore/python/swagger_client/models/animal.py @@ -0,0 +1,120 @@ +# coding: utf-8 + +""" +Copyright 2016 SmartBear Software + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + Ref: https://github.com/swagger-api/swagger-codegen +""" + +from pprint import pformat +from six import iteritems + + +class Animal(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + def __init__(self): + """ + Animal - a model defined in Swagger + + :param dict swaggerTypes: The key is attribute name + and the value is attribute type. + :param dict attributeMap: The key is attribute name + and the value is json key in definition. + """ + self.swagger_types = { + 'class_name': 'str' + } + + self.attribute_map = { + 'class_name': 'className' + } + + self._class_name = None + + @property + def class_name(self): + """ + Gets the class_name of this Animal. + + + :return: The class_name of this Animal. + :rtype: str + """ + return self._class_name + + @class_name.setter + def class_name(self, class_name): + """ + Sets the class_name of this Animal. + + + :param class_name: The class_name of this Animal. + :type: str + """ + self._class_name = class_name + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other + diff --git a/samples/client/petstore/python/swagger_client/models/cat.py b/samples/client/petstore/python/swagger_client/models/cat.py new file mode 100644 index 00000000000..4744fc4821c --- /dev/null +++ b/samples/client/petstore/python/swagger_client/models/cat.py @@ -0,0 +1,145 @@ +# coding: utf-8 + +""" +Copyright 2016 SmartBear Software + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + Ref: https://github.com/swagger-api/swagger-codegen +""" + +from pprint import pformat +from six import iteritems + + +class Cat(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + def __init__(self): + """ + Cat - a model defined in Swagger + + :param dict swaggerTypes: The key is attribute name + and the value is attribute type. + :param dict attributeMap: The key is attribute name + and the value is json key in definition. + """ + self.swagger_types = { + 'class_name': 'str', + 'declawed': 'bool' + } + + self.attribute_map = { + 'class_name': 'className', + 'declawed': 'declawed' + } + + self._class_name = None + self._declawed = None + + @property + def class_name(self): + """ + Gets the class_name of this Cat. + + + :return: The class_name of this Cat. + :rtype: str + """ + return self._class_name + + @class_name.setter + def class_name(self, class_name): + """ + Sets the class_name of this Cat. + + + :param class_name: The class_name of this Cat. + :type: str + """ + self._class_name = class_name + + @property + def declawed(self): + """ + Gets the declawed of this Cat. + + + :return: The declawed of this Cat. + :rtype: bool + """ + return self._declawed + + @declawed.setter + def declawed(self, declawed): + """ + Sets the declawed of this Cat. + + + :param declawed: The declawed of this Cat. + :type: bool + """ + self._declawed = declawed + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other + diff --git a/samples/client/petstore/python/swagger_client/models/dog.py b/samples/client/petstore/python/swagger_client/models/dog.py new file mode 100644 index 00000000000..3885dd314ef --- /dev/null +++ b/samples/client/petstore/python/swagger_client/models/dog.py @@ -0,0 +1,145 @@ +# coding: utf-8 + +""" +Copyright 2016 SmartBear Software + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + Ref: https://github.com/swagger-api/swagger-codegen +""" + +from pprint import pformat +from six import iteritems + + +class Dog(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + def __init__(self): + """ + Dog - a model defined in Swagger + + :param dict swaggerTypes: The key is attribute name + and the value is attribute type. + :param dict attributeMap: The key is attribute name + and the value is json key in definition. + """ + self.swagger_types = { + 'class_name': 'str', + 'breed': 'str' + } + + self.attribute_map = { + 'class_name': 'className', + 'breed': 'breed' + } + + self._class_name = None + self._breed = None + + @property + def class_name(self): + """ + Gets the class_name of this Dog. + + + :return: The class_name of this Dog. + :rtype: str + """ + return self._class_name + + @class_name.setter + def class_name(self, class_name): + """ + Sets the class_name of this Dog. + + + :param class_name: The class_name of this Dog. + :type: str + """ + self._class_name = class_name + + @property + def breed(self): + """ + Gets the breed of this Dog. + + + :return: The breed of this Dog. + :rtype: str + """ + return self._breed + + @breed.setter + def breed(self, breed): + """ + Sets the breed of this Dog. + + + :param breed: The breed of this Dog. + :type: str + """ + self._breed = breed + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other + diff --git a/samples/client/petstore/python/tests/test_pet_api.py b/samples/client/petstore/python/tests/test_pet_api.py index 300a7bee783..14a9895ab97 100644 --- a/samples/client/petstore/python/tests/test_pet_api.py +++ b/samples/client/petstore/python/tests/test_pet_api.py @@ -97,6 +97,15 @@ class PetApiTests(unittest.TestCase): self.assertIsNotNone(fetched.category) self.assertEqual(self.pet.category.name, fetched.category.name) + def test_add_pet_and_get_pet_by_id_with_http_info(self): + self.pet_api.add_pet(body=self.pet) + + fetched = self.pet_api.get_pet_by_id_with_http_info(pet_id=self.pet.id) + self.assertIsNotNone(fetched) + self.assertEqual(self.pet.id, fetched[0].id) + self.assertIsNotNone(fetched[0].category) + self.assertEqual(self.pet.category.name, fetched[0].category.name) + def test_update_pet(self): self.pet.name = "hello kity with updated" self.pet_api.update_pet(body=self.pet) From fc43b8700b905e36dbf08c02ee2bae308c6f8786 Mon Sep 17 00:00:00 2001 From: Mateusz Mackowiak Date: Wed, 15 Jun 2016 21:40:56 +0200 Subject: [PATCH 04/16] [Objc] Moved default petstore demo sample to default folder and created a target with core data sample --- .gitignore | 17 +- bin/objc-petstore-coredata.sh | 31 + bin/objc-petstore.sh | 2 +- bin/windows/objc-petstore.bat | 2 +- .../io/swagger/codegen/DefaultGenerator.java | 2 + pom.xml | 2 +- .../xcshareddata/SwaggerClient.xccheckout | 41 -- .../UserInterfaceState.xcuserstate | Bin 12123 -> 0 bytes .../xcschemes/xcschememanagement.plist | 19 - .../petstore/objc/{ => core-data}/.gitignore | 0 .../{ => core-data}/.swagger-codegen-ignore | 0 .../petstore/objc/{ => core-data}/LICENSE | 0 .../petstore/objc/{ => core-data}/README.md | 2 +- .../{ => core-data}/SwaggerClient.podspec | 0 .../SwaggerClient/Api/SWGPetApi.h | 0 .../SwaggerClient/Api/SWGPetApi.m | 0 .../SwaggerClient/Api/SWGStoreApi.h | 0 .../SwaggerClient/Api/SWGStoreApi.m | 0 .../SwaggerClient/Api/SWGUserApi.h | 0 .../SwaggerClient/Api/SWGUserApi.m | 0 .../Core/JSONValueTransformer+ISO8601.h | 0 .../Core/JSONValueTransformer+ISO8601.m | 0 .../SwaggerClient/Core/SWGApi.h | 0 .../SwaggerClient/Core/SWGApiClient.h | 0 .../SwaggerClient/Core/SWGApiClient.m | 0 .../SwaggerClient/Core/SWGConfiguration.h | 0 .../SwaggerClient/Core/SWGConfiguration.m | 0 .../Core/SWGJSONRequestSerializer.h | 0 .../Core/SWGJSONRequestSerializer.m | 0 .../Core/SWGJSONResponseSerializer.h | 0 .../Core/SWGJSONResponseSerializer.m | 0 .../SwaggerClient/Core/SWGLogger.h | 0 .../SwaggerClient/Core/SWGLogger.m | 0 .../SwaggerClient/Core/SWGObject.h | 0 .../SwaggerClient/Core/SWGObject.m | 0 .../Core/SWGQueryParamCollection.h | 0 .../Core/SWGQueryParamCollection.m | 0 .../Core/SWGResponseDeserializer.h | 0 .../Core/SWGResponseDeserializer.m | 0 .../SwaggerClient/Core/SWGSanitizer.h | 0 .../SwaggerClient/Core/SWGSanitizer.m | 0 .../SwaggerClient/Model/SWGCategory.h | 0 .../SwaggerClient/Model/SWGCategory.m | 0 .../Model/SWGCategoryManagedObject.h | 0 .../Model/SWGCategoryManagedObject.m | 0 .../Model/SWGCategoryManagedObjectBuilder.h | 0 .../Model/SWGCategoryManagedObjectBuilder.m | 0 .../SWGModel.xcdatamodeld/.xccurrentversion | 0 .../SWGModel.xcdatamodel/contents | 0 .../SwaggerClient/Model/SWGOrder.h | 0 .../SwaggerClient/Model/SWGOrder.m | 0 .../Model/SWGOrderManagedObject.h | 0 .../Model/SWGOrderManagedObject.m | 0 .../Model/SWGOrderManagedObjectBuilder.h | 0 .../Model/SWGOrderManagedObjectBuilder.m | 0 .../SwaggerClient/Model/SWGPet.h | 0 .../SwaggerClient/Model/SWGPet.m | 0 .../SwaggerClient/Model/SWGPetManagedObject.h | 0 .../SwaggerClient/Model/SWGPetManagedObject.m | 0 .../Model/SWGPetManagedObjectBuilder.h | 0 .../Model/SWGPetManagedObjectBuilder.m | 0 .../SwaggerClient/Model/SWGTag.h | 0 .../SwaggerClient/Model/SWGTag.m | 0 .../SwaggerClient/Model/SWGTagManagedObject.h | 0 .../SwaggerClient/Model/SWGTagManagedObject.m | 0 .../Model/SWGTagManagedObjectBuilder.h | 0 .../Model/SWGTagManagedObjectBuilder.m | 0 .../SwaggerClient/Model/SWGUser.h | 0 .../SwaggerClient/Model/SWGUser.m | 0 .../Model/SWGUserManagedObject.h | 0 .../Model/SWGUserManagedObject.m | 0 .../Model/SWGUserManagedObjectBuilder.h | 0 .../Model/SWGUserManagedObjectBuilder.m | 0 .../SwaggerClientTests/Podfile | 0 .../SwaggerClient.xcodeproj/project.pbxproj | 621 +++++++++++++++++ .../contents.xcworkspacedata | 0 .../xcshareddata/xcschemes/All Tests.xcscheme | 36 + .../xcschemes/SwaggerClient-Example.xcscheme | 0 .../AppIcon.appiconset/Contents.json | 0 .../LaunchImage.launchimage/Contents.json | 0 .../SwaggerClient/Launch Screen.storyboard | 0 .../SwaggerClient/Main.storyboard | 0 .../SwaggerClient/SWGAppDelegate.h | 0 .../SwaggerClient/SWGAppDelegate.m | 19 + .../SwaggerClient/SWGViewController.h | 0 .../SwaggerClient/SWGViewController.m | 0 .../SwaggerClient/SwaggerClient-Info.plist | 0 .../SwaggerClient/SwaggerClient-Prefix.pch | 0 .../SwaggerClient/en.lproj/InfoPlist.strings | 0 .../SwaggerClientTests/SwaggerClient/main.m | 0 .../SwaggerClientTests/Tests/BuildersTest.m | 0 .../Tests/Helpers/DatabaseHelper.h | 0 .../Tests/Helpers/DatabaseHelper.m | 0 .../SwaggerClientTests/Tests/Tests-Info.plist | 0 .../SwaggerClientTests/Tests/Tests-Prefix.pch | 0 .../Tests/en.lproj/InfoPlist.strings | 0 .../SwaggerClientTests/pom.xml | 0 .../petstore/objc/{ => core-data}/git_push.sh | 0 .../client/petstore/objc/default/.gitignore | 53 ++ .../objc/default/.swagger-codegen-ignore | 23 + samples/client/petstore/objc/default/LICENSE | 201 ++++++ .../client/petstore/objc/default/README.md | 147 ++++ .../objc/default/SwaggerClient.podspec | 37 + .../default/SwaggerClient/Api/SWGPetApi.h | 150 +++++ .../default/SwaggerClient/Api/SWGPetApi.m | 632 ++++++++++++++++++ .../default/SwaggerClient/Api/SWGStoreApi.h | 89 +++ .../default/SwaggerClient/Api/SWGStoreApi.m | 333 +++++++++ .../default/SwaggerClient/Api/SWGUserApi.h | 142 ++++ .../default/SwaggerClient/Api/SWGUserApi.m | 594 ++++++++++++++++ .../Core/JSONValueTransformer+ISO8601.h | 31 + .../Core/JSONValueTransformer+ISO8601.m | 10 + .../objc/default/SwaggerClient/Core/SWGApi.h | 42 ++ .../default/SwaggerClient/Core/SWGApiClient.h | 210 ++++++ .../default/SwaggerClient/Core/SWGApiClient.m | 504 ++++++++++++++ .../SwaggerClient/Core/SWGConfiguration.h | 182 +++++ .../SwaggerClient/Core/SWGConfiguration.m | 160 +++++ .../Core/SWGJSONRequestSerializer.h | 29 + .../Core/SWGJSONRequestSerializer.m | 37 + .../Core/SWGJSONResponseSerializer.h | 30 + .../Core/SWGJSONResponseSerializer.m | 39 ++ .../default/SwaggerClient/Core/SWGLogger.h | 72 ++ .../default/SwaggerClient/Core/SWGLogger.m | 74 ++ .../default/SwaggerClient/Core/SWGObject.h | 30 + .../default/SwaggerClient/Core/SWGObject.m | 13 + .../Core/SWGQueryParamCollection.h | 35 + .../Core/SWGQueryParamCollection.m | 16 + .../Core/SWGResponseDeserializer.h | 68 ++ .../Core/SWGResponseDeserializer.m | 231 +++++++ .../default/SwaggerClient/Core/SWGSanitizer.h | 67 ++ .../default/SwaggerClient/Core/SWGSanitizer.m | 168 +++++ .../default/SwaggerClient/Model/SWGCategory.h | 40 ++ .../default/SwaggerClient/Model/SWGCategory.m | 34 + .../default/SwaggerClient/Model/SWGOrder.h | 49 ++ .../default/SwaggerClient/Model/SWGOrder.m | 34 + .../objc/default/SwaggerClient/Model/SWGPet.h | 51 ++ .../objc/default/SwaggerClient/Model/SWGPet.m | 34 + .../objc/default/SwaggerClient/Model/SWGTag.h | 40 ++ .../objc/default/SwaggerClient/Model/SWGTag.m | 34 + .../default/SwaggerClient/Model/SWGUser.h | 53 ++ .../default/SwaggerClient/Model/SWGUser.m | 34 + .../objc/default/SwaggerClientTests/Podfile | 12 + .../SwaggerClient.xcodeproj/project.pbxproj | 4 - .../contents.xcworkspacedata | 7 + .../xcshareddata/xcschemes/All Tests.xcscheme | 36 + .../xcschemes/SwaggerClient-Example.xcscheme | 98 +++ .../AppIcon.appiconset/Contents.json | 53 ++ .../LaunchImage.launchimage/Contents.json | 51 ++ .../SwaggerClient/Launch Screen.storyboard | 50 ++ .../SwaggerClient/Main.storyboard | 27 + .../SwaggerClient/SWGAppDelegate.h | 15 + .../SwaggerClient/SWGAppDelegate.m | 0 .../SwaggerClient/SWGViewController.h | 13 + .../SwaggerClient/SWGViewController.m | 60 ++ .../SwaggerClient/SwaggerClient-Info.plist | 54 ++ .../SwaggerClient/SwaggerClient-Prefix.pch | 16 + .../SwaggerClient/en.lproj/InfoPlist.strings | 2 + .../SwaggerClientTests/SwaggerClient/main.m | 17 + .../Tests/DeserializationTest.m | 0 .../Tests/Helpers/DatabaseHelper.h | 14 + .../Tests/Helpers/DatabaseHelper.m | 42 ++ .../SwaggerClientTests/Tests/PetApiTest.m | 0 .../SwaggerClientTests/Tests/PetTest.m | 0 .../Tests/SWGApiClientTest.m | 0 .../SwaggerClientTests/Tests/StoreApiTest.m | 0 .../SwaggerClientTests/Tests/Tests-Info.plist | 22 + .../SwaggerClientTests/Tests/Tests-Prefix.pch | 8 + .../SwaggerClientTests/Tests/Tests.m | 0 .../SwaggerClientTests/Tests/UserApiTest.m | 0 .../Tests/en.lproj/InfoPlist.strings | 2 + .../objc/default/SwaggerClientTests/pom.xml | 65 ++ .../objc/{ => default}/docs/SWGCategory.md | 0 .../objc/{ => default}/docs/SWGOrder.md | 0 .../objc/{ => default}/docs/SWGPet.md | 0 .../objc/{ => default}/docs/SWGPetApi.md | 0 .../objc/{ => default}/docs/SWGStoreApi.md | 0 .../objc/{ => default}/docs/SWGTag.md | 0 .../objc/{ => default}/docs/SWGUser.md | 0 .../objc/{ => default}/docs/SWGUserApi.md | 0 .../client/petstore/objc/default/git_push.sh | 52 ++ .../petstore/objc/docs/SWG200Response.md | 10 - .../objc/docs/SWGAdditionalPropertiesClass.md | 11 - .../client/petstore/objc/docs/SWGAnimal.md | 11 - .../petstore/objc/docs/SWGAnimalFarm.md | 9 - .../petstore/objc/docs/SWGApiResponse.md | 12 - .../client/petstore/objc/docs/SWGArrayTest.md | 12 - samples/client/petstore/objc/docs/SWGCat.md | 12 - samples/client/petstore/objc/docs/SWGDog.md | 12 - .../client/petstore/objc/docs/SWGEnumClass.md | 9 - .../client/petstore/objc/docs/SWGEnumTest.md | 12 - .../client/petstore/objc/docs/SWGFakeApi.md | 100 --- .../petstore/objc/docs/SWGFormatTest.md | 22 - ...dPropertiesAndAdditionalPropertiesClass.md | 12 - samples/client/petstore/objc/docs/SWGName.md | 13 - .../petstore/objc/docs/SWGReadOnlyFirst.md | 11 - .../client/petstore/objc/docs/SWGReturn.md | 10 - .../objc/docs/SWGSpecialModelName_.md | 10 - 196 files changed, 6292 insertions(+), 362 deletions(-) create mode 100755 bin/objc-petstore-coredata.sh delete mode 100644 samples/client/petstore/objc/SwaggerClientTests/SwaggerClient.xcodeproj/project.xcworkspace/xcshareddata/SwaggerClient.xccheckout delete mode 100644 samples/client/petstore/objc/SwaggerClientTests/SwaggerClient.xcodeproj/project.xcworkspace/xcuserdata/geekerzp.xcuserdatad/UserInterfaceState.xcuserstate delete mode 100644 samples/client/petstore/objc/SwaggerClientTests/SwaggerClient.xcodeproj/xcuserdata/geekerzp.xcuserdatad/xcschemes/xcschememanagement.plist rename samples/client/petstore/objc/{ => core-data}/.gitignore (100%) rename samples/client/petstore/objc/{ => core-data}/.swagger-codegen-ignore (100%) rename samples/client/petstore/objc/{ => core-data}/LICENSE (100%) rename samples/client/petstore/objc/{ => core-data}/README.md (99%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClient.podspec (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClient/Api/SWGPetApi.h (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClient/Api/SWGPetApi.m (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClient/Api/SWGStoreApi.h (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClient/Api/SWGStoreApi.m (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClient/Api/SWGUserApi.h (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClient/Api/SWGUserApi.m (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClient/Core/JSONValueTransformer+ISO8601.h (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClient/Core/JSONValueTransformer+ISO8601.m (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClient/Core/SWGApi.h (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClient/Core/SWGApiClient.h (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClient/Core/SWGApiClient.m (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClient/Core/SWGConfiguration.h (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClient/Core/SWGConfiguration.m (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClient/Core/SWGJSONRequestSerializer.h (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClient/Core/SWGJSONRequestSerializer.m (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClient/Core/SWGJSONResponseSerializer.h (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClient/Core/SWGJSONResponseSerializer.m (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClient/Core/SWGLogger.h (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClient/Core/SWGLogger.m (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClient/Core/SWGObject.h (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClient/Core/SWGObject.m (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClient/Core/SWGQueryParamCollection.h (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClient/Core/SWGQueryParamCollection.m (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClient/Core/SWGResponseDeserializer.h (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClient/Core/SWGResponseDeserializer.m (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClient/Core/SWGSanitizer.h (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClient/Core/SWGSanitizer.m (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClient/Model/SWGCategory.h (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClient/Model/SWGCategory.m (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClient/Model/SWGCategoryManagedObject.h (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClient/Model/SWGCategoryManagedObject.m (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClient/Model/SWGCategoryManagedObjectBuilder.h (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClient/Model/SWGCategoryManagedObjectBuilder.m (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClient/Model/SWGModel.xcdatamodeld/.xccurrentversion (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClient/Model/SWGModel.xcdatamodeld/SWGModel.xcdatamodel/contents (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClient/Model/SWGOrder.h (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClient/Model/SWGOrder.m (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClient/Model/SWGOrderManagedObject.h (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClient/Model/SWGOrderManagedObject.m (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClient/Model/SWGOrderManagedObjectBuilder.h (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClient/Model/SWGOrderManagedObjectBuilder.m (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClient/Model/SWGPet.h (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClient/Model/SWGPet.m (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClient/Model/SWGPetManagedObject.h (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClient/Model/SWGPetManagedObject.m (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClient/Model/SWGPetManagedObjectBuilder.h (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClient/Model/SWGPetManagedObjectBuilder.m (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClient/Model/SWGTag.h (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClient/Model/SWGTag.m (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClient/Model/SWGTagManagedObject.h (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClient/Model/SWGTagManagedObject.m (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClient/Model/SWGTagManagedObjectBuilder.h (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClient/Model/SWGTagManagedObjectBuilder.m (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClient/Model/SWGUser.h (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClient/Model/SWGUser.m (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClient/Model/SWGUserManagedObject.h (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClient/Model/SWGUserManagedObject.m (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClient/Model/SWGUserManagedObjectBuilder.h (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClient/Model/SWGUserManagedObjectBuilder.m (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClientTests/Podfile (100%) create mode 100644 samples/client/petstore/objc/core-data/SwaggerClientTests/SwaggerClient.xcodeproj/project.pbxproj rename samples/client/petstore/objc/{ => core-data}/SwaggerClientTests/SwaggerClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata (100%) create mode 100644 samples/client/petstore/objc/core-data/SwaggerClientTests/SwaggerClient.xcodeproj/xcshareddata/xcschemes/All Tests.xcscheme rename samples/client/petstore/objc/{ => core-data}/SwaggerClientTests/SwaggerClient.xcodeproj/xcshareddata/xcschemes/SwaggerClient-Example.xcscheme (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClientTests/SwaggerClient/Images.xcassets/AppIcon.appiconset/Contents.json (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClientTests/SwaggerClient/Images.xcassets/LaunchImage.launchimage/Contents.json (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClientTests/SwaggerClient/Launch Screen.storyboard (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClientTests/SwaggerClient/Main.storyboard (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClientTests/SwaggerClient/SWGAppDelegate.h (100%) create mode 100644 samples/client/petstore/objc/core-data/SwaggerClientTests/SwaggerClient/SWGAppDelegate.m rename samples/client/petstore/objc/{ => core-data}/SwaggerClientTests/SwaggerClient/SWGViewController.h (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClientTests/SwaggerClient/SWGViewController.m (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClientTests/SwaggerClient/SwaggerClient-Info.plist (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClientTests/SwaggerClient/SwaggerClient-Prefix.pch (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClientTests/SwaggerClient/en.lproj/InfoPlist.strings (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClientTests/SwaggerClient/main.m (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClientTests/Tests/BuildersTest.m (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClientTests/Tests/Helpers/DatabaseHelper.h (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClientTests/Tests/Helpers/DatabaseHelper.m (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClientTests/Tests/Tests-Info.plist (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClientTests/Tests/Tests-Prefix.pch (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClientTests/Tests/en.lproj/InfoPlist.strings (100%) rename samples/client/petstore/objc/{ => core-data}/SwaggerClientTests/pom.xml (100%) rename samples/client/petstore/objc/{ => core-data}/git_push.sh (100%) create mode 100644 samples/client/petstore/objc/default/.gitignore create mode 100644 samples/client/petstore/objc/default/.swagger-codegen-ignore create mode 100644 samples/client/petstore/objc/default/LICENSE create mode 100644 samples/client/petstore/objc/default/README.md create mode 100644 samples/client/petstore/objc/default/SwaggerClient.podspec create mode 100644 samples/client/petstore/objc/default/SwaggerClient/Api/SWGPetApi.h create mode 100644 samples/client/petstore/objc/default/SwaggerClient/Api/SWGPetApi.m create mode 100644 samples/client/petstore/objc/default/SwaggerClient/Api/SWGStoreApi.h create mode 100644 samples/client/petstore/objc/default/SwaggerClient/Api/SWGStoreApi.m create mode 100644 samples/client/petstore/objc/default/SwaggerClient/Api/SWGUserApi.h create mode 100644 samples/client/petstore/objc/default/SwaggerClient/Api/SWGUserApi.m create mode 100644 samples/client/petstore/objc/default/SwaggerClient/Core/JSONValueTransformer+ISO8601.h create mode 100644 samples/client/petstore/objc/default/SwaggerClient/Core/JSONValueTransformer+ISO8601.m create mode 100644 samples/client/petstore/objc/default/SwaggerClient/Core/SWGApi.h create mode 100644 samples/client/petstore/objc/default/SwaggerClient/Core/SWGApiClient.h create mode 100644 samples/client/petstore/objc/default/SwaggerClient/Core/SWGApiClient.m create mode 100644 samples/client/petstore/objc/default/SwaggerClient/Core/SWGConfiguration.h create mode 100644 samples/client/petstore/objc/default/SwaggerClient/Core/SWGConfiguration.m create mode 100644 samples/client/petstore/objc/default/SwaggerClient/Core/SWGJSONRequestSerializer.h create mode 100644 samples/client/petstore/objc/default/SwaggerClient/Core/SWGJSONRequestSerializer.m create mode 100644 samples/client/petstore/objc/default/SwaggerClient/Core/SWGJSONResponseSerializer.h create mode 100644 samples/client/petstore/objc/default/SwaggerClient/Core/SWGJSONResponseSerializer.m create mode 100644 samples/client/petstore/objc/default/SwaggerClient/Core/SWGLogger.h create mode 100644 samples/client/petstore/objc/default/SwaggerClient/Core/SWGLogger.m create mode 100644 samples/client/petstore/objc/default/SwaggerClient/Core/SWGObject.h create mode 100644 samples/client/petstore/objc/default/SwaggerClient/Core/SWGObject.m create mode 100644 samples/client/petstore/objc/default/SwaggerClient/Core/SWGQueryParamCollection.h create mode 100644 samples/client/petstore/objc/default/SwaggerClient/Core/SWGQueryParamCollection.m create mode 100644 samples/client/petstore/objc/default/SwaggerClient/Core/SWGResponseDeserializer.h create mode 100644 samples/client/petstore/objc/default/SwaggerClient/Core/SWGResponseDeserializer.m create mode 100644 samples/client/petstore/objc/default/SwaggerClient/Core/SWGSanitizer.h create mode 100644 samples/client/petstore/objc/default/SwaggerClient/Core/SWGSanitizer.m create mode 100644 samples/client/petstore/objc/default/SwaggerClient/Model/SWGCategory.h create mode 100644 samples/client/petstore/objc/default/SwaggerClient/Model/SWGCategory.m create mode 100644 samples/client/petstore/objc/default/SwaggerClient/Model/SWGOrder.h create mode 100644 samples/client/petstore/objc/default/SwaggerClient/Model/SWGOrder.m create mode 100644 samples/client/petstore/objc/default/SwaggerClient/Model/SWGPet.h create mode 100644 samples/client/petstore/objc/default/SwaggerClient/Model/SWGPet.m create mode 100644 samples/client/petstore/objc/default/SwaggerClient/Model/SWGTag.h create mode 100644 samples/client/petstore/objc/default/SwaggerClient/Model/SWGTag.m create mode 100644 samples/client/petstore/objc/default/SwaggerClient/Model/SWGUser.h create mode 100644 samples/client/petstore/objc/default/SwaggerClient/Model/SWGUser.m create mode 100644 samples/client/petstore/objc/default/SwaggerClientTests/Podfile rename samples/client/petstore/objc/{ => default}/SwaggerClientTests/SwaggerClient.xcodeproj/project.pbxproj (98%) create mode 100644 samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient.xcodeproj/xcshareddata/xcschemes/All Tests.xcscheme create mode 100644 samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient.xcodeproj/xcshareddata/xcschemes/SwaggerClient-Example.xcscheme create mode 100644 samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient/Images.xcassets/AppIcon.appiconset/Contents.json create mode 100644 samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient/Images.xcassets/LaunchImage.launchimage/Contents.json create mode 100644 samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient/Launch Screen.storyboard create mode 100644 samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient/Main.storyboard create mode 100644 samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient/SWGAppDelegate.h rename samples/client/petstore/objc/{ => default}/SwaggerClientTests/SwaggerClient/SWGAppDelegate.m (100%) create mode 100644 samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient/SWGViewController.h create mode 100644 samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient/SWGViewController.m create mode 100644 samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient/SwaggerClient-Info.plist create mode 100644 samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient/SwaggerClient-Prefix.pch create mode 100644 samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient/en.lproj/InfoPlist.strings create mode 100644 samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient/main.m rename samples/client/petstore/objc/{ => default}/SwaggerClientTests/Tests/DeserializationTest.m (100%) create mode 100644 samples/client/petstore/objc/default/SwaggerClientTests/Tests/Helpers/DatabaseHelper.h create mode 100644 samples/client/petstore/objc/default/SwaggerClientTests/Tests/Helpers/DatabaseHelper.m rename samples/client/petstore/objc/{ => default}/SwaggerClientTests/Tests/PetApiTest.m (100%) rename samples/client/petstore/objc/{ => default}/SwaggerClientTests/Tests/PetTest.m (100%) rename samples/client/petstore/objc/{ => default}/SwaggerClientTests/Tests/SWGApiClientTest.m (100%) rename samples/client/petstore/objc/{ => default}/SwaggerClientTests/Tests/StoreApiTest.m (100%) create mode 100644 samples/client/petstore/objc/default/SwaggerClientTests/Tests/Tests-Info.plist create mode 100644 samples/client/petstore/objc/default/SwaggerClientTests/Tests/Tests-Prefix.pch rename samples/client/petstore/objc/{ => default}/SwaggerClientTests/Tests/Tests.m (100%) rename samples/client/petstore/objc/{ => default}/SwaggerClientTests/Tests/UserApiTest.m (100%) create mode 100644 samples/client/petstore/objc/default/SwaggerClientTests/Tests/en.lproj/InfoPlist.strings create mode 100644 samples/client/petstore/objc/default/SwaggerClientTests/pom.xml rename samples/client/petstore/objc/{ => default}/docs/SWGCategory.md (100%) rename samples/client/petstore/objc/{ => default}/docs/SWGOrder.md (100%) rename samples/client/petstore/objc/{ => default}/docs/SWGPet.md (100%) rename samples/client/petstore/objc/{ => default}/docs/SWGPetApi.md (100%) rename samples/client/petstore/objc/{ => default}/docs/SWGStoreApi.md (100%) rename samples/client/petstore/objc/{ => default}/docs/SWGTag.md (100%) rename samples/client/petstore/objc/{ => default}/docs/SWGUser.md (100%) rename samples/client/petstore/objc/{ => default}/docs/SWGUserApi.md (100%) create mode 100644 samples/client/petstore/objc/default/git_push.sh delete mode 100644 samples/client/petstore/objc/docs/SWG200Response.md delete mode 100644 samples/client/petstore/objc/docs/SWGAdditionalPropertiesClass.md delete mode 100644 samples/client/petstore/objc/docs/SWGAnimal.md delete mode 100644 samples/client/petstore/objc/docs/SWGAnimalFarm.md delete mode 100644 samples/client/petstore/objc/docs/SWGApiResponse.md delete mode 100644 samples/client/petstore/objc/docs/SWGArrayTest.md delete mode 100644 samples/client/petstore/objc/docs/SWGCat.md delete mode 100644 samples/client/petstore/objc/docs/SWGDog.md delete mode 100644 samples/client/petstore/objc/docs/SWGEnumClass.md delete mode 100644 samples/client/petstore/objc/docs/SWGEnumTest.md delete mode 100644 samples/client/petstore/objc/docs/SWGFakeApi.md delete mode 100644 samples/client/petstore/objc/docs/SWGFormatTest.md delete mode 100644 samples/client/petstore/objc/docs/SWGMixedPropertiesAndAdditionalPropertiesClass.md delete mode 100644 samples/client/petstore/objc/docs/SWGName.md delete mode 100644 samples/client/petstore/objc/docs/SWGReadOnlyFirst.md delete mode 100644 samples/client/petstore/objc/docs/SWGReturn.md delete mode 100644 samples/client/petstore/objc/docs/SWGSpecialModelName_.md diff --git a/.gitignore b/.gitignore index 3118eafbcfd..6384cec8fc8 100644 --- a/.gitignore +++ b/.gitignore @@ -80,12 +80,17 @@ samples/client/petstore/silex/SwaggerServer/venodr/ samples/client/petstore/perl/deep_module_test/ # Objc -samples/client/petstore/objc/PetstoreClient.xcworkspace/xcuserdata -samples/client/petstore/objc/SwaggerClientTests/SwaggerClient.xcodeproj/xcuserdata -samples/client/petstore/objc/SwaggerClientTests/Build -samples/client/petstore/objc/SwaggerClientTests/Pods -samples/client/petstore/objc/SwaggerClientTests/SwaggerClient.xcworkspace -samples/client/petstore/objc/SwaggerClientTests/Podfile.lock +samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient.xcodeproj/xcuserdata +samples/client/petstore/objc/default/SwaggerClientTests/Build +samples/client/petstore/objc/default/SwaggerClientTests/Pods +samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient.xcworkspace +samples/client/petstore/objc/default/SwaggerClientTests/Podfile.lock + +samples/client/petstore/objc/core-data/SwaggerClientTests/SwaggerClient.xcodeproj/xcuserdata +samples/client/petstore/objc/core-data/SwaggerClientTests/Build +samples/client/petstore/objc/core-data/SwaggerClientTests/Pods +samples/client/petstore/objc/core-data/SwaggerClientTests/SwaggerClient.xcworkspace +samples/client/petstore/objc/core-data/SwaggerClientTests/Podfile.lock # Swift samples/client/petstore/swift/SwaggerClientTests/SwaggerClient.xcodeproj/xcuserdata diff --git a/bin/objc-petstore-coredata.sh b/bin/objc-petstore-coredata.sh new file mode 100755 index 00000000000..8487adfc42b --- /dev/null +++ b/bin/objc-petstore-coredata.sh @@ -0,0 +1,31 @@ +#!/bin/sh + +SCRIPT="$0" + +while [ -h "$SCRIPT" ] ; do + ls=`ls -ld "$SCRIPT"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + SCRIPT="$link" + else + SCRIPT=`dirname "$SCRIPT"`/"$link" + fi +done + +if [ ! -d "${APP_DIR}" ]; then + APP_DIR=`dirname "$SCRIPT"`/.. + APP_DIR=`cd "${APP_DIR}"; pwd` +fi + +executable="./modules/swagger-codegen-cli/target/swagger-codegen-cli.jar" + +if [ ! -f "$executable" ] +then + mvn clean package +fi + +# if you've executed sbt assembly previously it will use that instead. +export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" +ags="$@ generate -t modules/swagger-codegen/src/main/resources/objc -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l objc -DapiDocs=false,modelDocs=false -o samples/client/petstore/objc/core-data --additional-properties coreData=true" + +java -DappName=PetstoreClient $JAVA_OPTS -jar $executable $ags diff --git a/bin/objc-petstore.sh b/bin/objc-petstore.sh index df22ea3b595..71480ff1595 100755 --- a/bin/objc-petstore.sh +++ b/bin/objc-petstore.sh @@ -26,6 +26,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -t modules/swagger-codegen/src/main/resources/objc -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l objc -o samples/client/petstore/objc --additional-properties coreData=true" +ags="$@ generate -t modules/swagger-codegen/src/main/resources/objc -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l objc -o samples/client/petstore/objc/default" java -DappName=PetstoreClient $JAVA_OPTS -jar $executable $ags diff --git a/bin/windows/objc-petstore.bat b/bin/windows/objc-petstore.bat index a26b0dad566..9e64a80ac00 100755 --- a/bin/windows/objc-petstore.bat +++ b/bin/windows/objc-petstore.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) set JAVA_OPTS=%JAVA_OPTS% -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties -set ags=generate -t modules\swagger-codegen\src\main\resources\objc -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l objc -o samples\client\petstore\objc +set ags=generate -t modules\swagger-codegen\src\main\resources\objc -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l objc -o samples\client\petstore\objc\default java %JAVA_OPTS% -DappName=PetstoreClient -jar %executable% %ags% diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultGenerator.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultGenerator.java index 6a489e45e52..67a1a11f32f 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultGenerator.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultGenerator.java @@ -82,12 +82,14 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { } if(System.getProperty("modelDocs") != null) { generateModelDocumentation = Boolean.valueOf(System.getProperty("modelDocs")); + LOGGER.error("AAAAAAAAAAAAAAAA generateModelDocumentation "+generateModelDocumentation); } if(System.getProperty("apiTests") != null) { generateApiTests = Boolean.valueOf(System.getProperty("apiTests")); } if(System.getProperty("apiDocs") != null) { generateApiDocumentation = Boolean.valueOf(System.getProperty("apiDocs")); + LOGGER.error("AAAAAAAAAAAAAAAA generateApiDocumentation "+generateApiDocumentation); } if(generateApis == null && generateModels == null && generateSupportingFiles == null) { diff --git a/pom.xml b/pom.xml index 40ebc9bb85f..195d49aa889 100644 --- a/pom.xml +++ b/pom.xml @@ -399,7 +399,7 @@ - samples/client/petstore/objc/SwaggerClientTests + samples/client/petstore/objc/default/SwaggerClientTests diff --git a/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient.xcodeproj/project.xcworkspace/xcshareddata/SwaggerClient.xccheckout b/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient.xcodeproj/project.xcworkspace/xcshareddata/SwaggerClient.xccheckout deleted file mode 100644 index 879945048b3..00000000000 --- a/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient.xcodeproj/project.xcworkspace/xcshareddata/SwaggerClient.xccheckout +++ /dev/null @@ -1,41 +0,0 @@ - - - - - IDESourceControlProjectFavoriteDictionaryKey - - IDESourceControlProjectIdentifier - 303FE0A9-4715-4C57-8D01-F604EF82CF6D - IDESourceControlProjectName - SwaggerClient - IDESourceControlProjectOriginsDictionary - - E5BBF0AA85077C865C95437976D06D819733A208 - https://github.com/geekerzp/swagger-codegen.git - - IDESourceControlProjectPath - samples/client/petstore/objc/SwaggerClientTests/SwaggerClient.xcodeproj - IDESourceControlProjectRelativeInstallPathDictionary - - E5BBF0AA85077C865C95437976D06D819733A208 - ../../../../../../.. - - IDESourceControlProjectURL - https://github.com/geekerzp/swagger-codegen.git - IDESourceControlProjectVersion - 111 - IDESourceControlProjectWCCIdentifier - E5BBF0AA85077C865C95437976D06D819733A208 - IDESourceControlProjectWCConfigurations - - - IDESourceControlRepositoryExtensionIdentifierKey - public.vcs.git - IDESourceControlWCCIdentifierKey - E5BBF0AA85077C865C95437976D06D819733A208 - IDESourceControlWCCName - swagger-codegen - - - - diff --git a/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient.xcodeproj/project.xcworkspace/xcuserdata/geekerzp.xcuserdatad/UserInterfaceState.xcuserstate b/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient.xcodeproj/project.xcworkspace/xcuserdata/geekerzp.xcuserdatad/UserInterfaceState.xcuserstate deleted file mode 100644 index 4b91a2c5500b646d6c7a7c36003140c402ade1a7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12123 zcmd6NcYKr8_x~Mf(lqNy+Gey(lcrOobkNQ01Oy6nL0K_vpO#3Q)FcHepf{)>E<{B| zL1>F0H~{w+_d*d6L7a$yxDZ^ZsNeJCNm_#F$Nzr6_SGiObJw}&p7TEMbMI~HY$()5yHkho()C-l zI33AQB#K5cC>Euo40Hh+gf2vbQ6?IKvd~aej3%MUXbP%9wWto&qXsk;O+$@nI+}qT zs0pJ6}S?Q$5ZfBJPXgpE%*}b!Ct%&FTz*htMO9246ns^<8^pF?!mpd z4{yNt;Enix`~ZF!KZ2jb&*L5V1^f!$j}PDv@Im|`{s@1JKf#~kukkndTl^h9fxpKm z@hN-;|3N5`lPIDlIucC`#7Gi|nIw@^l19==CdnpwB%hR$GEz<|NF|vm8M>dh|@PUldVHTK^cuRHuB3O-HFPb#o35klX%D@R z-cKK(57H;-lk_S2G<}7>N?)UI(OvXY`WZb$Kc|Q37xYW|HT{NuOHbCPxVqZg_aZrp zLJFir8l;AjHZtm*fUB1x3 zdX$LLHX#EtA`^;3@hAbASp<_Z8H;3c7R3~skOf&$5=dY|DJYdGnTlyZ78#3Ug)C#X z(7V&s;+|jSadhx@E(u;t^0e?CzNLTEI!9Bv+vW4P+uOm}?A*w+MG7mlXP0GX=T{Y1 zWfm3`=flJb@-s`TDhe_Svnz6{D$A-0D)NWgxxr_5APzq;K)uU(X%|1P1*Yk2b@CoN zXMyUa%|7ty^NVEXOhSi&Y1Fyh?M)8PIB$c~>uhR=85sx498G26MGF^ZW)HUJ=PVv< zU6@mx3*U3HvkMk4-V<2XY?RxBOrR?D9+ZdjQ2{EPF0QBxbTv)<%6nnqOFbS(cP~^Z znpRyqDF8&FB`QG`C~Y$uhK8dNXe1hiMx#RAteQu9;f}`8r<+F1fOtp57 zdw#WJp0mvXB{Sd!EYJi;6W?yV3|3r?0!z!#ipLYJCk(e!kdUe^)}; zIV%^|MFsD5wze&gkeww8y3kfM)b)!z&c}Cn#kFfjt-YuP@yx7JR5{W_4|a6U@@> za(H0zeW)lj%zSj&Im0Z1VbWMi@@Tj9tWFs6&#tbW*yVG8r3P%M4>7@t#4)Z!SAjnI zD+~5roGU_Mr{%ee4F9JH@(NB{ z>G8NdU@1P{<8-xEx&$S)2nG~%?HUjmB!?H}fJ}}~FW(~Al`tEj^@2`^tA%e7XDBoi z4AEQGUDw?Ss1Pf>2%9tX9&Fm*olq6t3FrcY0U(_#jh)j$S%3X89(Px#HxfX5;X=TY zYynns^NR;ti;8kXpz;WMbUiB(7x;1X1Q=0p{cCw&A9@@;iHhp0YvDn(n}YGZj^1FS*yvvL7TU>5Ss6>IakkX>x?$?I z^Brw%yr;a~2~)CHE^u^ow)0ckLd&@qy&u-Wesq9Uut_W>RN+JP8A{uLK0+U(Ptd2V zl2x%WZ0rVf2z`zYqc7MvHi1oK)dBZx2}Z05?q-MJD&9tKSCcbfb#*>a?~GQ6qZ4_r z*U`p{v-(;<-EY`MOnnfYK;NU2=oI<^X8$Al3H^+IL8sBL@H-8De}m7!(~Qt4^)(Yf z`2dX`AD9fROIL@hx~ro}h$1@P)$+HO+U7Y9j{^+fQ{!;8@e_C#z+QV$)=C#R4K#sQ zV%rH$7cX|#=yP`PFiuA&bQ~IQpcqW>oQ~bi3`PGH{9)r+5Jvt$f7&?%fK460z!!?{ zAzk&Mzc4~Y|6Bpk0h*rMETBeAQ0sb@4#r#B39D+Ml4;l+r<5-lo5o<7qwOEH%;TTrS>R3H%0C1SP5$jPZHo{*Vj%U-r{q6AQU`>MY z2-K(FjRk10^YB56BD!N}=6`offnoGRSy&%se5>2T_qPzcOn~aOuOu%~H*2D0KetAZ+i~Btmm*O&% zwtjs;spmjbaZb+S#i8M=@Ywzi##MsW!ffySS(TC@U)hx%|%*fh>nyWqwtGO7nvuk2MUcy|=Ev&0Rt@>GvKvw#P zv2)#7^y_X-+*t#EAUNtCG#*Z^RX^AkIiQbSU0;2A~3!c z$Ymv}#CPD;_)dHmINU-YmnQh#%${M-vR4E<;e>Em!8dgYp+Y2odeDK$)+WM)?BFe~ z7Kf)rAaO!vu?XC@K}^ZT=i08O4yZl-tcF}Pw5Z@)9bN6dzzAaZ*5IqjLUXSVVp9#@ z>EXTbMGPH)sv&{;Dc|(=0QWuHD>vcIg5}-I7WLpQY_TwzRB`kmPyVL?LI(37-X?Ug zm0jM0x3eo)M%_e*(-kUx6hDb{efTl_IDUdL=4VU#@Kd18XV{gX!A*j(To5*#fGT_~ zP;ysW;A=mR13nDVIJ|BUWzKy+hIe=HK2Nvk6)!@F#4oX{m^viXtN0yA1o3P5b^Hc? z6TgLb;W7o4A*ece?TG$)Y;Y4?raWb(vbRPHfMU>U7qHC@cj%QLAnk25dIt=#$T`-*$Q?OTe$%r#mB(L zkF%TEEnwNV3hQB<>~VGgNe_)sHxRs2&M69V%knT~_}6Zeu1pm(@?^!axMxeU-~*dh+7H{3saNs7?j zf380>a~`C;70#9kZbyrqOY1ioA!igJA!KAjY6HGl4#>WjWFQ5(0G%cm5|gkA*5vT= zGvL$1w*zj^;~8Qb*?Mv6Lr4~6H{jvDWQdUFLRv#|0L@4)yO*f}^#<5UPF^;+O>us9 zKRqD@WEdnKq>vPmVp77ku>08k?12qrI2i%PF^WCN9s%=sjAcxlz_$iAF&b-}ZF2(O zriap9#wY_Dy03mK?2tT52r?SXjcZT2`jg(njX6C)iW{M2pNNVMGhG-wB$3QlL*)htVhEBVj}fR;e3S=;=Vs17{O0vY1>h z^3jk)esX2ML|3urLJ}<#B)WzyXV0@22PC?ltT>ydk(2k}LKKMy2_0QuDbAn*K7fE+e?vJ0la6|(x% zXd2rEGQTV2$O1mRC*Z?9pe=D5mK-1-*tv9A>i(z|whq;4w28vVe$nzLXMJSS@>vMK;PWwMkebZxbUR%> zZ(z$Ds3$;qT##Ceb{ODw-YT~Ta2Qa=AR0f!WpN9=jGqH!)$N%n?zz`C&*6oWff(_z zrppBw1=}kD+p=@n6C7S&xm(ymf}sYewb-l-VnIuwA#5*0bOMBf961z4#PL7`qnOW& z;)P0s(!u^k6oNJ=f!E7)Ii$D)5syX(qT8YW54c50Ts@74==C>VOcSUXrBVw! z%)S6yIl?l6{Iur!23cASX0HHq8|V$YEdg(4p*WVR=j; zHXT}r5E&MC_Gux&0WD(RF!erx;n88}1RYLC0B&rjnG{aUI6koTTjz1O#8}!0Cqw)K zfk3kp3`Mdp*|&RXIjsO}(a}m;CFC)+K~CzM1ABmN0jho0yFftaWbC^DKG3mr91xuT z7QOT$RCM+WvDO4S5kfei$XPZOnoA$8rjrEd_=ocIlfaPHrqEj0rlB?LWDl)lr{MSk zMiH_vkzSv>#hV%2I0`jyq|HdTnNFuO=uA3`&Zc&HF?G-;_9Od={mg!0r`fOUH}*R_ zvzfNQUI9Q3okN}U5;_;y&mRCk0^0n^{_Hf>0~I4n#N~Z1ux|L;p*$!zxFI zvt8KGKDz^f=d=sF6m)y``*B`Ch-MFf6!hZkoa1(Z1RY&KQQe-RA$f4B*)q@95)d@= zoZ^z9x#hXJIi;nUMHTsA(Zxl@nZymNFbLgWw9ua%~sv z(|WqaRj%dRgri^qJ^$8ZQfFYVT{N%o-s+sbc9B8SYfbaiky1{Wz+R-cIkJtNmEv$4Wm|38JU{O^z^0A!!Cy zBAh^6`0o|V9L;lUdEh<5+Q4qgztRrdaFCx`2#@^s$vbe7^RN&`0TGejM$`F@78?wCBVQYD%pC z%OjtmJI>eT3-m?$k{=uV*yzW=>61r&A2z=|^mU}5Z_qb|w5tU+ZzgHUB~78bGMG?F zgml>O|8_^_0a>Jmi;GW4Nxd*9uP}JOK^~=0s?>0%9aOS-Y}3cfh_Qxs}Q|0u}s1udJRUnogin5hU(fXV6-4OoYJ^G@0k-VQPw0| zGQ6*KUdF?atyS%gHZMF2z?M8ZO`N$_#R-=ifC3L0%eT+tea>b_HQ&VpCz(4A7_z4o zu1RE;x!YUzq@`zEaK7{U;LyDpg9Z-k2WLhN$;yV*v}Q~hOfMi)t#IR_D#w~_%|;w% zQP5%T(2&5rxr5+2zaab&IA3^KR164nmWo)9h|zZhV$07Xg%tML)DFN z3F%QdEPMqn9qoe?xEGocdUS*(LA_iRRs5}#=$MCiF6VL`a$dAu2mzj zg6rwq^o%4?QX;9BbV|A@k)J(4Ywhb22CdnNlM`z0SpK9qbc`BZX9 za#(Uia$546h-DFvMZ6JlAmV7mml4M!{*o%C z8mU$qBh^cd(!tVvX^C{Wbfk2&bfUCIS|@Fg&XCTM+NBPuTe?JgrSy8~Drv8Dlk^ek zlhUW9&q`mEzASxJ`nq(t^q};(^n2;AGL1|xOO_3i4VDd&Wy=a>#j;_t5wcM-yUZ)Q zP1YxSO!kEADcLi!=VUu%FUnq)y()WM_Mz-!*{8BYvcs|?vSYI2vae;|%1%T^MVcZr zBTFMEN6v{{6nRJF1Cb9#z7qLPMSd6gW8@!^f69?uE?3Ica!ziNC(5mI zn>Yzt9-lsVfmx-$K`Ly_sI{+kIGNTPsx9j{~TqBx-hCNYHHNnsLP{PM%@*)E$Zc{ zSEF`C?T*?T^-!C=jB1?fVpWH# zQ{_>0sphM?RZCUNRoAI*RNbVyS+!2ptJdVzkeT#aH#;8fv6lqE{!!;u{qcvrk3Qd(}tmY!kER9{`&@^j! zO`FE4nXBp0xHXq*uF|a4+^2a_^S0(NC*|U}R4$jx=L)$JZa6oRYvsJ$JZ=HEkXy`M z!Cl3zowoG+l;nkZ!0hUstFr z)(z8*&`r}_p}Rr%sO~x4Yr1!JM|7v7Wzlib1<^&(CDFs9M@Em1_Czm?UJ`v(^wQ{S zqOXmSOf=y-6RhH|x{%8Tvu`!TKTkY<;o5Twkqk)qC}e^q1?Ieu@4n{SEpR`jz@y z^sDr@>mSwc(f?#n8w>`cAI_p2jfRMr0&LiBW2dHX4m_#sp)MG1-`EOgH8jON?WT6O7fy$;Nu)RAZxYhOxsq z&$!IE#`u_Vw{fp=pK-tO1LG;@Fr760VEW1Q zOB{-$aS?H{I4-UvZd9Bz&J%Y>+}gO8;@*ur5_c@_c-+@<-^QJYI~n&w+)r`8#Qhqt zj_2Za@iFoGcw>Bgd}4f3d~$qhe0u!I_!;qC@k`=Y$M1~)B>vZg=!8KDg$ctGMkb6- zs7x4>FfL(yLRZ3)gsT&lC0v_ueZq|icO|S%SeMXaPBG`0OU%Q~Bh91DW#;kbiRMY> zDdt*py?M5|&D?2TY-Z*q=Bv%i%*)NUneQ;)XrQPDPbXq(XpJkq9f#o{O4VD#_m6ls9t1P!$?zF76 zth4l3?z22**=70Aa>^>RCRp>V6Rl0wKI<0icI(sD*R8v(d#wAc2dtl3KeryS9_)RNSebV*W2QfHDksViwo((6P8e5}nrp<0^vN>(-Hn+`V^Vt^LuCQHgyV$+BcF*^q2a&Pcs2b#-cQ>bBI!Q=dzHEA>F?hpC^W z9!mWp^;qgxslTNDmU<@juQZY-Nt32Ure&tpq%BI@n6@?TiL@PQZ=~%^+n4rH+M#rk pE=gCVbLqPDm~?ZxEj=Y2$ZvW{`l$5EAc-U5C;csq!=dys{|Cyq^yvTq diff --git a/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient.xcodeproj/xcuserdata/geekerzp.xcuserdatad/xcschemes/xcschememanagement.plist b/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient.xcodeproj/xcuserdata/geekerzp.xcuserdatad/xcschemes/xcschememanagement.plist deleted file mode 100644 index adfa137d3e3..00000000000 --- a/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient.xcodeproj/xcuserdata/geekerzp.xcuserdatad/xcschemes/xcschememanagement.plist +++ /dev/null @@ -1,19 +0,0 @@ - - - - - SuppressBuildableAutocreation - - 6003F589195388D20070C39A - - primary - - - 6003F5AD195388D20070C39A - - primary - - - - - diff --git a/samples/client/petstore/objc/.gitignore b/samples/client/petstore/objc/core-data/.gitignore similarity index 100% rename from samples/client/petstore/objc/.gitignore rename to samples/client/petstore/objc/core-data/.gitignore diff --git a/samples/client/petstore/objc/.swagger-codegen-ignore b/samples/client/petstore/objc/core-data/.swagger-codegen-ignore similarity index 100% rename from samples/client/petstore/objc/.swagger-codegen-ignore rename to samples/client/petstore/objc/core-data/.swagger-codegen-ignore diff --git a/samples/client/petstore/objc/LICENSE b/samples/client/petstore/objc/core-data/LICENSE similarity index 100% rename from samples/client/petstore/objc/LICENSE rename to samples/client/petstore/objc/core-data/LICENSE diff --git a/samples/client/petstore/objc/README.md b/samples/client/petstore/objc/core-data/README.md similarity index 99% rename from samples/client/petstore/objc/README.md rename to samples/client/petstore/objc/core-data/README.md index dbaa3b6af1c..151ffe96225 100644 --- a/samples/client/petstore/objc/README.md +++ b/samples/client/petstore/objc/core-data/README.md @@ -6,7 +6,7 @@ This ObjC package is automatically generated by the [Swagger Codegen](https://gi - API version: 1.0.0 - Package version: -- Build date: 2016-06-13T18:11:50.695+02:00 +- Build date: 2016-06-16T11:33:34.619+02:00 - Build package: class io.swagger.codegen.languages.ObjcClientCodegen ## Requirements diff --git a/samples/client/petstore/objc/SwaggerClient.podspec b/samples/client/petstore/objc/core-data/SwaggerClient.podspec similarity index 100% rename from samples/client/petstore/objc/SwaggerClient.podspec rename to samples/client/petstore/objc/core-data/SwaggerClient.podspec diff --git a/samples/client/petstore/objc/SwaggerClient/Api/SWGPetApi.h b/samples/client/petstore/objc/core-data/SwaggerClient/Api/SWGPetApi.h similarity index 100% rename from samples/client/petstore/objc/SwaggerClient/Api/SWGPetApi.h rename to samples/client/petstore/objc/core-data/SwaggerClient/Api/SWGPetApi.h diff --git a/samples/client/petstore/objc/SwaggerClient/Api/SWGPetApi.m b/samples/client/petstore/objc/core-data/SwaggerClient/Api/SWGPetApi.m similarity index 100% rename from samples/client/petstore/objc/SwaggerClient/Api/SWGPetApi.m rename to samples/client/petstore/objc/core-data/SwaggerClient/Api/SWGPetApi.m diff --git a/samples/client/petstore/objc/SwaggerClient/Api/SWGStoreApi.h b/samples/client/petstore/objc/core-data/SwaggerClient/Api/SWGStoreApi.h similarity index 100% rename from samples/client/petstore/objc/SwaggerClient/Api/SWGStoreApi.h rename to samples/client/petstore/objc/core-data/SwaggerClient/Api/SWGStoreApi.h diff --git a/samples/client/petstore/objc/SwaggerClient/Api/SWGStoreApi.m b/samples/client/petstore/objc/core-data/SwaggerClient/Api/SWGStoreApi.m similarity index 100% rename from samples/client/petstore/objc/SwaggerClient/Api/SWGStoreApi.m rename to samples/client/petstore/objc/core-data/SwaggerClient/Api/SWGStoreApi.m diff --git a/samples/client/petstore/objc/SwaggerClient/Api/SWGUserApi.h b/samples/client/petstore/objc/core-data/SwaggerClient/Api/SWGUserApi.h similarity index 100% rename from samples/client/petstore/objc/SwaggerClient/Api/SWGUserApi.h rename to samples/client/petstore/objc/core-data/SwaggerClient/Api/SWGUserApi.h diff --git a/samples/client/petstore/objc/SwaggerClient/Api/SWGUserApi.m b/samples/client/petstore/objc/core-data/SwaggerClient/Api/SWGUserApi.m similarity index 100% rename from samples/client/petstore/objc/SwaggerClient/Api/SWGUserApi.m rename to samples/client/petstore/objc/core-data/SwaggerClient/Api/SWGUserApi.m diff --git a/samples/client/petstore/objc/SwaggerClient/Core/JSONValueTransformer+ISO8601.h b/samples/client/petstore/objc/core-data/SwaggerClient/Core/JSONValueTransformer+ISO8601.h similarity index 100% rename from samples/client/petstore/objc/SwaggerClient/Core/JSONValueTransformer+ISO8601.h rename to samples/client/petstore/objc/core-data/SwaggerClient/Core/JSONValueTransformer+ISO8601.h diff --git a/samples/client/petstore/objc/SwaggerClient/Core/JSONValueTransformer+ISO8601.m b/samples/client/petstore/objc/core-data/SwaggerClient/Core/JSONValueTransformer+ISO8601.m similarity index 100% rename from samples/client/petstore/objc/SwaggerClient/Core/JSONValueTransformer+ISO8601.m rename to samples/client/petstore/objc/core-data/SwaggerClient/Core/JSONValueTransformer+ISO8601.m diff --git a/samples/client/petstore/objc/SwaggerClient/Core/SWGApi.h b/samples/client/petstore/objc/core-data/SwaggerClient/Core/SWGApi.h similarity index 100% rename from samples/client/petstore/objc/SwaggerClient/Core/SWGApi.h rename to samples/client/petstore/objc/core-data/SwaggerClient/Core/SWGApi.h diff --git a/samples/client/petstore/objc/SwaggerClient/Core/SWGApiClient.h b/samples/client/petstore/objc/core-data/SwaggerClient/Core/SWGApiClient.h similarity index 100% rename from samples/client/petstore/objc/SwaggerClient/Core/SWGApiClient.h rename to samples/client/petstore/objc/core-data/SwaggerClient/Core/SWGApiClient.h diff --git a/samples/client/petstore/objc/SwaggerClient/Core/SWGApiClient.m b/samples/client/petstore/objc/core-data/SwaggerClient/Core/SWGApiClient.m similarity index 100% rename from samples/client/petstore/objc/SwaggerClient/Core/SWGApiClient.m rename to samples/client/petstore/objc/core-data/SwaggerClient/Core/SWGApiClient.m diff --git a/samples/client/petstore/objc/SwaggerClient/Core/SWGConfiguration.h b/samples/client/petstore/objc/core-data/SwaggerClient/Core/SWGConfiguration.h similarity index 100% rename from samples/client/petstore/objc/SwaggerClient/Core/SWGConfiguration.h rename to samples/client/petstore/objc/core-data/SwaggerClient/Core/SWGConfiguration.h diff --git a/samples/client/petstore/objc/SwaggerClient/Core/SWGConfiguration.m b/samples/client/petstore/objc/core-data/SwaggerClient/Core/SWGConfiguration.m similarity index 100% rename from samples/client/petstore/objc/SwaggerClient/Core/SWGConfiguration.m rename to samples/client/petstore/objc/core-data/SwaggerClient/Core/SWGConfiguration.m diff --git a/samples/client/petstore/objc/SwaggerClient/Core/SWGJSONRequestSerializer.h b/samples/client/petstore/objc/core-data/SwaggerClient/Core/SWGJSONRequestSerializer.h similarity index 100% rename from samples/client/petstore/objc/SwaggerClient/Core/SWGJSONRequestSerializer.h rename to samples/client/petstore/objc/core-data/SwaggerClient/Core/SWGJSONRequestSerializer.h diff --git a/samples/client/petstore/objc/SwaggerClient/Core/SWGJSONRequestSerializer.m b/samples/client/petstore/objc/core-data/SwaggerClient/Core/SWGJSONRequestSerializer.m similarity index 100% rename from samples/client/petstore/objc/SwaggerClient/Core/SWGJSONRequestSerializer.m rename to samples/client/petstore/objc/core-data/SwaggerClient/Core/SWGJSONRequestSerializer.m diff --git a/samples/client/petstore/objc/SwaggerClient/Core/SWGJSONResponseSerializer.h b/samples/client/petstore/objc/core-data/SwaggerClient/Core/SWGJSONResponseSerializer.h similarity index 100% rename from samples/client/petstore/objc/SwaggerClient/Core/SWGJSONResponseSerializer.h rename to samples/client/petstore/objc/core-data/SwaggerClient/Core/SWGJSONResponseSerializer.h diff --git a/samples/client/petstore/objc/SwaggerClient/Core/SWGJSONResponseSerializer.m b/samples/client/petstore/objc/core-data/SwaggerClient/Core/SWGJSONResponseSerializer.m similarity index 100% rename from samples/client/petstore/objc/SwaggerClient/Core/SWGJSONResponseSerializer.m rename to samples/client/petstore/objc/core-data/SwaggerClient/Core/SWGJSONResponseSerializer.m diff --git a/samples/client/petstore/objc/SwaggerClient/Core/SWGLogger.h b/samples/client/petstore/objc/core-data/SwaggerClient/Core/SWGLogger.h similarity index 100% rename from samples/client/petstore/objc/SwaggerClient/Core/SWGLogger.h rename to samples/client/petstore/objc/core-data/SwaggerClient/Core/SWGLogger.h diff --git a/samples/client/petstore/objc/SwaggerClient/Core/SWGLogger.m b/samples/client/petstore/objc/core-data/SwaggerClient/Core/SWGLogger.m similarity index 100% rename from samples/client/petstore/objc/SwaggerClient/Core/SWGLogger.m rename to samples/client/petstore/objc/core-data/SwaggerClient/Core/SWGLogger.m diff --git a/samples/client/petstore/objc/SwaggerClient/Core/SWGObject.h b/samples/client/petstore/objc/core-data/SwaggerClient/Core/SWGObject.h similarity index 100% rename from samples/client/petstore/objc/SwaggerClient/Core/SWGObject.h rename to samples/client/petstore/objc/core-data/SwaggerClient/Core/SWGObject.h diff --git a/samples/client/petstore/objc/SwaggerClient/Core/SWGObject.m b/samples/client/petstore/objc/core-data/SwaggerClient/Core/SWGObject.m similarity index 100% rename from samples/client/petstore/objc/SwaggerClient/Core/SWGObject.m rename to samples/client/petstore/objc/core-data/SwaggerClient/Core/SWGObject.m diff --git a/samples/client/petstore/objc/SwaggerClient/Core/SWGQueryParamCollection.h b/samples/client/petstore/objc/core-data/SwaggerClient/Core/SWGQueryParamCollection.h similarity index 100% rename from samples/client/petstore/objc/SwaggerClient/Core/SWGQueryParamCollection.h rename to samples/client/petstore/objc/core-data/SwaggerClient/Core/SWGQueryParamCollection.h diff --git a/samples/client/petstore/objc/SwaggerClient/Core/SWGQueryParamCollection.m b/samples/client/petstore/objc/core-data/SwaggerClient/Core/SWGQueryParamCollection.m similarity index 100% rename from samples/client/petstore/objc/SwaggerClient/Core/SWGQueryParamCollection.m rename to samples/client/petstore/objc/core-data/SwaggerClient/Core/SWGQueryParamCollection.m diff --git a/samples/client/petstore/objc/SwaggerClient/Core/SWGResponseDeserializer.h b/samples/client/petstore/objc/core-data/SwaggerClient/Core/SWGResponseDeserializer.h similarity index 100% rename from samples/client/petstore/objc/SwaggerClient/Core/SWGResponseDeserializer.h rename to samples/client/petstore/objc/core-data/SwaggerClient/Core/SWGResponseDeserializer.h diff --git a/samples/client/petstore/objc/SwaggerClient/Core/SWGResponseDeserializer.m b/samples/client/petstore/objc/core-data/SwaggerClient/Core/SWGResponseDeserializer.m similarity index 100% rename from samples/client/petstore/objc/SwaggerClient/Core/SWGResponseDeserializer.m rename to samples/client/petstore/objc/core-data/SwaggerClient/Core/SWGResponseDeserializer.m diff --git a/samples/client/petstore/objc/SwaggerClient/Core/SWGSanitizer.h b/samples/client/petstore/objc/core-data/SwaggerClient/Core/SWGSanitizer.h similarity index 100% rename from samples/client/petstore/objc/SwaggerClient/Core/SWGSanitizer.h rename to samples/client/petstore/objc/core-data/SwaggerClient/Core/SWGSanitizer.h diff --git a/samples/client/petstore/objc/SwaggerClient/Core/SWGSanitizer.m b/samples/client/petstore/objc/core-data/SwaggerClient/Core/SWGSanitizer.m similarity index 100% rename from samples/client/petstore/objc/SwaggerClient/Core/SWGSanitizer.m rename to samples/client/petstore/objc/core-data/SwaggerClient/Core/SWGSanitizer.m diff --git a/samples/client/petstore/objc/SwaggerClient/Model/SWGCategory.h b/samples/client/petstore/objc/core-data/SwaggerClient/Model/SWGCategory.h similarity index 100% rename from samples/client/petstore/objc/SwaggerClient/Model/SWGCategory.h rename to samples/client/petstore/objc/core-data/SwaggerClient/Model/SWGCategory.h diff --git a/samples/client/petstore/objc/SwaggerClient/Model/SWGCategory.m b/samples/client/petstore/objc/core-data/SwaggerClient/Model/SWGCategory.m similarity index 100% rename from samples/client/petstore/objc/SwaggerClient/Model/SWGCategory.m rename to samples/client/petstore/objc/core-data/SwaggerClient/Model/SWGCategory.m diff --git a/samples/client/petstore/objc/SwaggerClient/Model/SWGCategoryManagedObject.h b/samples/client/petstore/objc/core-data/SwaggerClient/Model/SWGCategoryManagedObject.h similarity index 100% rename from samples/client/petstore/objc/SwaggerClient/Model/SWGCategoryManagedObject.h rename to samples/client/petstore/objc/core-data/SwaggerClient/Model/SWGCategoryManagedObject.h diff --git a/samples/client/petstore/objc/SwaggerClient/Model/SWGCategoryManagedObject.m b/samples/client/petstore/objc/core-data/SwaggerClient/Model/SWGCategoryManagedObject.m similarity index 100% rename from samples/client/petstore/objc/SwaggerClient/Model/SWGCategoryManagedObject.m rename to samples/client/petstore/objc/core-data/SwaggerClient/Model/SWGCategoryManagedObject.m diff --git a/samples/client/petstore/objc/SwaggerClient/Model/SWGCategoryManagedObjectBuilder.h b/samples/client/petstore/objc/core-data/SwaggerClient/Model/SWGCategoryManagedObjectBuilder.h similarity index 100% rename from samples/client/petstore/objc/SwaggerClient/Model/SWGCategoryManagedObjectBuilder.h rename to samples/client/petstore/objc/core-data/SwaggerClient/Model/SWGCategoryManagedObjectBuilder.h diff --git a/samples/client/petstore/objc/SwaggerClient/Model/SWGCategoryManagedObjectBuilder.m b/samples/client/petstore/objc/core-data/SwaggerClient/Model/SWGCategoryManagedObjectBuilder.m similarity index 100% rename from samples/client/petstore/objc/SwaggerClient/Model/SWGCategoryManagedObjectBuilder.m rename to samples/client/petstore/objc/core-data/SwaggerClient/Model/SWGCategoryManagedObjectBuilder.m diff --git a/samples/client/petstore/objc/SwaggerClient/Model/SWGModel.xcdatamodeld/.xccurrentversion b/samples/client/petstore/objc/core-data/SwaggerClient/Model/SWGModel.xcdatamodeld/.xccurrentversion similarity index 100% rename from samples/client/petstore/objc/SwaggerClient/Model/SWGModel.xcdatamodeld/.xccurrentversion rename to samples/client/petstore/objc/core-data/SwaggerClient/Model/SWGModel.xcdatamodeld/.xccurrentversion diff --git a/samples/client/petstore/objc/SwaggerClient/Model/SWGModel.xcdatamodeld/SWGModel.xcdatamodel/contents b/samples/client/petstore/objc/core-data/SwaggerClient/Model/SWGModel.xcdatamodeld/SWGModel.xcdatamodel/contents similarity index 100% rename from samples/client/petstore/objc/SwaggerClient/Model/SWGModel.xcdatamodeld/SWGModel.xcdatamodel/contents rename to samples/client/petstore/objc/core-data/SwaggerClient/Model/SWGModel.xcdatamodeld/SWGModel.xcdatamodel/contents diff --git a/samples/client/petstore/objc/SwaggerClient/Model/SWGOrder.h b/samples/client/petstore/objc/core-data/SwaggerClient/Model/SWGOrder.h similarity index 100% rename from samples/client/petstore/objc/SwaggerClient/Model/SWGOrder.h rename to samples/client/petstore/objc/core-data/SwaggerClient/Model/SWGOrder.h diff --git a/samples/client/petstore/objc/SwaggerClient/Model/SWGOrder.m b/samples/client/petstore/objc/core-data/SwaggerClient/Model/SWGOrder.m similarity index 100% rename from samples/client/petstore/objc/SwaggerClient/Model/SWGOrder.m rename to samples/client/petstore/objc/core-data/SwaggerClient/Model/SWGOrder.m diff --git a/samples/client/petstore/objc/SwaggerClient/Model/SWGOrderManagedObject.h b/samples/client/petstore/objc/core-data/SwaggerClient/Model/SWGOrderManagedObject.h similarity index 100% rename from samples/client/petstore/objc/SwaggerClient/Model/SWGOrderManagedObject.h rename to samples/client/petstore/objc/core-data/SwaggerClient/Model/SWGOrderManagedObject.h diff --git a/samples/client/petstore/objc/SwaggerClient/Model/SWGOrderManagedObject.m b/samples/client/petstore/objc/core-data/SwaggerClient/Model/SWGOrderManagedObject.m similarity index 100% rename from samples/client/petstore/objc/SwaggerClient/Model/SWGOrderManagedObject.m rename to samples/client/petstore/objc/core-data/SwaggerClient/Model/SWGOrderManagedObject.m diff --git a/samples/client/petstore/objc/SwaggerClient/Model/SWGOrderManagedObjectBuilder.h b/samples/client/petstore/objc/core-data/SwaggerClient/Model/SWGOrderManagedObjectBuilder.h similarity index 100% rename from samples/client/petstore/objc/SwaggerClient/Model/SWGOrderManagedObjectBuilder.h rename to samples/client/petstore/objc/core-data/SwaggerClient/Model/SWGOrderManagedObjectBuilder.h diff --git a/samples/client/petstore/objc/SwaggerClient/Model/SWGOrderManagedObjectBuilder.m b/samples/client/petstore/objc/core-data/SwaggerClient/Model/SWGOrderManagedObjectBuilder.m similarity index 100% rename from samples/client/petstore/objc/SwaggerClient/Model/SWGOrderManagedObjectBuilder.m rename to samples/client/petstore/objc/core-data/SwaggerClient/Model/SWGOrderManagedObjectBuilder.m diff --git a/samples/client/petstore/objc/SwaggerClient/Model/SWGPet.h b/samples/client/petstore/objc/core-data/SwaggerClient/Model/SWGPet.h similarity index 100% rename from samples/client/petstore/objc/SwaggerClient/Model/SWGPet.h rename to samples/client/petstore/objc/core-data/SwaggerClient/Model/SWGPet.h diff --git a/samples/client/petstore/objc/SwaggerClient/Model/SWGPet.m b/samples/client/petstore/objc/core-data/SwaggerClient/Model/SWGPet.m similarity index 100% rename from samples/client/petstore/objc/SwaggerClient/Model/SWGPet.m rename to samples/client/petstore/objc/core-data/SwaggerClient/Model/SWGPet.m diff --git a/samples/client/petstore/objc/SwaggerClient/Model/SWGPetManagedObject.h b/samples/client/petstore/objc/core-data/SwaggerClient/Model/SWGPetManagedObject.h similarity index 100% rename from samples/client/petstore/objc/SwaggerClient/Model/SWGPetManagedObject.h rename to samples/client/petstore/objc/core-data/SwaggerClient/Model/SWGPetManagedObject.h diff --git a/samples/client/petstore/objc/SwaggerClient/Model/SWGPetManagedObject.m b/samples/client/petstore/objc/core-data/SwaggerClient/Model/SWGPetManagedObject.m similarity index 100% rename from samples/client/petstore/objc/SwaggerClient/Model/SWGPetManagedObject.m rename to samples/client/petstore/objc/core-data/SwaggerClient/Model/SWGPetManagedObject.m diff --git a/samples/client/petstore/objc/SwaggerClient/Model/SWGPetManagedObjectBuilder.h b/samples/client/petstore/objc/core-data/SwaggerClient/Model/SWGPetManagedObjectBuilder.h similarity index 100% rename from samples/client/petstore/objc/SwaggerClient/Model/SWGPetManagedObjectBuilder.h rename to samples/client/petstore/objc/core-data/SwaggerClient/Model/SWGPetManagedObjectBuilder.h diff --git a/samples/client/petstore/objc/SwaggerClient/Model/SWGPetManagedObjectBuilder.m b/samples/client/petstore/objc/core-data/SwaggerClient/Model/SWGPetManagedObjectBuilder.m similarity index 100% rename from samples/client/petstore/objc/SwaggerClient/Model/SWGPetManagedObjectBuilder.m rename to samples/client/petstore/objc/core-data/SwaggerClient/Model/SWGPetManagedObjectBuilder.m diff --git a/samples/client/petstore/objc/SwaggerClient/Model/SWGTag.h b/samples/client/petstore/objc/core-data/SwaggerClient/Model/SWGTag.h similarity index 100% rename from samples/client/petstore/objc/SwaggerClient/Model/SWGTag.h rename to samples/client/petstore/objc/core-data/SwaggerClient/Model/SWGTag.h diff --git a/samples/client/petstore/objc/SwaggerClient/Model/SWGTag.m b/samples/client/petstore/objc/core-data/SwaggerClient/Model/SWGTag.m similarity index 100% rename from samples/client/petstore/objc/SwaggerClient/Model/SWGTag.m rename to samples/client/petstore/objc/core-data/SwaggerClient/Model/SWGTag.m diff --git a/samples/client/petstore/objc/SwaggerClient/Model/SWGTagManagedObject.h b/samples/client/petstore/objc/core-data/SwaggerClient/Model/SWGTagManagedObject.h similarity index 100% rename from samples/client/petstore/objc/SwaggerClient/Model/SWGTagManagedObject.h rename to samples/client/petstore/objc/core-data/SwaggerClient/Model/SWGTagManagedObject.h diff --git a/samples/client/petstore/objc/SwaggerClient/Model/SWGTagManagedObject.m b/samples/client/petstore/objc/core-data/SwaggerClient/Model/SWGTagManagedObject.m similarity index 100% rename from samples/client/petstore/objc/SwaggerClient/Model/SWGTagManagedObject.m rename to samples/client/petstore/objc/core-data/SwaggerClient/Model/SWGTagManagedObject.m diff --git a/samples/client/petstore/objc/SwaggerClient/Model/SWGTagManagedObjectBuilder.h b/samples/client/petstore/objc/core-data/SwaggerClient/Model/SWGTagManagedObjectBuilder.h similarity index 100% rename from samples/client/petstore/objc/SwaggerClient/Model/SWGTagManagedObjectBuilder.h rename to samples/client/petstore/objc/core-data/SwaggerClient/Model/SWGTagManagedObjectBuilder.h diff --git a/samples/client/petstore/objc/SwaggerClient/Model/SWGTagManagedObjectBuilder.m b/samples/client/petstore/objc/core-data/SwaggerClient/Model/SWGTagManagedObjectBuilder.m similarity index 100% rename from samples/client/petstore/objc/SwaggerClient/Model/SWGTagManagedObjectBuilder.m rename to samples/client/petstore/objc/core-data/SwaggerClient/Model/SWGTagManagedObjectBuilder.m diff --git a/samples/client/petstore/objc/SwaggerClient/Model/SWGUser.h b/samples/client/petstore/objc/core-data/SwaggerClient/Model/SWGUser.h similarity index 100% rename from samples/client/petstore/objc/SwaggerClient/Model/SWGUser.h rename to samples/client/petstore/objc/core-data/SwaggerClient/Model/SWGUser.h diff --git a/samples/client/petstore/objc/SwaggerClient/Model/SWGUser.m b/samples/client/petstore/objc/core-data/SwaggerClient/Model/SWGUser.m similarity index 100% rename from samples/client/petstore/objc/SwaggerClient/Model/SWGUser.m rename to samples/client/petstore/objc/core-data/SwaggerClient/Model/SWGUser.m diff --git a/samples/client/petstore/objc/SwaggerClient/Model/SWGUserManagedObject.h b/samples/client/petstore/objc/core-data/SwaggerClient/Model/SWGUserManagedObject.h similarity index 100% rename from samples/client/petstore/objc/SwaggerClient/Model/SWGUserManagedObject.h rename to samples/client/petstore/objc/core-data/SwaggerClient/Model/SWGUserManagedObject.h diff --git a/samples/client/petstore/objc/SwaggerClient/Model/SWGUserManagedObject.m b/samples/client/petstore/objc/core-data/SwaggerClient/Model/SWGUserManagedObject.m similarity index 100% rename from samples/client/petstore/objc/SwaggerClient/Model/SWGUserManagedObject.m rename to samples/client/petstore/objc/core-data/SwaggerClient/Model/SWGUserManagedObject.m diff --git a/samples/client/petstore/objc/SwaggerClient/Model/SWGUserManagedObjectBuilder.h b/samples/client/petstore/objc/core-data/SwaggerClient/Model/SWGUserManagedObjectBuilder.h similarity index 100% rename from samples/client/petstore/objc/SwaggerClient/Model/SWGUserManagedObjectBuilder.h rename to samples/client/petstore/objc/core-data/SwaggerClient/Model/SWGUserManagedObjectBuilder.h diff --git a/samples/client/petstore/objc/SwaggerClient/Model/SWGUserManagedObjectBuilder.m b/samples/client/petstore/objc/core-data/SwaggerClient/Model/SWGUserManagedObjectBuilder.m similarity index 100% rename from samples/client/petstore/objc/SwaggerClient/Model/SWGUserManagedObjectBuilder.m rename to samples/client/petstore/objc/core-data/SwaggerClient/Model/SWGUserManagedObjectBuilder.m diff --git a/samples/client/petstore/objc/SwaggerClientTests/Podfile b/samples/client/petstore/objc/core-data/SwaggerClientTests/Podfile similarity index 100% rename from samples/client/petstore/objc/SwaggerClientTests/Podfile rename to samples/client/petstore/objc/core-data/SwaggerClientTests/Podfile diff --git a/samples/client/petstore/objc/core-data/SwaggerClientTests/SwaggerClient.xcodeproj/project.pbxproj b/samples/client/petstore/objc/core-data/SwaggerClientTests/SwaggerClient.xcodeproj/project.pbxproj new file mode 100644 index 00000000000..b69c907b161 --- /dev/null +++ b/samples/client/petstore/objc/core-data/SwaggerClientTests/SwaggerClient.xcodeproj/project.pbxproj @@ -0,0 +1,621 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 158CE3AA214CB1B31C7ADC48 /* libPods-SwaggerClient_Tests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FDEF5BA3CF9CFFDEB5A47DB4 /* libPods-SwaggerClient_Tests.a */; }; + 6003F58E195388D20070C39A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58D195388D20070C39A /* Foundation.framework */; }; + 6003F590195388D20070C39A /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58F195388D20070C39A /* CoreGraphics.framework */; }; + 6003F592195388D20070C39A /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F591195388D20070C39A /* UIKit.framework */; }; + 6003F598195388D20070C39A /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 6003F596195388D20070C39A /* InfoPlist.strings */; }; + 6003F59A195388D20070C39A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F599195388D20070C39A /* main.m */; }; + 6003F59E195388D20070C39A /* SWGAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F59D195388D20070C39A /* SWGAppDelegate.m */; }; + 6003F5A7195388D20070C39A /* SWGViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F5A6195388D20070C39A /* SWGViewController.m */; }; + 6003F5B0195388D20070C39A /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F5AF195388D20070C39A /* XCTest.framework */; }; + 6003F5B1195388D20070C39A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58D195388D20070C39A /* Foundation.framework */; }; + 6003F5B2195388D20070C39A /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F591195388D20070C39A /* UIKit.framework */; }; + 6003F5BA195388D20070C39A /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 6003F5B8195388D20070C39A /* InfoPlist.strings */; }; + 94BE6BE84795B5034A811E61 /* libPods-SwaggerClient_Example.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8D46325ECAD48245C07F6733 /* libPods-SwaggerClient_Example.a */; }; + B2ADC0B1C8A60A05C48B4DF7 /* DatabaseHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = B2ADC55130D5E329ED945E8F /* DatabaseHelper.m */; }; + B2ADC17C287DCABF329BA8AC /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B2ADC7027D4B025ABCA7999F /* Main.storyboard */; }; + B2ADC2D632658A5F73C6CE66 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B2ADC65E342ADA697322D68C /* Images.xcassets */; }; + B2ADC3C7634D15595DD14814 /* BuildersTest.m in Sources */ = {isa = PBXBuildFile; fileRef = B2ADC838FCC22F4BC6C41106 /* BuildersTest.m */; }; + B2ADC56977372855A63F4E4D /* Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B2ADC084A2C0BDF217832B03 /* Launch Screen.storyboard */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 6003F5B3195388D20070C39A /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 6003F582195388D10070C39A /* Project object */; + proxyType = 1; + remoteGlobalIDString = 6003F589195388D20070C39A; + remoteInfo = SwaggerClient; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 1A81C3BE3E54961CD827EAE3 /* Pods-SwaggerClient_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwaggerClient_Tests.release.xcconfig"; path = "Pods/Target Support Files/Pods-SwaggerClient_Tests/Pods-SwaggerClient_Tests.release.xcconfig"; sourceTree = ""; }; + 4CCE21315897B7D544C83242 /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = ""; }; + 6003F58A195388D20070C39A /* SwaggerClient_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SwaggerClient_Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 6003F58D195388D20070C39A /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + 6003F58F195388D20070C39A /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; + 6003F591195388D20070C39A /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; + 6003F595195388D20070C39A /* SwaggerClient-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "SwaggerClient-Info.plist"; sourceTree = ""; }; + 6003F597195388D20070C39A /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; + 6003F599195388D20070C39A /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 6003F59B195388D20070C39A /* SwaggerClient-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SwaggerClient-Prefix.pch"; sourceTree = ""; }; + 6003F59C195388D20070C39A /* SWGAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SWGAppDelegate.h; sourceTree = ""; }; + 6003F59D195388D20070C39A /* SWGAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SWGAppDelegate.m; sourceTree = ""; }; + 6003F5A5195388D20070C39A /* SWGViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SWGViewController.h; sourceTree = ""; }; + 6003F5A6195388D20070C39A /* SWGViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SWGViewController.m; sourceTree = ""; }; + 6003F5AE195388D20070C39A /* SwaggerClient_Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SwaggerClient_Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 6003F5AF195388D20070C39A /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; + 6003F5B7195388D20070C39A /* Tests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Tests-Info.plist"; sourceTree = ""; }; + 6003F5B9195388D20070C39A /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; + 606FC2411953D9B200FFA9A0 /* Tests-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Tests-Prefix.pch"; sourceTree = ""; }; + 73CCD82196AABD64F2807C7B /* Pods-SwaggerClient_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwaggerClient_Tests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SwaggerClient_Tests/Pods-SwaggerClient_Tests.debug.xcconfig"; sourceTree = ""; }; + 8D46325ECAD48245C07F6733 /* libPods-SwaggerClient_Example.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-SwaggerClient_Example.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + B2ADC084A2C0BDF217832B03 /* Launch Screen.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = "Launch Screen.storyboard"; path = "SwaggerClient/Launch Screen.storyboard"; sourceTree = ""; }; + B2ADC2F3483B3117A00FA91C /* DatabaseHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DatabaseHelper.h; sourceTree = ""; }; + B2ADC55130D5E329ED945E8F /* DatabaseHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DatabaseHelper.m; sourceTree = ""; }; + B2ADC65E342ADA697322D68C /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = SwaggerClient/Images.xcassets; sourceTree = ""; }; + B2ADC7027D4B025ABCA7999F /* Main.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Main.storyboard; path = SwaggerClient/Main.storyboard; sourceTree = ""; }; + B2ADC838FCC22F4BC6C41106 /* BuildersTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BuildersTest.m; sourceTree = ""; }; + BFB4BE760737508B3CFC23B2 /* Pods-SwaggerClient_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwaggerClient_Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-SwaggerClient_Example/Pods-SwaggerClient_Example.release.xcconfig"; sourceTree = ""; }; + E445A633FA767F207D7EE6CE /* Pods-SwaggerClient_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwaggerClient_Example.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SwaggerClient_Example/Pods-SwaggerClient_Example.debug.xcconfig"; sourceTree = ""; }; + E9675D953C6DCDE71A1BDFD4 /* SwaggerClient.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = SwaggerClient.podspec; path = ../SwaggerClient.podspec; sourceTree = ""; }; + FDEF5BA3CF9CFFDEB5A47DB4 /* libPods-SwaggerClient_Tests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-SwaggerClient_Tests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 6003F587195388D20070C39A /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 6003F590195388D20070C39A /* CoreGraphics.framework in Frameworks */, + 6003F592195388D20070C39A /* UIKit.framework in Frameworks */, + 6003F58E195388D20070C39A /* Foundation.framework in Frameworks */, + 94BE6BE84795B5034A811E61 /* libPods-SwaggerClient_Example.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 6003F5AB195388D20070C39A /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 6003F5B0195388D20070C39A /* XCTest.framework in Frameworks */, + 6003F5B2195388D20070C39A /* UIKit.framework in Frameworks */, + 6003F5B1195388D20070C39A /* Foundation.framework in Frameworks */, + 158CE3AA214CB1B31C7ADC48 /* libPods-SwaggerClient_Tests.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 6003F581195388D10070C39A = { + isa = PBXGroup; + children = ( + 60FF7A9C1954A5C5007DD14C /* Podspec Metadata */, + 6003F593195388D20070C39A /* Example for SwaggerClient */, + 6003F5B5195388D20070C39A /* Tests */, + 6003F58C195388D20070C39A /* Frameworks */, + 6003F58B195388D20070C39A /* Products */, + CCE77F10C6D41F74B075ECD0 /* Pods */, + ); + sourceTree = ""; + }; + 6003F58B195388D20070C39A /* Products */ = { + isa = PBXGroup; + children = ( + 6003F58A195388D20070C39A /* SwaggerClient_Example.app */, + 6003F5AE195388D20070C39A /* SwaggerClient_Tests.xctest */, + B2ADC084A2C0BDF217832B03 /* Launch Screen.storyboard */, + ); + name = Products; + sourceTree = ""; + }; + 6003F58C195388D20070C39A /* Frameworks */ = { + isa = PBXGroup; + children = ( + 6003F58D195388D20070C39A /* Foundation.framework */, + 6003F58F195388D20070C39A /* CoreGraphics.framework */, + 6003F591195388D20070C39A /* UIKit.framework */, + 6003F5AF195388D20070C39A /* XCTest.framework */, + 8D46325ECAD48245C07F6733 /* libPods-SwaggerClient_Example.a */, + FDEF5BA3CF9CFFDEB5A47DB4 /* libPods-SwaggerClient_Tests.a */, + ); + name = Frameworks; + sourceTree = ""; + }; + 6003F593195388D20070C39A /* Example for SwaggerClient */ = { + isa = PBXGroup; + children = ( + 6003F59C195388D20070C39A /* SWGAppDelegate.h */, + 6003F59D195388D20070C39A /* SWGAppDelegate.m */, + 6003F5A5195388D20070C39A /* SWGViewController.h */, + 6003F5A6195388D20070C39A /* SWGViewController.m */, + 6003F594195388D20070C39A /* Supporting Files */, + ); + name = "Example for SwaggerClient"; + path = SwaggerClient; + sourceTree = ""; + }; + 6003F594195388D20070C39A /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 6003F595195388D20070C39A /* SwaggerClient-Info.plist */, + 6003F596195388D20070C39A /* InfoPlist.strings */, + 6003F599195388D20070C39A /* main.m */, + 6003F59B195388D20070C39A /* SwaggerClient-Prefix.pch */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; + 6003F5B5195388D20070C39A /* Tests */ = { + isa = PBXGroup; + children = ( + 6003F5B6195388D20070C39A /* Supporting Files */, + B2ADC838FCC22F4BC6C41106 /* BuildersTest.m */, + B2ADCA62DE4AC0F5BAB42208 /* Helpers */, + ); + path = Tests; + sourceTree = ""; + }; + 6003F5B6195388D20070C39A /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 6003F5B7195388D20070C39A /* Tests-Info.plist */, + 6003F5B8195388D20070C39A /* InfoPlist.strings */, + 606FC2411953D9B200FFA9A0 /* Tests-Prefix.pch */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; + 60FF7A9C1954A5C5007DD14C /* Podspec Metadata */ = { + isa = PBXGroup; + children = ( + E9675D953C6DCDE71A1BDFD4 /* SwaggerClient.podspec */, + 4CCE21315897B7D544C83242 /* README.md */, + B2ADC7027D4B025ABCA7999F /* Main.storyboard */, + B2ADC65E342ADA697322D68C /* Images.xcassets */, + ); + name = "Podspec Metadata"; + sourceTree = ""; + }; + B2ADCA62DE4AC0F5BAB42208 /* Helpers */ = { + isa = PBXGroup; + children = ( + B2ADC2F3483B3117A00FA91C /* DatabaseHelper.h */, + B2ADC55130D5E329ED945E8F /* DatabaseHelper.m */, + ); + path = Helpers; + sourceTree = ""; + }; + CCE77F10C6D41F74B075ECD0 /* Pods */ = { + isa = PBXGroup; + children = ( + E445A633FA767F207D7EE6CE /* Pods-SwaggerClient_Example.debug.xcconfig */, + BFB4BE760737508B3CFC23B2 /* Pods-SwaggerClient_Example.release.xcconfig */, + 73CCD82196AABD64F2807C7B /* Pods-SwaggerClient_Tests.debug.xcconfig */, + 1A81C3BE3E54961CD827EAE3 /* Pods-SwaggerClient_Tests.release.xcconfig */, + ); + name = Pods; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 6003F589195388D20070C39A /* SwaggerClient_Example */ = { + isa = PBXNativeTarget; + buildConfigurationList = 6003F5BF195388D20070C39A /* Build configuration list for PBXNativeTarget "SwaggerClient_Example" */; + buildPhases = ( + 799E7E29D924C30424DFBA28 /* Check Pods Manifest.lock */, + 6003F586195388D20070C39A /* Sources */, + 6003F587195388D20070C39A /* Frameworks */, + 6003F588195388D20070C39A /* Resources */, + 429AF5C69E165ED75311B4B0 /* Copy Pods Resources */, + 183E54C09C54DAEB54B2546F /* Embed Pods Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = SwaggerClient_Example; + productName = SwaggerClient; + productReference = 6003F58A195388D20070C39A /* SwaggerClient_Example.app */; + productType = "com.apple.product-type.application"; + }; + 6003F5AD195388D20070C39A /* SwaggerClient_Tests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 6003F5C2195388D20070C39A /* Build configuration list for PBXNativeTarget "SwaggerClient_Tests" */; + buildPhases = ( + 7B069562A9F91E498732474F /* Check Pods Manifest.lock */, + 6003F5AA195388D20070C39A /* Sources */, + 6003F5AB195388D20070C39A /* Frameworks */, + 6003F5AC195388D20070C39A /* Resources */, + E337D7E459CCFFDF27046FFC /* Copy Pods Resources */, + 111D7956304BD6E860AA8709 /* Embed Pods Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 6003F5B4195388D20070C39A /* PBXTargetDependency */, + ); + name = SwaggerClient_Tests; + productName = SwaggerClientTests; + productReference = 6003F5AE195388D20070C39A /* SwaggerClient_Tests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 6003F582195388D10070C39A /* Project object */ = { + isa = PBXProject; + attributes = { + CLASSPREFIX = SWG; + LastUpgradeCheck = 0510; + ORGANIZATIONNAME = geekerzp; + }; + buildConfigurationList = 6003F585195388D10070C39A /* Build configuration list for PBXProject "SwaggerClient" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 6003F581195388D10070C39A; + productRefGroup = 6003F58B195388D20070C39A /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 6003F589195388D20070C39A /* SwaggerClient_Example */, + 6003F5AD195388D20070C39A /* SwaggerClient_Tests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 6003F588195388D20070C39A /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 6003F598195388D20070C39A /* InfoPlist.strings in Resources */, + B2ADC17C287DCABF329BA8AC /* Main.storyboard in Resources */, + B2ADC2D632658A5F73C6CE66 /* Images.xcassets in Resources */, + B2ADC56977372855A63F4E4D /* Launch Screen.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 6003F5AC195388D20070C39A /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 6003F5BA195388D20070C39A /* InfoPlist.strings in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 111D7956304BD6E860AA8709 /* Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Embed Pods Frameworks"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SwaggerClient_Tests/Pods-SwaggerClient_Tests-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + 183E54C09C54DAEB54B2546F /* Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Embed Pods Frameworks"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SwaggerClient_Example/Pods-SwaggerClient_Example-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + 429AF5C69E165ED75311B4B0 /* Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Copy Pods Resources"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SwaggerClient_Example/Pods-SwaggerClient_Example-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; + 799E7E29D924C30424DFBA28 /* Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Check Pods Manifest.lock"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; + showEnvVarsInLog = 0; + }; + 7B069562A9F91E498732474F /* Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Check Pods Manifest.lock"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; + showEnvVarsInLog = 0; + }; + E337D7E459CCFFDF27046FFC /* Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Copy Pods Resources"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SwaggerClient_Tests/Pods-SwaggerClient_Tests-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 6003F586195388D20070C39A /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 6003F59E195388D20070C39A /* SWGAppDelegate.m in Sources */, + 6003F5A7195388D20070C39A /* SWGViewController.m in Sources */, + 6003F59A195388D20070C39A /* main.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 6003F5AA195388D20070C39A /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + B2ADC3C7634D15595DD14814 /* BuildersTest.m in Sources */, + B2ADC0B1C8A60A05C48B4DF7 /* DatabaseHelper.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 6003F5B4195388D20070C39A /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 6003F589195388D20070C39A /* SwaggerClient_Example */; + targetProxy = 6003F5B3195388D20070C39A /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 6003F596195388D20070C39A /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + 6003F597195388D20070C39A /* en */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; + 6003F5B8195388D20070C39A /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + 6003F5B9195388D20070C39A /* en */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 6003F5BD195388D20070C39A /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 7.1; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 6003F5BE195388D20070C39A /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = YES; + ENABLE_NS_ASSERTIONS = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 7.1; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 6003F5C0195388D20070C39A /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = E445A633FA767F207D7EE6CE /* Pods-SwaggerClient_Example.debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "SwaggerClient/SwaggerClient-Prefix.pch"; + INFOPLIST_FILE = "SwaggerClient/SwaggerClient-Info.plist"; + MODULE_NAME = ExampleApp; + PRODUCT_NAME = "$(TARGET_NAME)"; + WRAPPER_EXTENSION = app; + }; + name = Debug; + }; + 6003F5C1195388D20070C39A /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = BFB4BE760737508B3CFC23B2 /* Pods-SwaggerClient_Example.release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "SwaggerClient/SwaggerClient-Prefix.pch"; + INFOPLIST_FILE = "SwaggerClient/SwaggerClient-Info.plist"; + MODULE_NAME = ExampleApp; + PRODUCT_NAME = "$(TARGET_NAME)"; + WRAPPER_EXTENSION = app; + }; + name = Release; + }; + 6003F5C3195388D20070C39A /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 73CCD82196AABD64F2807C7B /* Pods-SwaggerClient_Tests.debug.xcconfig */; + buildSettings = { + FRAMEWORK_SEARCH_PATHS = ( + "$(SDKROOT)/Developer/Library/Frameworks", + "$(inherited)", + "$(DEVELOPER_FRAMEWORKS_DIR)", + ); + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "Tests/Tests-Prefix.pch"; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + INFOPLIST_FILE = "Tests/Tests-Info.plist"; + PRODUCT_NAME = "$(TARGET_NAME)"; + WRAPPER_EXTENSION = xctest; + }; + name = Debug; + }; + 6003F5C4195388D20070C39A /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 1A81C3BE3E54961CD827EAE3 /* Pods-SwaggerClient_Tests.release.xcconfig */; + buildSettings = { + FRAMEWORK_SEARCH_PATHS = ( + "$(SDKROOT)/Developer/Library/Frameworks", + "$(inherited)", + "$(DEVELOPER_FRAMEWORKS_DIR)", + ); + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "Tests/Tests-Prefix.pch"; + INFOPLIST_FILE = "Tests/Tests-Info.plist"; + PRODUCT_NAME = "$(TARGET_NAME)"; + WRAPPER_EXTENSION = xctest; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 6003F585195388D10070C39A /* Build configuration list for PBXProject "SwaggerClient" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 6003F5BD195388D20070C39A /* Debug */, + 6003F5BE195388D20070C39A /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 6003F5BF195388D20070C39A /* Build configuration list for PBXNativeTarget "SwaggerClient_Example" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 6003F5C0195388D20070C39A /* Debug */, + 6003F5C1195388D20070C39A /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 6003F5C2195388D20070C39A /* Build configuration list for PBXNativeTarget "SwaggerClient_Tests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 6003F5C3195388D20070C39A /* Debug */, + 6003F5C4195388D20070C39A /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 6003F582195388D10070C39A /* Project object */; +} diff --git a/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/samples/client/petstore/objc/core-data/SwaggerClientTests/SwaggerClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata similarity index 100% rename from samples/client/petstore/objc/SwaggerClientTests/SwaggerClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata rename to samples/client/petstore/objc/core-data/SwaggerClientTests/SwaggerClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata diff --git a/samples/client/petstore/objc/core-data/SwaggerClientTests/SwaggerClient.xcodeproj/xcshareddata/xcschemes/All Tests.xcscheme b/samples/client/petstore/objc/core-data/SwaggerClientTests/SwaggerClient.xcodeproj/xcshareddata/xcschemes/All Tests.xcscheme new file mode 100644 index 00000000000..5c68411bb2d --- /dev/null +++ b/samples/client/petstore/objc/core-data/SwaggerClientTests/SwaggerClient.xcodeproj/xcshareddata/xcschemes/All Tests.xcscheme @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient.xcodeproj/xcshareddata/xcschemes/SwaggerClient-Example.xcscheme b/samples/client/petstore/objc/core-data/SwaggerClientTests/SwaggerClient.xcodeproj/xcshareddata/xcschemes/SwaggerClient-Example.xcscheme similarity index 100% rename from samples/client/petstore/objc/SwaggerClientTests/SwaggerClient.xcodeproj/xcshareddata/xcschemes/SwaggerClient-Example.xcscheme rename to samples/client/petstore/objc/core-data/SwaggerClientTests/SwaggerClient.xcodeproj/xcshareddata/xcschemes/SwaggerClient-Example.xcscheme diff --git a/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient/Images.xcassets/AppIcon.appiconset/Contents.json b/samples/client/petstore/objc/core-data/SwaggerClientTests/SwaggerClient/Images.xcassets/AppIcon.appiconset/Contents.json similarity index 100% rename from samples/client/petstore/objc/SwaggerClientTests/SwaggerClient/Images.xcassets/AppIcon.appiconset/Contents.json rename to samples/client/petstore/objc/core-data/SwaggerClientTests/SwaggerClient/Images.xcassets/AppIcon.appiconset/Contents.json diff --git a/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient/Images.xcassets/LaunchImage.launchimage/Contents.json b/samples/client/petstore/objc/core-data/SwaggerClientTests/SwaggerClient/Images.xcassets/LaunchImage.launchimage/Contents.json similarity index 100% rename from samples/client/petstore/objc/SwaggerClientTests/SwaggerClient/Images.xcassets/LaunchImage.launchimage/Contents.json rename to samples/client/petstore/objc/core-data/SwaggerClientTests/SwaggerClient/Images.xcassets/LaunchImage.launchimage/Contents.json diff --git a/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient/Launch Screen.storyboard b/samples/client/petstore/objc/core-data/SwaggerClientTests/SwaggerClient/Launch Screen.storyboard similarity index 100% rename from samples/client/petstore/objc/SwaggerClientTests/SwaggerClient/Launch Screen.storyboard rename to samples/client/petstore/objc/core-data/SwaggerClientTests/SwaggerClient/Launch Screen.storyboard diff --git a/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient/Main.storyboard b/samples/client/petstore/objc/core-data/SwaggerClientTests/SwaggerClient/Main.storyboard similarity index 100% rename from samples/client/petstore/objc/SwaggerClientTests/SwaggerClient/Main.storyboard rename to samples/client/petstore/objc/core-data/SwaggerClientTests/SwaggerClient/Main.storyboard diff --git a/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient/SWGAppDelegate.h b/samples/client/petstore/objc/core-data/SwaggerClientTests/SwaggerClient/SWGAppDelegate.h similarity index 100% rename from samples/client/petstore/objc/SwaggerClientTests/SwaggerClient/SWGAppDelegate.h rename to samples/client/petstore/objc/core-data/SwaggerClientTests/SwaggerClient/SWGAppDelegate.h diff --git a/samples/client/petstore/objc/core-data/SwaggerClientTests/SwaggerClient/SWGAppDelegate.m b/samples/client/petstore/objc/core-data/SwaggerClientTests/SwaggerClient/SWGAppDelegate.m new file mode 100644 index 00000000000..25ad44a411e --- /dev/null +++ b/samples/client/petstore/objc/core-data/SwaggerClientTests/SwaggerClient/SWGAppDelegate.m @@ -0,0 +1,19 @@ +// +// SWGAppDelegate.m +// SwaggerClient +// +// Created by CocoaPods on 06/26/2015. +// Copyright (c) 2014 geekerzp. All rights reserved. +// + +#import "SWGAppDelegate.h" + +@implementation SWGAppDelegate + +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions +{ + return YES; +} + + +@end diff --git a/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient/SWGViewController.h b/samples/client/petstore/objc/core-data/SwaggerClientTests/SwaggerClient/SWGViewController.h similarity index 100% rename from samples/client/petstore/objc/SwaggerClientTests/SwaggerClient/SWGViewController.h rename to samples/client/petstore/objc/core-data/SwaggerClientTests/SwaggerClient/SWGViewController.h diff --git a/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient/SWGViewController.m b/samples/client/petstore/objc/core-data/SwaggerClientTests/SwaggerClient/SWGViewController.m similarity index 100% rename from samples/client/petstore/objc/SwaggerClientTests/SwaggerClient/SWGViewController.m rename to samples/client/petstore/objc/core-data/SwaggerClientTests/SwaggerClient/SWGViewController.m diff --git a/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient/SwaggerClient-Info.plist b/samples/client/petstore/objc/core-data/SwaggerClientTests/SwaggerClient/SwaggerClient-Info.plist similarity index 100% rename from samples/client/petstore/objc/SwaggerClientTests/SwaggerClient/SwaggerClient-Info.plist rename to samples/client/petstore/objc/core-data/SwaggerClientTests/SwaggerClient/SwaggerClient-Info.plist diff --git a/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient/SwaggerClient-Prefix.pch b/samples/client/petstore/objc/core-data/SwaggerClientTests/SwaggerClient/SwaggerClient-Prefix.pch similarity index 100% rename from samples/client/petstore/objc/SwaggerClientTests/SwaggerClient/SwaggerClient-Prefix.pch rename to samples/client/petstore/objc/core-data/SwaggerClientTests/SwaggerClient/SwaggerClient-Prefix.pch diff --git a/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient/en.lproj/InfoPlist.strings b/samples/client/petstore/objc/core-data/SwaggerClientTests/SwaggerClient/en.lproj/InfoPlist.strings similarity index 100% rename from samples/client/petstore/objc/SwaggerClientTests/SwaggerClient/en.lproj/InfoPlist.strings rename to samples/client/petstore/objc/core-data/SwaggerClientTests/SwaggerClient/en.lproj/InfoPlist.strings diff --git a/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient/main.m b/samples/client/petstore/objc/core-data/SwaggerClientTests/SwaggerClient/main.m similarity index 100% rename from samples/client/petstore/objc/SwaggerClientTests/SwaggerClient/main.m rename to samples/client/petstore/objc/core-data/SwaggerClientTests/SwaggerClient/main.m diff --git a/samples/client/petstore/objc/SwaggerClientTests/Tests/BuildersTest.m b/samples/client/petstore/objc/core-data/SwaggerClientTests/Tests/BuildersTest.m similarity index 100% rename from samples/client/petstore/objc/SwaggerClientTests/Tests/BuildersTest.m rename to samples/client/petstore/objc/core-data/SwaggerClientTests/Tests/BuildersTest.m diff --git a/samples/client/petstore/objc/SwaggerClientTests/Tests/Helpers/DatabaseHelper.h b/samples/client/petstore/objc/core-data/SwaggerClientTests/Tests/Helpers/DatabaseHelper.h similarity index 100% rename from samples/client/petstore/objc/SwaggerClientTests/Tests/Helpers/DatabaseHelper.h rename to samples/client/petstore/objc/core-data/SwaggerClientTests/Tests/Helpers/DatabaseHelper.h diff --git a/samples/client/petstore/objc/SwaggerClientTests/Tests/Helpers/DatabaseHelper.m b/samples/client/petstore/objc/core-data/SwaggerClientTests/Tests/Helpers/DatabaseHelper.m similarity index 100% rename from samples/client/petstore/objc/SwaggerClientTests/Tests/Helpers/DatabaseHelper.m rename to samples/client/petstore/objc/core-data/SwaggerClientTests/Tests/Helpers/DatabaseHelper.m diff --git a/samples/client/petstore/objc/SwaggerClientTests/Tests/Tests-Info.plist b/samples/client/petstore/objc/core-data/SwaggerClientTests/Tests/Tests-Info.plist similarity index 100% rename from samples/client/petstore/objc/SwaggerClientTests/Tests/Tests-Info.plist rename to samples/client/petstore/objc/core-data/SwaggerClientTests/Tests/Tests-Info.plist diff --git a/samples/client/petstore/objc/SwaggerClientTests/Tests/Tests-Prefix.pch b/samples/client/petstore/objc/core-data/SwaggerClientTests/Tests/Tests-Prefix.pch similarity index 100% rename from samples/client/petstore/objc/SwaggerClientTests/Tests/Tests-Prefix.pch rename to samples/client/petstore/objc/core-data/SwaggerClientTests/Tests/Tests-Prefix.pch diff --git a/samples/client/petstore/objc/SwaggerClientTests/Tests/en.lproj/InfoPlist.strings b/samples/client/petstore/objc/core-data/SwaggerClientTests/Tests/en.lproj/InfoPlist.strings similarity index 100% rename from samples/client/petstore/objc/SwaggerClientTests/Tests/en.lproj/InfoPlist.strings rename to samples/client/petstore/objc/core-data/SwaggerClientTests/Tests/en.lproj/InfoPlist.strings diff --git a/samples/client/petstore/objc/SwaggerClientTests/pom.xml b/samples/client/petstore/objc/core-data/SwaggerClientTests/pom.xml similarity index 100% rename from samples/client/petstore/objc/SwaggerClientTests/pom.xml rename to samples/client/petstore/objc/core-data/SwaggerClientTests/pom.xml diff --git a/samples/client/petstore/objc/git_push.sh b/samples/client/petstore/objc/core-data/git_push.sh similarity index 100% rename from samples/client/petstore/objc/git_push.sh rename to samples/client/petstore/objc/core-data/git_push.sh diff --git a/samples/client/petstore/objc/default/.gitignore b/samples/client/petstore/objc/default/.gitignore new file mode 100644 index 00000000000..79d9331b6d4 --- /dev/null +++ b/samples/client/petstore/objc/default/.gitignore @@ -0,0 +1,53 @@ +# Xcode +# +# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore + +## Build generated +build/ +DerivedData + +## Various settings +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 +xcuserdata + +## Other +*.xccheckout +*.moved-aside +*.xcuserstate +*.xcscmblueprint + +## Obj-C/Swift specific +*.hmap +*.ipa + +# CocoaPods +# +# We recommend against adding the Pods directory to your .gitignore. However +# you should judge for yourself, the pros and cons are mentioned at: +# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control +# +# Pods/ + +# Carthage +# +# Add this line if you want to avoid checking in source code from Carthage dependencies. +# Carthage/Checkouts + +Carthage/Build + +# fastlane +# +# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the +# screenshots whenever they are needed. +# For more information about the recommended setup visit: +# https://github.com/fastlane/fastlane/blob/master/docs/Gitignore.md + +fastlane/report.xml +fastlane/screenshots diff --git a/samples/client/petstore/objc/default/.swagger-codegen-ignore b/samples/client/petstore/objc/default/.swagger-codegen-ignore new file mode 100644 index 00000000000..19d3377182e --- /dev/null +++ b/samples/client/petstore/objc/default/.swagger-codegen-ignore @@ -0,0 +1,23 @@ +# Swagger Codegen Ignore +# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# Thsi matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/petstore/objc/default/LICENSE b/samples/client/petstore/objc/default/LICENSE new file mode 100644 index 00000000000..8dada3edaf5 --- /dev/null +++ b/samples/client/petstore/objc/default/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/samples/client/petstore/objc/default/README.md b/samples/client/petstore/objc/default/README.md new file mode 100644 index 00000000000..c27432d29cc --- /dev/null +++ b/samples/client/petstore/objc/default/README.md @@ -0,0 +1,147 @@ +# SwaggerClient + +This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + +This ObjC package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: + +- API version: 1.0.0 +- Package version: +- Build date: 2016-06-16T11:33:30.448+02:00 +- Build package: class io.swagger.codegen.languages.ObjcClientCodegen + +## Requirements + +The SDK requires [**ARC (Automatic Reference Counting)**](http://stackoverflow.com/questions/7778356/how-to-enable-disable-automatic-reference-counting) to be enabled in the Xcode project. + +## Installation & Usage +### Install from Github using [CocoaPods](https://cocoapods.org/) + +Add the following to the Podfile: + +```ruby +pod 'SwaggerClient', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git' +``` + +To specify a particular branch, append `, :branch => 'branch-name-here'` + +To specify a particular commit, append `, :commit => '11aa22'` + +### Install from local path using [CocoaPods](https://cocoapods.org/) + +Put the SDK under your project folder (e.g. /path/to/objc_project/Vendor/SwaggerClient) and then add the following to the Podfile: + +```ruby +pod 'SwaggerClient', :path => 'Vendor/SwaggerClient' +``` + +### Usage + +Import the following: + +```objc +#import +#import +// load models +#import +#import +#import +#import +#import +// load API classes for accessing endpoints +#import +#import +#import + +``` + +## Recommendation + +It's recommended to create an instance of ApiClient per thread in a multi-threaded environment to avoid any potential issue. + +## Getting Started + +Please follow the [installation procedure](#installation--usage) and then run the following: + +```objc + +SWGConfiguration *apiConfig = [SWGConfiguration sharedConfig]; + +// Configure OAuth2 access token for authorization: (authentication scheme: petstore_auth) +[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"]; + + +SWGPet* *body = [[SWGPet alloc] init]; // Pet object that needs to be added to the store (optional) + +SWGPetApi *apiInstance = [[SWGPetApi alloc] init]; + + // Add a new pet to the store +[apiInstance addPetWithBody:body + completionHandler: ^(NSError* error)) { + if (error) { + NSLog(@"Error: %@", error); + } + }]; + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://petstore.swagger.io/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*SWGPetApi* | [**addPet**](docs/SWGPetApi.md#addpet) | **POST** /pet | Add a new pet to the store +*SWGPetApi* | [**deletePet**](docs/SWGPetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet +*SWGPetApi* | [**findPetsByStatus**](docs/SWGPetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status +*SWGPetApi* | [**findPetsByTags**](docs/SWGPetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags +*SWGPetApi* | [**getPetById**](docs/SWGPetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +*SWGPetApi* | [**updatePet**](docs/SWGPetApi.md#updatepet) | **PUT** /pet | Update an existing pet +*SWGPetApi* | [**updatePetWithForm**](docs/SWGPetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data +*SWGPetApi* | [**uploadFile**](docs/SWGPetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image +*SWGStoreApi* | [**deleteOrder**](docs/SWGStoreApi.md#deleteorder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID +*SWGStoreApi* | [**getInventory**](docs/SWGStoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status +*SWGStoreApi* | [**getOrderById**](docs/SWGStoreApi.md#getorderbyid) | **GET** /store/order/{orderId} | Find purchase order by ID +*SWGStoreApi* | [**placeOrder**](docs/SWGStoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet +*SWGUserApi* | [**createUser**](docs/SWGUserApi.md#createuser) | **POST** /user | Create user +*SWGUserApi* | [**createUsersWithArrayInput**](docs/SWGUserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array +*SWGUserApi* | [**createUsersWithListInput**](docs/SWGUserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array +*SWGUserApi* | [**deleteUser**](docs/SWGUserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user +*SWGUserApi* | [**getUserByName**](docs/SWGUserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name +*SWGUserApi* | [**loginUser**](docs/SWGUserApi.md#loginuser) | **GET** /user/login | Logs user into the system +*SWGUserApi* | [**logoutUser**](docs/SWGUserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session +*SWGUserApi* | [**updateUser**](docs/SWGUserApi.md#updateuser) | **PUT** /user/{username} | Updated user + + +## Documentation For Models + + - [SWGCategory](docs/SWGCategory.md) + - [SWGOrder](docs/SWGOrder.md) + - [SWGPet](docs/SWGPet.md) + - [SWGTag](docs/SWGTag.md) + - [SWGUser](docs/SWGUser.md) + + +## Documentation For Authorization + + +## petstore_auth + +- **Type**: OAuth +- **Flow**: implicit +- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog +- **Scopes**: + - **write:pets**: modify pets in your account + - **read:pets**: read your pets + +## api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + + +## Author + +apiteam@wordnik.com + + diff --git a/samples/client/petstore/objc/default/SwaggerClient.podspec b/samples/client/petstore/objc/default/SwaggerClient.podspec new file mode 100644 index 00000000000..934e35a2a6b --- /dev/null +++ b/samples/client/petstore/objc/default/SwaggerClient.podspec @@ -0,0 +1,37 @@ +# +# Be sure to run `pod lib lint SwaggerClient.podspec' to ensure this is a +# valid spec and remove all comments before submitting the spec. +# +# Any lines starting with a # are optional, but encouraged +# +# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html +# + +Pod::Spec.new do |s| + s.name = "SwaggerClient" + s.version = "1.0.0" + + s.summary = "Swagger Petstore" + s.description = <<-DESC + This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + DESC + + s.platform = :ios, '7.0' + s.requires_arc = true + + s.framework = 'SystemConfiguration' + + s.homepage = "https://github.com/swagger-api/swagger-codegen" + s.license = "Apache License, Version 2.0" + s.source = { :git => "https://github.com/swagger-api/swagger-codegen.git", :tag => "#{s.version}" } + s.author = { "Swagger" => "apiteam@swagger.io" } + + s.source_files = 'SwaggerClient/**/*.{m,h}' + s.public_header_files = 'SwaggerClient/**/*.h' + + + s.dependency 'AFNetworking', '~> 3' + s.dependency 'JSONModel', '~> 1.2' + s.dependency 'ISO8601', '~> 0.5' +end + diff --git a/samples/client/petstore/objc/default/SwaggerClient/Api/SWGPetApi.h b/samples/client/petstore/objc/default/SwaggerClient/Api/SWGPetApi.h new file mode 100644 index 00000000000..97f914a627e --- /dev/null +++ b/samples/client/petstore/objc/default/SwaggerClient/Api/SWGPetApi.h @@ -0,0 +1,150 @@ +#import +#import "SWGPet.h" +#import "SWGApi.h" + +/** +* Swagger Petstore +* This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +* +* OpenAPI spec version: 1.0.0 +* Contact: apiteam@wordnik.com +* +* NOTE: This class is auto generated by the swagger code generator program. +* https://github.com/swagger-api/swagger-codegen.git +* Do not edit the class manually. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +@interface SWGPetApi: NSObject + +extern NSString* kSWGPetApiErrorDomain; +extern NSInteger kSWGPetApiMissingParamErrorCode; + ++(instancetype) sharedAPI; + +/// Add a new pet to the store +/// +/// +/// @param body Pet object that needs to be added to the store (optional) +/// +/// code:405 message:"Invalid input" +/// +/// @return +-(NSNumber*) addPetWithBody: (SWGPet*) body + completionHandler: (void (^)(NSError* error)) handler; + + +/// Deletes a pet +/// +/// +/// @param petId Pet id to delete +/// @param apiKey (optional) +/// +/// code:400 message:"Invalid pet value" +/// +/// @return +-(NSNumber*) deletePetWithPetId: (NSNumber*) petId + apiKey: (NSString*) apiKey + completionHandler: (void (^)(NSError* error)) handler; + + +/// Finds Pets by status +/// Multiple status values can be provided with comma seperated strings +/// +/// @param status Status values that need to be considered for filter (optional) (default to available) +/// +/// code:200 message:"successful operation", +/// code:400 message:"Invalid status value" +/// +/// @return NSArray* +-(NSNumber*) findPetsByStatusWithStatus: (NSArray*) status + completionHandler: (void (^)(NSArray* output, NSError* error)) handler; + + +/// Finds Pets by tags +/// Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. +/// +/// @param tags Tags to filter by (optional) +/// +/// code:200 message:"successful operation", +/// code:400 message:"Invalid tag value" +/// +/// @return NSArray* +-(NSNumber*) findPetsByTagsWithTags: (NSArray*) tags + completionHandler: (void (^)(NSArray* output, NSError* error)) handler; + + +/// Find pet by ID +/// Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions +/// +/// @param petId ID of pet that needs to be fetched +/// +/// code:200 message:"successful operation", +/// code:400 message:"Invalid ID supplied", +/// code:404 message:"Pet not found" +/// +/// @return SWGPet* +-(NSNumber*) getPetByIdWithPetId: (NSNumber*) petId + completionHandler: (void (^)(SWGPet* output, NSError* error)) handler; + + +/// Update an existing pet +/// +/// +/// @param body Pet object that needs to be added to the store (optional) +/// +/// code:400 message:"Invalid ID supplied", +/// code:404 message:"Pet not found", +/// code:405 message:"Validation exception" +/// +/// @return +-(NSNumber*) updatePetWithBody: (SWGPet*) body + completionHandler: (void (^)(NSError* error)) handler; + + +/// Updates a pet in the store with form data +/// +/// +/// @param petId ID of pet that needs to be updated +/// @param name Updated name of the pet (optional) +/// @param status Updated status of the pet (optional) +/// +/// code:405 message:"Invalid input" +/// +/// @return +-(NSNumber*) updatePetWithFormWithPetId: (NSString*) petId + name: (NSString*) name + status: (NSString*) status + completionHandler: (void (^)(NSError* error)) handler; + + +/// uploads an image +/// +/// +/// @param petId ID of pet to update +/// @param additionalMetadata Additional data to pass to server (optional) +/// @param file file to upload (optional) +/// +/// code:0 message:"successful operation" +/// +/// @return +-(NSNumber*) uploadFileWithPetId: (NSNumber*) petId + additionalMetadata: (NSString*) additionalMetadata + file: (NSURL*) file + completionHandler: (void (^)(NSError* error)) handler; + + + +@end diff --git a/samples/client/petstore/objc/default/SwaggerClient/Api/SWGPetApi.m b/samples/client/petstore/objc/default/SwaggerClient/Api/SWGPetApi.m new file mode 100644 index 00000000000..409f5b86655 --- /dev/null +++ b/samples/client/petstore/objc/default/SwaggerClient/Api/SWGPetApi.m @@ -0,0 +1,632 @@ +#import "SWGPetApi.h" +#import "SWGQueryParamCollection.h" +#import "SWGPet.h" + + +@interface SWGPetApi () + +@property (nonatomic, strong) NSMutableDictionary *defaultHeaders; + +@end + +@implementation SWGPetApi + +NSString* kSWGPetApiErrorDomain = @"SWGPetApiErrorDomain"; +NSInteger kSWGPetApiMissingParamErrorCode = 234513; + +@synthesize apiClient = _apiClient; + +#pragma mark - Initialize methods + +- (instancetype) init { + self = [super init]; + if (self) { + SWGConfiguration *config = [SWGConfiguration sharedConfig]; + if (config.apiClient == nil) { + config.apiClient = [[SWGApiClient alloc] init]; + } + _apiClient = config.apiClient; + _defaultHeaders = [NSMutableDictionary dictionary]; + } + return self; +} + +- (id) initWithApiClient:(SWGApiClient *)apiClient { + self = [super init]; + if (self) { + _apiClient = apiClient; + _defaultHeaders = [NSMutableDictionary dictionary]; + } + return self; +} + +#pragma mark - + ++ (instancetype)sharedAPI { + static SWGPetApi *sharedAPI; + static dispatch_once_t once; + dispatch_once(&once, ^{ + sharedAPI = [[self alloc] init]; + }); + return sharedAPI; +} + +-(NSString*) defaultHeaderForKey:(NSString*)key { + return self.defaultHeaders[key]; +} + +-(void) addHeader:(NSString*)value forKey:(NSString*)key { + [self setDefaultHeaderValue:value forKey:key]; +} + +-(void) setDefaultHeaderValue:(NSString*) value forKey:(NSString*)key { + [self.defaultHeaders setValue:value forKey:key]; +} + +-(NSUInteger) requestQueueSize { + return [SWGApiClient requestQueueSize]; +} + +#pragma mark - Api Methods + +/// +/// Add a new pet to the store +/// +/// @param body Pet object that needs to be added to the store (optional) +/// +/// @returns void +/// +-(NSNumber*) addPetWithBody: (SWGPet*) body + completionHandler: (void (^)(NSError* error)) handler { + NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/pet"]; + + // remove format in URL if needed + [resourcePath replaceOccurrencesOfString:@".{format}" withString:@".json" options:0 range:NSMakeRange(0,resourcePath.length)]; + + NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init]; + + NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; + NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.apiClient.configuration.defaultHeaders]; + [headerParams addEntriesFromDictionary:self.defaultHeaders]; + // HTTP header `Accept` + NSString *acceptHeader = [self.apiClient.sanitizer selectHeaderAccept:@[@"application/json", @"application/xml"]]; + if(acceptHeader.length > 0) { + headerParams[@"Accept"] = acceptHeader; + } + + // response content type + NSString *responseContentType = [[acceptHeader componentsSeparatedByString:@", "] firstObject] ?: @""; + + // request content type + NSString *requestContentType = [self.apiClient.sanitizer selectHeaderContentType:@[@"application/json", @"application/xml"]]; + + // Authentication setting + NSArray *authSettings = @[@"petstore_auth"]; + + id bodyParam = nil; + NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; + NSMutableDictionary *localVarFiles = [[NSMutableDictionary alloc] init]; + bodyParam = body; + + return [self.apiClient requestWithPath: resourcePath + method: @"POST" + pathParams: pathParams + queryParams: queryParams + formParams: formParams + files: localVarFiles + body: bodyParam + headerParams: headerParams + authSettings: authSettings + requestContentType: requestContentType + responseContentType: responseContentType + responseType: nil + completionBlock: ^(id data, NSError *error) { + if(handler) { + handler(error); + } + } + ]; +} + +/// +/// Deletes a pet +/// +/// @param petId Pet id to delete +/// +/// @param apiKey (optional) +/// +/// @returns void +/// +-(NSNumber*) deletePetWithPetId: (NSNumber*) petId + apiKey: (NSString*) apiKey + completionHandler: (void (^)(NSError* error)) handler { + // verify the required parameter 'petId' is set + if (petId == nil) { + NSParameterAssert(petId); + if(handler) { + NSDictionary * userInfo = @{NSLocalizedDescriptionKey : [NSString stringWithFormat:NSLocalizedString(@"Missing required parameter '%@'", nil),@"petId"] }; + NSError* error = [NSError errorWithDomain:kSWGPetApiErrorDomain code:kSWGPetApiMissingParamErrorCode userInfo:userInfo]; + handler(error); + } + return nil; + } + + NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/pet/{petId}"]; + + // remove format in URL if needed + [resourcePath replaceOccurrencesOfString:@".{format}" withString:@".json" options:0 range:NSMakeRange(0,resourcePath.length)]; + + NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init]; + if (petId != nil) { + pathParams[@"petId"] = petId; + } + + NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; + NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.apiClient.configuration.defaultHeaders]; + [headerParams addEntriesFromDictionary:self.defaultHeaders]; + if (apiKey != nil) { + headerParams[@"api_key"] = apiKey; + } + // HTTP header `Accept` + NSString *acceptHeader = [self.apiClient.sanitizer selectHeaderAccept:@[@"application/json", @"application/xml"]]; + if(acceptHeader.length > 0) { + headerParams[@"Accept"] = acceptHeader; + } + + // response content type + NSString *responseContentType = [[acceptHeader componentsSeparatedByString:@", "] firstObject] ?: @""; + + // request content type + NSString *requestContentType = [self.apiClient.sanitizer selectHeaderContentType:@[]]; + + // Authentication setting + NSArray *authSettings = @[@"petstore_auth"]; + + id bodyParam = nil; + NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; + NSMutableDictionary *localVarFiles = [[NSMutableDictionary alloc] init]; + + return [self.apiClient requestWithPath: resourcePath + method: @"DELETE" + pathParams: pathParams + queryParams: queryParams + formParams: formParams + files: localVarFiles + body: bodyParam + headerParams: headerParams + authSettings: authSettings + requestContentType: requestContentType + responseContentType: responseContentType + responseType: nil + completionBlock: ^(id data, NSError *error) { + if(handler) { + handler(error); + } + } + ]; +} + +/// +/// Finds Pets by status +/// Multiple status values can be provided with comma seperated strings +/// @param status Status values that need to be considered for filter (optional, default to available) +/// +/// @returns NSArray* +/// +-(NSNumber*) findPetsByStatusWithStatus: (NSArray*) status + completionHandler: (void (^)(NSArray* output, NSError* error)) handler { + NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/pet/findByStatus"]; + + // remove format in URL if needed + [resourcePath replaceOccurrencesOfString:@".{format}" withString:@".json" options:0 range:NSMakeRange(0,resourcePath.length)]; + + NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init]; + + NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; + if (status != nil) { + queryParams[@"status"] = [[SWGQueryParamCollection alloc] initWithValuesAndFormat: status format: @"multi"]; + + } + NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.apiClient.configuration.defaultHeaders]; + [headerParams addEntriesFromDictionary:self.defaultHeaders]; + // HTTP header `Accept` + NSString *acceptHeader = [self.apiClient.sanitizer selectHeaderAccept:@[@"application/json", @"application/xml"]]; + if(acceptHeader.length > 0) { + headerParams[@"Accept"] = acceptHeader; + } + + // response content type + NSString *responseContentType = [[acceptHeader componentsSeparatedByString:@", "] firstObject] ?: @""; + + // request content type + NSString *requestContentType = [self.apiClient.sanitizer selectHeaderContentType:@[]]; + + // Authentication setting + NSArray *authSettings = @[@"petstore_auth"]; + + id bodyParam = nil; + NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; + NSMutableDictionary *localVarFiles = [[NSMutableDictionary alloc] init]; + + return [self.apiClient requestWithPath: resourcePath + method: @"GET" + pathParams: pathParams + queryParams: queryParams + formParams: formParams + files: localVarFiles + body: bodyParam + headerParams: headerParams + authSettings: authSettings + requestContentType: requestContentType + responseContentType: responseContentType + responseType: @"NSArray*" + completionBlock: ^(id data, NSError *error) { + if(handler) { + handler((NSArray*)data, error); + } + } + ]; +} + +/// +/// Finds Pets by tags +/// Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. +/// @param tags Tags to filter by (optional) +/// +/// @returns NSArray* +/// +-(NSNumber*) findPetsByTagsWithTags: (NSArray*) tags + completionHandler: (void (^)(NSArray* output, NSError* error)) handler { + NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/pet/findByTags"]; + + // remove format in URL if needed + [resourcePath replaceOccurrencesOfString:@".{format}" withString:@".json" options:0 range:NSMakeRange(0,resourcePath.length)]; + + NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init]; + + NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; + if (tags != nil) { + queryParams[@"tags"] = [[SWGQueryParamCollection alloc] initWithValuesAndFormat: tags format: @"multi"]; + + } + NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.apiClient.configuration.defaultHeaders]; + [headerParams addEntriesFromDictionary:self.defaultHeaders]; + // HTTP header `Accept` + NSString *acceptHeader = [self.apiClient.sanitizer selectHeaderAccept:@[@"application/json", @"application/xml"]]; + if(acceptHeader.length > 0) { + headerParams[@"Accept"] = acceptHeader; + } + + // response content type + NSString *responseContentType = [[acceptHeader componentsSeparatedByString:@", "] firstObject] ?: @""; + + // request content type + NSString *requestContentType = [self.apiClient.sanitizer selectHeaderContentType:@[]]; + + // Authentication setting + NSArray *authSettings = @[@"petstore_auth"]; + + id bodyParam = nil; + NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; + NSMutableDictionary *localVarFiles = [[NSMutableDictionary alloc] init]; + + return [self.apiClient requestWithPath: resourcePath + method: @"GET" + pathParams: pathParams + queryParams: queryParams + formParams: formParams + files: localVarFiles + body: bodyParam + headerParams: headerParams + authSettings: authSettings + requestContentType: requestContentType + responseContentType: responseContentType + responseType: @"NSArray*" + completionBlock: ^(id data, NSError *error) { + if(handler) { + handler((NSArray*)data, error); + } + } + ]; +} + +/// +/// Find pet by ID +/// Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions +/// @param petId ID of pet that needs to be fetched +/// +/// @returns SWGPet* +/// +-(NSNumber*) getPetByIdWithPetId: (NSNumber*) petId + completionHandler: (void (^)(SWGPet* output, NSError* error)) handler { + // verify the required parameter 'petId' is set + if (petId == nil) { + NSParameterAssert(petId); + if(handler) { + NSDictionary * userInfo = @{NSLocalizedDescriptionKey : [NSString stringWithFormat:NSLocalizedString(@"Missing required parameter '%@'", nil),@"petId"] }; + NSError* error = [NSError errorWithDomain:kSWGPetApiErrorDomain code:kSWGPetApiMissingParamErrorCode userInfo:userInfo]; + handler(nil, error); + } + return nil; + } + + NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/pet/{petId}"]; + + // remove format in URL if needed + [resourcePath replaceOccurrencesOfString:@".{format}" withString:@".json" options:0 range:NSMakeRange(0,resourcePath.length)]; + + NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init]; + if (petId != nil) { + pathParams[@"petId"] = petId; + } + + NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; + NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.apiClient.configuration.defaultHeaders]; + [headerParams addEntriesFromDictionary:self.defaultHeaders]; + // HTTP header `Accept` + NSString *acceptHeader = [self.apiClient.sanitizer selectHeaderAccept:@[@"application/json", @"application/xml"]]; + if(acceptHeader.length > 0) { + headerParams[@"Accept"] = acceptHeader; + } + + // response content type + NSString *responseContentType = [[acceptHeader componentsSeparatedByString:@", "] firstObject] ?: @""; + + // request content type + NSString *requestContentType = [self.apiClient.sanitizer selectHeaderContentType:@[]]; + + // Authentication setting + NSArray *authSettings = @[@"petstore_auth", @"api_key"]; + + id bodyParam = nil; + NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; + NSMutableDictionary *localVarFiles = [[NSMutableDictionary alloc] init]; + + return [self.apiClient requestWithPath: resourcePath + method: @"GET" + pathParams: pathParams + queryParams: queryParams + formParams: formParams + files: localVarFiles + body: bodyParam + headerParams: headerParams + authSettings: authSettings + requestContentType: requestContentType + responseContentType: responseContentType + responseType: @"SWGPet*" + completionBlock: ^(id data, NSError *error) { + if(handler) { + handler((SWGPet*)data, error); + } + } + ]; +} + +/// +/// Update an existing pet +/// +/// @param body Pet object that needs to be added to the store (optional) +/// +/// @returns void +/// +-(NSNumber*) updatePetWithBody: (SWGPet*) body + completionHandler: (void (^)(NSError* error)) handler { + NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/pet"]; + + // remove format in URL if needed + [resourcePath replaceOccurrencesOfString:@".{format}" withString:@".json" options:0 range:NSMakeRange(0,resourcePath.length)]; + + NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init]; + + NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; + NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.apiClient.configuration.defaultHeaders]; + [headerParams addEntriesFromDictionary:self.defaultHeaders]; + // HTTP header `Accept` + NSString *acceptHeader = [self.apiClient.sanitizer selectHeaderAccept:@[@"application/json", @"application/xml"]]; + if(acceptHeader.length > 0) { + headerParams[@"Accept"] = acceptHeader; + } + + // response content type + NSString *responseContentType = [[acceptHeader componentsSeparatedByString:@", "] firstObject] ?: @""; + + // request content type + NSString *requestContentType = [self.apiClient.sanitizer selectHeaderContentType:@[@"application/json", @"application/xml"]]; + + // Authentication setting + NSArray *authSettings = @[@"petstore_auth"]; + + id bodyParam = nil; + NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; + NSMutableDictionary *localVarFiles = [[NSMutableDictionary alloc] init]; + bodyParam = body; + + return [self.apiClient requestWithPath: resourcePath + method: @"PUT" + pathParams: pathParams + queryParams: queryParams + formParams: formParams + files: localVarFiles + body: bodyParam + headerParams: headerParams + authSettings: authSettings + requestContentType: requestContentType + responseContentType: responseContentType + responseType: nil + completionBlock: ^(id data, NSError *error) { + if(handler) { + handler(error); + } + } + ]; +} + +/// +/// Updates a pet in the store with form data +/// +/// @param petId ID of pet that needs to be updated +/// +/// @param name Updated name of the pet (optional) +/// +/// @param status Updated status of the pet (optional) +/// +/// @returns void +/// +-(NSNumber*) updatePetWithFormWithPetId: (NSString*) petId + name: (NSString*) name + status: (NSString*) status + completionHandler: (void (^)(NSError* error)) handler { + // verify the required parameter 'petId' is set + if (petId == nil) { + NSParameterAssert(petId); + if(handler) { + NSDictionary * userInfo = @{NSLocalizedDescriptionKey : [NSString stringWithFormat:NSLocalizedString(@"Missing required parameter '%@'", nil),@"petId"] }; + NSError* error = [NSError errorWithDomain:kSWGPetApiErrorDomain code:kSWGPetApiMissingParamErrorCode userInfo:userInfo]; + handler(error); + } + return nil; + } + + NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/pet/{petId}"]; + + // remove format in URL if needed + [resourcePath replaceOccurrencesOfString:@".{format}" withString:@".json" options:0 range:NSMakeRange(0,resourcePath.length)]; + + NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init]; + if (petId != nil) { + pathParams[@"petId"] = petId; + } + + NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; + NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.apiClient.configuration.defaultHeaders]; + [headerParams addEntriesFromDictionary:self.defaultHeaders]; + // HTTP header `Accept` + NSString *acceptHeader = [self.apiClient.sanitizer selectHeaderAccept:@[@"application/json", @"application/xml"]]; + if(acceptHeader.length > 0) { + headerParams[@"Accept"] = acceptHeader; + } + + // response content type + NSString *responseContentType = [[acceptHeader componentsSeparatedByString:@", "] firstObject] ?: @""; + + // request content type + NSString *requestContentType = [self.apiClient.sanitizer selectHeaderContentType:@[@"application/x-www-form-urlencoded"]]; + + // Authentication setting + NSArray *authSettings = @[@"petstore_auth"]; + + id bodyParam = nil; + NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; + NSMutableDictionary *localVarFiles = [[NSMutableDictionary alloc] init]; + if (name) { + formParams[@"name"] = name; + } + if (status) { + formParams[@"status"] = status; + } + + return [self.apiClient requestWithPath: resourcePath + method: @"POST" + pathParams: pathParams + queryParams: queryParams + formParams: formParams + files: localVarFiles + body: bodyParam + headerParams: headerParams + authSettings: authSettings + requestContentType: requestContentType + responseContentType: responseContentType + responseType: nil + completionBlock: ^(id data, NSError *error) { + if(handler) { + handler(error); + } + } + ]; +} + +/// +/// uploads an image +/// +/// @param petId ID of pet to update +/// +/// @param additionalMetadata Additional data to pass to server (optional) +/// +/// @param file file to upload (optional) +/// +/// @returns void +/// +-(NSNumber*) uploadFileWithPetId: (NSNumber*) petId + additionalMetadata: (NSString*) additionalMetadata + file: (NSURL*) file + completionHandler: (void (^)(NSError* error)) handler { + // verify the required parameter 'petId' is set + if (petId == nil) { + NSParameterAssert(petId); + if(handler) { + NSDictionary * userInfo = @{NSLocalizedDescriptionKey : [NSString stringWithFormat:NSLocalizedString(@"Missing required parameter '%@'", nil),@"petId"] }; + NSError* error = [NSError errorWithDomain:kSWGPetApiErrorDomain code:kSWGPetApiMissingParamErrorCode userInfo:userInfo]; + handler(error); + } + return nil; + } + + NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/pet/{petId}/uploadImage"]; + + // remove format in URL if needed + [resourcePath replaceOccurrencesOfString:@".{format}" withString:@".json" options:0 range:NSMakeRange(0,resourcePath.length)]; + + NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init]; + if (petId != nil) { + pathParams[@"petId"] = petId; + } + + NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; + NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.apiClient.configuration.defaultHeaders]; + [headerParams addEntriesFromDictionary:self.defaultHeaders]; + // HTTP header `Accept` + NSString *acceptHeader = [self.apiClient.sanitizer selectHeaderAccept:@[@"application/json", @"application/xml"]]; + if(acceptHeader.length > 0) { + headerParams[@"Accept"] = acceptHeader; + } + + // response content type + NSString *responseContentType = [[acceptHeader componentsSeparatedByString:@", "] firstObject] ?: @""; + + // request content type + NSString *requestContentType = [self.apiClient.sanitizer selectHeaderContentType:@[@"multipart/form-data"]]; + + // Authentication setting + NSArray *authSettings = @[@"petstore_auth"]; + + id bodyParam = nil; + NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; + NSMutableDictionary *localVarFiles = [[NSMutableDictionary alloc] init]; + if (additionalMetadata) { + formParams[@"additionalMetadata"] = additionalMetadata; + } + localVarFiles[@"file"] = file; + + return [self.apiClient requestWithPath: resourcePath + method: @"POST" + pathParams: pathParams + queryParams: queryParams + formParams: formParams + files: localVarFiles + body: bodyParam + headerParams: headerParams + authSettings: authSettings + requestContentType: requestContentType + responseContentType: responseContentType + responseType: nil + completionBlock: ^(id data, NSError *error) { + if(handler) { + handler(error); + } + } + ]; +} + + + +@end diff --git a/samples/client/petstore/objc/default/SwaggerClient/Api/SWGStoreApi.h b/samples/client/petstore/objc/default/SwaggerClient/Api/SWGStoreApi.h new file mode 100644 index 00000000000..bbd588dba25 --- /dev/null +++ b/samples/client/petstore/objc/default/SwaggerClient/Api/SWGStoreApi.h @@ -0,0 +1,89 @@ +#import +#import "SWGOrder.h" +#import "SWGApi.h" + +/** +* Swagger Petstore +* This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +* +* OpenAPI spec version: 1.0.0 +* Contact: apiteam@wordnik.com +* +* NOTE: This class is auto generated by the swagger code generator program. +* https://github.com/swagger-api/swagger-codegen.git +* Do not edit the class manually. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +@interface SWGStoreApi: NSObject + +extern NSString* kSWGStoreApiErrorDomain; +extern NSInteger kSWGStoreApiMissingParamErrorCode; + ++(instancetype) sharedAPI; + +/// Delete purchase order by ID +/// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors +/// +/// @param orderId ID of the order that needs to be deleted +/// +/// code:400 message:"Invalid ID supplied", +/// code:404 message:"Order not found" +/// +/// @return +-(NSNumber*) deleteOrderWithOrderId: (NSString*) orderId + completionHandler: (void (^)(NSError* error)) handler; + + +/// Returns pet inventories by status +/// Returns a map of status codes to quantities +/// +/// +/// code:200 message:"successful operation" +/// +/// @return NSDictionary* +-(NSNumber*) getInventoryWithCompletionHandler: + (void (^)(NSDictionary* output, NSError* error)) handler; + + +/// Find purchase order by ID +/// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions +/// +/// @param orderId ID of pet that needs to be fetched +/// +/// code:200 message:"successful operation", +/// code:400 message:"Invalid ID supplied", +/// code:404 message:"Order not found" +/// +/// @return SWGOrder* +-(NSNumber*) getOrderByIdWithOrderId: (NSString*) orderId + completionHandler: (void (^)(SWGOrder* output, NSError* error)) handler; + + +/// Place an order for a pet +/// +/// +/// @param body order placed for purchasing the pet (optional) +/// +/// code:200 message:"successful operation", +/// code:400 message:"Invalid Order" +/// +/// @return SWGOrder* +-(NSNumber*) placeOrderWithBody: (SWGOrder*) body + completionHandler: (void (^)(SWGOrder* output, NSError* error)) handler; + + + +@end diff --git a/samples/client/petstore/objc/default/SwaggerClient/Api/SWGStoreApi.m b/samples/client/petstore/objc/default/SwaggerClient/Api/SWGStoreApi.m new file mode 100644 index 00000000000..e5964200f20 --- /dev/null +++ b/samples/client/petstore/objc/default/SwaggerClient/Api/SWGStoreApi.m @@ -0,0 +1,333 @@ +#import "SWGStoreApi.h" +#import "SWGQueryParamCollection.h" +#import "SWGOrder.h" + + +@interface SWGStoreApi () + +@property (nonatomic, strong) NSMutableDictionary *defaultHeaders; + +@end + +@implementation SWGStoreApi + +NSString* kSWGStoreApiErrorDomain = @"SWGStoreApiErrorDomain"; +NSInteger kSWGStoreApiMissingParamErrorCode = 234513; + +@synthesize apiClient = _apiClient; + +#pragma mark - Initialize methods + +- (instancetype) init { + self = [super init]; + if (self) { + SWGConfiguration *config = [SWGConfiguration sharedConfig]; + if (config.apiClient == nil) { + config.apiClient = [[SWGApiClient alloc] init]; + } + _apiClient = config.apiClient; + _defaultHeaders = [NSMutableDictionary dictionary]; + } + return self; +} + +- (id) initWithApiClient:(SWGApiClient *)apiClient { + self = [super init]; + if (self) { + _apiClient = apiClient; + _defaultHeaders = [NSMutableDictionary dictionary]; + } + return self; +} + +#pragma mark - + ++ (instancetype)sharedAPI { + static SWGStoreApi *sharedAPI; + static dispatch_once_t once; + dispatch_once(&once, ^{ + sharedAPI = [[self alloc] init]; + }); + return sharedAPI; +} + +-(NSString*) defaultHeaderForKey:(NSString*)key { + return self.defaultHeaders[key]; +} + +-(void) addHeader:(NSString*)value forKey:(NSString*)key { + [self setDefaultHeaderValue:value forKey:key]; +} + +-(void) setDefaultHeaderValue:(NSString*) value forKey:(NSString*)key { + [self.defaultHeaders setValue:value forKey:key]; +} + +-(NSUInteger) requestQueueSize { + return [SWGApiClient requestQueueSize]; +} + +#pragma mark - Api Methods + +/// +/// Delete purchase order by ID +/// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors +/// @param orderId ID of the order that needs to be deleted +/// +/// @returns void +/// +-(NSNumber*) deleteOrderWithOrderId: (NSString*) orderId + completionHandler: (void (^)(NSError* error)) handler { + // verify the required parameter 'orderId' is set + if (orderId == nil) { + NSParameterAssert(orderId); + if(handler) { + NSDictionary * userInfo = @{NSLocalizedDescriptionKey : [NSString stringWithFormat:NSLocalizedString(@"Missing required parameter '%@'", nil),@"orderId"] }; + NSError* error = [NSError errorWithDomain:kSWGStoreApiErrorDomain code:kSWGStoreApiMissingParamErrorCode userInfo:userInfo]; + handler(error); + } + return nil; + } + + NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/store/order/{orderId}"]; + + // remove format in URL if needed + [resourcePath replaceOccurrencesOfString:@".{format}" withString:@".json" options:0 range:NSMakeRange(0,resourcePath.length)]; + + NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init]; + if (orderId != nil) { + pathParams[@"orderId"] = orderId; + } + + NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; + NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.apiClient.configuration.defaultHeaders]; + [headerParams addEntriesFromDictionary:self.defaultHeaders]; + // HTTP header `Accept` + NSString *acceptHeader = [self.apiClient.sanitizer selectHeaderAccept:@[@"application/json", @"application/xml"]]; + if(acceptHeader.length > 0) { + headerParams[@"Accept"] = acceptHeader; + } + + // response content type + NSString *responseContentType = [[acceptHeader componentsSeparatedByString:@", "] firstObject] ?: @""; + + // request content type + NSString *requestContentType = [self.apiClient.sanitizer selectHeaderContentType:@[]]; + + // Authentication setting + NSArray *authSettings = @[]; + + id bodyParam = nil; + NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; + NSMutableDictionary *localVarFiles = [[NSMutableDictionary alloc] init]; + + return [self.apiClient requestWithPath: resourcePath + method: @"DELETE" + pathParams: pathParams + queryParams: queryParams + formParams: formParams + files: localVarFiles + body: bodyParam + headerParams: headerParams + authSettings: authSettings + requestContentType: requestContentType + responseContentType: responseContentType + responseType: nil + completionBlock: ^(id data, NSError *error) { + if(handler) { + handler(error); + } + } + ]; +} + +/// +/// Returns pet inventories by status +/// Returns a map of status codes to quantities +/// @returns NSDictionary* +/// +-(NSNumber*) getInventoryWithCompletionHandler: + (void (^)(NSDictionary* output, NSError* error)) handler { + NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/store/inventory"]; + + // remove format in URL if needed + [resourcePath replaceOccurrencesOfString:@".{format}" withString:@".json" options:0 range:NSMakeRange(0,resourcePath.length)]; + + NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init]; + + NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; + NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.apiClient.configuration.defaultHeaders]; + [headerParams addEntriesFromDictionary:self.defaultHeaders]; + // HTTP header `Accept` + NSString *acceptHeader = [self.apiClient.sanitizer selectHeaderAccept:@[@"application/json", @"application/xml"]]; + if(acceptHeader.length > 0) { + headerParams[@"Accept"] = acceptHeader; + } + + // response content type + NSString *responseContentType = [[acceptHeader componentsSeparatedByString:@", "] firstObject] ?: @""; + + // request content type + NSString *requestContentType = [self.apiClient.sanitizer selectHeaderContentType:@[]]; + + // Authentication setting + NSArray *authSettings = @[@"api_key"]; + + id bodyParam = nil; + NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; + NSMutableDictionary *localVarFiles = [[NSMutableDictionary alloc] init]; + + return [self.apiClient requestWithPath: resourcePath + method: @"GET" + pathParams: pathParams + queryParams: queryParams + formParams: formParams + files: localVarFiles + body: bodyParam + headerParams: headerParams + authSettings: authSettings + requestContentType: requestContentType + responseContentType: responseContentType + responseType: @"NSDictionary*" + completionBlock: ^(id data, NSError *error) { + if(handler) { + handler((NSDictionary*)data, error); + } + } + ]; +} + +/// +/// Find purchase order by ID +/// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions +/// @param orderId ID of pet that needs to be fetched +/// +/// @returns SWGOrder* +/// +-(NSNumber*) getOrderByIdWithOrderId: (NSString*) orderId + completionHandler: (void (^)(SWGOrder* output, NSError* error)) handler { + // verify the required parameter 'orderId' is set + if (orderId == nil) { + NSParameterAssert(orderId); + if(handler) { + NSDictionary * userInfo = @{NSLocalizedDescriptionKey : [NSString stringWithFormat:NSLocalizedString(@"Missing required parameter '%@'", nil),@"orderId"] }; + NSError* error = [NSError errorWithDomain:kSWGStoreApiErrorDomain code:kSWGStoreApiMissingParamErrorCode userInfo:userInfo]; + handler(nil, error); + } + return nil; + } + + NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/store/order/{orderId}"]; + + // remove format in URL if needed + [resourcePath replaceOccurrencesOfString:@".{format}" withString:@".json" options:0 range:NSMakeRange(0,resourcePath.length)]; + + NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init]; + if (orderId != nil) { + pathParams[@"orderId"] = orderId; + } + + NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; + NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.apiClient.configuration.defaultHeaders]; + [headerParams addEntriesFromDictionary:self.defaultHeaders]; + // HTTP header `Accept` + NSString *acceptHeader = [self.apiClient.sanitizer selectHeaderAccept:@[@"application/json", @"application/xml"]]; + if(acceptHeader.length > 0) { + headerParams[@"Accept"] = acceptHeader; + } + + // response content type + NSString *responseContentType = [[acceptHeader componentsSeparatedByString:@", "] firstObject] ?: @""; + + // request content type + NSString *requestContentType = [self.apiClient.sanitizer selectHeaderContentType:@[]]; + + // Authentication setting + NSArray *authSettings = @[]; + + id bodyParam = nil; + NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; + NSMutableDictionary *localVarFiles = [[NSMutableDictionary alloc] init]; + + return [self.apiClient requestWithPath: resourcePath + method: @"GET" + pathParams: pathParams + queryParams: queryParams + formParams: formParams + files: localVarFiles + body: bodyParam + headerParams: headerParams + authSettings: authSettings + requestContentType: requestContentType + responseContentType: responseContentType + responseType: @"SWGOrder*" + completionBlock: ^(id data, NSError *error) { + if(handler) { + handler((SWGOrder*)data, error); + } + } + ]; +} + +/// +/// Place an order for a pet +/// +/// @param body order placed for purchasing the pet (optional) +/// +/// @returns SWGOrder* +/// +-(NSNumber*) placeOrderWithBody: (SWGOrder*) body + completionHandler: (void (^)(SWGOrder* output, NSError* error)) handler { + NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/store/order"]; + + // remove format in URL if needed + [resourcePath replaceOccurrencesOfString:@".{format}" withString:@".json" options:0 range:NSMakeRange(0,resourcePath.length)]; + + NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init]; + + NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; + NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.apiClient.configuration.defaultHeaders]; + [headerParams addEntriesFromDictionary:self.defaultHeaders]; + // HTTP header `Accept` + NSString *acceptHeader = [self.apiClient.sanitizer selectHeaderAccept:@[@"application/json", @"application/xml"]]; + if(acceptHeader.length > 0) { + headerParams[@"Accept"] = acceptHeader; + } + + // response content type + NSString *responseContentType = [[acceptHeader componentsSeparatedByString:@", "] firstObject] ?: @""; + + // request content type + NSString *requestContentType = [self.apiClient.sanitizer selectHeaderContentType:@[]]; + + // Authentication setting + NSArray *authSettings = @[]; + + id bodyParam = nil; + NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; + NSMutableDictionary *localVarFiles = [[NSMutableDictionary alloc] init]; + bodyParam = body; + + return [self.apiClient requestWithPath: resourcePath + method: @"POST" + pathParams: pathParams + queryParams: queryParams + formParams: formParams + files: localVarFiles + body: bodyParam + headerParams: headerParams + authSettings: authSettings + requestContentType: requestContentType + responseContentType: responseContentType + responseType: @"SWGOrder*" + completionBlock: ^(id data, NSError *error) { + if(handler) { + handler((SWGOrder*)data, error); + } + } + ]; +} + + + +@end diff --git a/samples/client/petstore/objc/default/SwaggerClient/Api/SWGUserApi.h b/samples/client/petstore/objc/default/SwaggerClient/Api/SWGUserApi.h new file mode 100644 index 00000000000..67f8ec9cbb2 --- /dev/null +++ b/samples/client/petstore/objc/default/SwaggerClient/Api/SWGUserApi.h @@ -0,0 +1,142 @@ +#import +#import "SWGUser.h" +#import "SWGApi.h" + +/** +* Swagger Petstore +* This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +* +* OpenAPI spec version: 1.0.0 +* Contact: apiteam@wordnik.com +* +* NOTE: This class is auto generated by the swagger code generator program. +* https://github.com/swagger-api/swagger-codegen.git +* Do not edit the class manually. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +@interface SWGUserApi: NSObject + +extern NSString* kSWGUserApiErrorDomain; +extern NSInteger kSWGUserApiMissingParamErrorCode; + ++(instancetype) sharedAPI; + +/// Create user +/// This can only be done by the logged in user. +/// +/// @param body Created user object (optional) +/// +/// code:0 message:"successful operation" +/// +/// @return +-(NSNumber*) createUserWithBody: (SWGUser*) body + completionHandler: (void (^)(NSError* error)) handler; + + +/// Creates list of users with given input array +/// +/// +/// @param body List of user object (optional) +/// +/// code:0 message:"successful operation" +/// +/// @return +-(NSNumber*) createUsersWithArrayInputWithBody: (NSArray*) body + completionHandler: (void (^)(NSError* error)) handler; + + +/// Creates list of users with given input array +/// +/// +/// @param body List of user object (optional) +/// +/// code:0 message:"successful operation" +/// +/// @return +-(NSNumber*) createUsersWithListInputWithBody: (NSArray*) body + completionHandler: (void (^)(NSError* error)) handler; + + +/// Delete user +/// This can only be done by the logged in user. +/// +/// @param username The name that needs to be deleted +/// +/// code:400 message:"Invalid username supplied", +/// code:404 message:"User not found" +/// +/// @return +-(NSNumber*) deleteUserWithUsername: (NSString*) username + completionHandler: (void (^)(NSError* error)) handler; + + +/// Get user by user name +/// +/// +/// @param username The name that needs to be fetched. Use user1 for testing. +/// +/// code:200 message:"successful operation", +/// code:400 message:"Invalid username supplied", +/// code:404 message:"User not found" +/// +/// @return SWGUser* +-(NSNumber*) getUserByNameWithUsername: (NSString*) username + completionHandler: (void (^)(SWGUser* output, NSError* error)) handler; + + +/// Logs user into the system +/// +/// +/// @param username The user name for login (optional) +/// @param password The password for login in clear text (optional) +/// +/// code:200 message:"successful operation", +/// code:400 message:"Invalid username/password supplied" +/// +/// @return NSString* +-(NSNumber*) loginUserWithUsername: (NSString*) username + password: (NSString*) password + completionHandler: (void (^)(NSString* output, NSError* error)) handler; + + +/// Logs out current logged in user session +/// +/// +/// +/// code:0 message:"successful operation" +/// +/// @return +-(NSNumber*) logoutUserWithCompletionHandler: + (void (^)(NSError* error)) handler; + + +/// Updated user +/// This can only be done by the logged in user. +/// +/// @param username name that need to be deleted +/// @param body Updated user object (optional) +/// +/// code:400 message:"Invalid user supplied", +/// code:404 message:"User not found" +/// +/// @return +-(NSNumber*) updateUserWithUsername: (NSString*) username + body: (SWGUser*) body + completionHandler: (void (^)(NSError* error)) handler; + + + +@end diff --git a/samples/client/petstore/objc/default/SwaggerClient/Api/SWGUserApi.m b/samples/client/petstore/objc/default/SwaggerClient/Api/SWGUserApi.m new file mode 100644 index 00000000000..6ffb578ed76 --- /dev/null +++ b/samples/client/petstore/objc/default/SwaggerClient/Api/SWGUserApi.m @@ -0,0 +1,594 @@ +#import "SWGUserApi.h" +#import "SWGQueryParamCollection.h" +#import "SWGUser.h" + + +@interface SWGUserApi () + +@property (nonatomic, strong) NSMutableDictionary *defaultHeaders; + +@end + +@implementation SWGUserApi + +NSString* kSWGUserApiErrorDomain = @"SWGUserApiErrorDomain"; +NSInteger kSWGUserApiMissingParamErrorCode = 234513; + +@synthesize apiClient = _apiClient; + +#pragma mark - Initialize methods + +- (instancetype) init { + self = [super init]; + if (self) { + SWGConfiguration *config = [SWGConfiguration sharedConfig]; + if (config.apiClient == nil) { + config.apiClient = [[SWGApiClient alloc] init]; + } + _apiClient = config.apiClient; + _defaultHeaders = [NSMutableDictionary dictionary]; + } + return self; +} + +- (id) initWithApiClient:(SWGApiClient *)apiClient { + self = [super init]; + if (self) { + _apiClient = apiClient; + _defaultHeaders = [NSMutableDictionary dictionary]; + } + return self; +} + +#pragma mark - + ++ (instancetype)sharedAPI { + static SWGUserApi *sharedAPI; + static dispatch_once_t once; + dispatch_once(&once, ^{ + sharedAPI = [[self alloc] init]; + }); + return sharedAPI; +} + +-(NSString*) defaultHeaderForKey:(NSString*)key { + return self.defaultHeaders[key]; +} + +-(void) addHeader:(NSString*)value forKey:(NSString*)key { + [self setDefaultHeaderValue:value forKey:key]; +} + +-(void) setDefaultHeaderValue:(NSString*) value forKey:(NSString*)key { + [self.defaultHeaders setValue:value forKey:key]; +} + +-(NSUInteger) requestQueueSize { + return [SWGApiClient requestQueueSize]; +} + +#pragma mark - Api Methods + +/// +/// Create user +/// This can only be done by the logged in user. +/// @param body Created user object (optional) +/// +/// @returns void +/// +-(NSNumber*) createUserWithBody: (SWGUser*) body + completionHandler: (void (^)(NSError* error)) handler { + NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/user"]; + + // remove format in URL if needed + [resourcePath replaceOccurrencesOfString:@".{format}" withString:@".json" options:0 range:NSMakeRange(0,resourcePath.length)]; + + NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init]; + + NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; + NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.apiClient.configuration.defaultHeaders]; + [headerParams addEntriesFromDictionary:self.defaultHeaders]; + // HTTP header `Accept` + NSString *acceptHeader = [self.apiClient.sanitizer selectHeaderAccept:@[@"application/json", @"application/xml"]]; + if(acceptHeader.length > 0) { + headerParams[@"Accept"] = acceptHeader; + } + + // response content type + NSString *responseContentType = [[acceptHeader componentsSeparatedByString:@", "] firstObject] ?: @""; + + // request content type + NSString *requestContentType = [self.apiClient.sanitizer selectHeaderContentType:@[]]; + + // Authentication setting + NSArray *authSettings = @[]; + + id bodyParam = nil; + NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; + NSMutableDictionary *localVarFiles = [[NSMutableDictionary alloc] init]; + bodyParam = body; + + return [self.apiClient requestWithPath: resourcePath + method: @"POST" + pathParams: pathParams + queryParams: queryParams + formParams: formParams + files: localVarFiles + body: bodyParam + headerParams: headerParams + authSettings: authSettings + requestContentType: requestContentType + responseContentType: responseContentType + responseType: nil + completionBlock: ^(id data, NSError *error) { + if(handler) { + handler(error); + } + } + ]; +} + +/// +/// Creates list of users with given input array +/// +/// @param body List of user object (optional) +/// +/// @returns void +/// +-(NSNumber*) createUsersWithArrayInputWithBody: (NSArray*) body + completionHandler: (void (^)(NSError* error)) handler { + NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/user/createWithArray"]; + + // remove format in URL if needed + [resourcePath replaceOccurrencesOfString:@".{format}" withString:@".json" options:0 range:NSMakeRange(0,resourcePath.length)]; + + NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init]; + + NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; + NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.apiClient.configuration.defaultHeaders]; + [headerParams addEntriesFromDictionary:self.defaultHeaders]; + // HTTP header `Accept` + NSString *acceptHeader = [self.apiClient.sanitizer selectHeaderAccept:@[@"application/json", @"application/xml"]]; + if(acceptHeader.length > 0) { + headerParams[@"Accept"] = acceptHeader; + } + + // response content type + NSString *responseContentType = [[acceptHeader componentsSeparatedByString:@", "] firstObject] ?: @""; + + // request content type + NSString *requestContentType = [self.apiClient.sanitizer selectHeaderContentType:@[]]; + + // Authentication setting + NSArray *authSettings = @[]; + + id bodyParam = nil; + NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; + NSMutableDictionary *localVarFiles = [[NSMutableDictionary alloc] init]; + bodyParam = body; + + return [self.apiClient requestWithPath: resourcePath + method: @"POST" + pathParams: pathParams + queryParams: queryParams + formParams: formParams + files: localVarFiles + body: bodyParam + headerParams: headerParams + authSettings: authSettings + requestContentType: requestContentType + responseContentType: responseContentType + responseType: nil + completionBlock: ^(id data, NSError *error) { + if(handler) { + handler(error); + } + } + ]; +} + +/// +/// Creates list of users with given input array +/// +/// @param body List of user object (optional) +/// +/// @returns void +/// +-(NSNumber*) createUsersWithListInputWithBody: (NSArray*) body + completionHandler: (void (^)(NSError* error)) handler { + NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/user/createWithList"]; + + // remove format in URL if needed + [resourcePath replaceOccurrencesOfString:@".{format}" withString:@".json" options:0 range:NSMakeRange(0,resourcePath.length)]; + + NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init]; + + NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; + NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.apiClient.configuration.defaultHeaders]; + [headerParams addEntriesFromDictionary:self.defaultHeaders]; + // HTTP header `Accept` + NSString *acceptHeader = [self.apiClient.sanitizer selectHeaderAccept:@[@"application/json", @"application/xml"]]; + if(acceptHeader.length > 0) { + headerParams[@"Accept"] = acceptHeader; + } + + // response content type + NSString *responseContentType = [[acceptHeader componentsSeparatedByString:@", "] firstObject] ?: @""; + + // request content type + NSString *requestContentType = [self.apiClient.sanitizer selectHeaderContentType:@[]]; + + // Authentication setting + NSArray *authSettings = @[]; + + id bodyParam = nil; + NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; + NSMutableDictionary *localVarFiles = [[NSMutableDictionary alloc] init]; + bodyParam = body; + + return [self.apiClient requestWithPath: resourcePath + method: @"POST" + pathParams: pathParams + queryParams: queryParams + formParams: formParams + files: localVarFiles + body: bodyParam + headerParams: headerParams + authSettings: authSettings + requestContentType: requestContentType + responseContentType: responseContentType + responseType: nil + completionBlock: ^(id data, NSError *error) { + if(handler) { + handler(error); + } + } + ]; +} + +/// +/// Delete user +/// This can only be done by the logged in user. +/// @param username The name that needs to be deleted +/// +/// @returns void +/// +-(NSNumber*) deleteUserWithUsername: (NSString*) username + completionHandler: (void (^)(NSError* error)) handler { + // verify the required parameter 'username' is set + if (username == nil) { + NSParameterAssert(username); + if(handler) { + NSDictionary * userInfo = @{NSLocalizedDescriptionKey : [NSString stringWithFormat:NSLocalizedString(@"Missing required parameter '%@'", nil),@"username"] }; + NSError* error = [NSError errorWithDomain:kSWGUserApiErrorDomain code:kSWGUserApiMissingParamErrorCode userInfo:userInfo]; + handler(error); + } + return nil; + } + + NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/user/{username}"]; + + // remove format in URL if needed + [resourcePath replaceOccurrencesOfString:@".{format}" withString:@".json" options:0 range:NSMakeRange(0,resourcePath.length)]; + + NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init]; + if (username != nil) { + pathParams[@"username"] = username; + } + + NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; + NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.apiClient.configuration.defaultHeaders]; + [headerParams addEntriesFromDictionary:self.defaultHeaders]; + // HTTP header `Accept` + NSString *acceptHeader = [self.apiClient.sanitizer selectHeaderAccept:@[@"application/json", @"application/xml"]]; + if(acceptHeader.length > 0) { + headerParams[@"Accept"] = acceptHeader; + } + + // response content type + NSString *responseContentType = [[acceptHeader componentsSeparatedByString:@", "] firstObject] ?: @""; + + // request content type + NSString *requestContentType = [self.apiClient.sanitizer selectHeaderContentType:@[]]; + + // Authentication setting + NSArray *authSettings = @[]; + + id bodyParam = nil; + NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; + NSMutableDictionary *localVarFiles = [[NSMutableDictionary alloc] init]; + + return [self.apiClient requestWithPath: resourcePath + method: @"DELETE" + pathParams: pathParams + queryParams: queryParams + formParams: formParams + files: localVarFiles + body: bodyParam + headerParams: headerParams + authSettings: authSettings + requestContentType: requestContentType + responseContentType: responseContentType + responseType: nil + completionBlock: ^(id data, NSError *error) { + if(handler) { + handler(error); + } + } + ]; +} + +/// +/// Get user by user name +/// +/// @param username The name that needs to be fetched. Use user1 for testing. +/// +/// @returns SWGUser* +/// +-(NSNumber*) getUserByNameWithUsername: (NSString*) username + completionHandler: (void (^)(SWGUser* output, NSError* error)) handler { + // verify the required parameter 'username' is set + if (username == nil) { + NSParameterAssert(username); + if(handler) { + NSDictionary * userInfo = @{NSLocalizedDescriptionKey : [NSString stringWithFormat:NSLocalizedString(@"Missing required parameter '%@'", nil),@"username"] }; + NSError* error = [NSError errorWithDomain:kSWGUserApiErrorDomain code:kSWGUserApiMissingParamErrorCode userInfo:userInfo]; + handler(nil, error); + } + return nil; + } + + NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/user/{username}"]; + + // remove format in URL if needed + [resourcePath replaceOccurrencesOfString:@".{format}" withString:@".json" options:0 range:NSMakeRange(0,resourcePath.length)]; + + NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init]; + if (username != nil) { + pathParams[@"username"] = username; + } + + NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; + NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.apiClient.configuration.defaultHeaders]; + [headerParams addEntriesFromDictionary:self.defaultHeaders]; + // HTTP header `Accept` + NSString *acceptHeader = [self.apiClient.sanitizer selectHeaderAccept:@[@"application/json", @"application/xml"]]; + if(acceptHeader.length > 0) { + headerParams[@"Accept"] = acceptHeader; + } + + // response content type + NSString *responseContentType = [[acceptHeader componentsSeparatedByString:@", "] firstObject] ?: @""; + + // request content type + NSString *requestContentType = [self.apiClient.sanitizer selectHeaderContentType:@[]]; + + // Authentication setting + NSArray *authSettings = @[]; + + id bodyParam = nil; + NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; + NSMutableDictionary *localVarFiles = [[NSMutableDictionary alloc] init]; + + return [self.apiClient requestWithPath: resourcePath + method: @"GET" + pathParams: pathParams + queryParams: queryParams + formParams: formParams + files: localVarFiles + body: bodyParam + headerParams: headerParams + authSettings: authSettings + requestContentType: requestContentType + responseContentType: responseContentType + responseType: @"SWGUser*" + completionBlock: ^(id data, NSError *error) { + if(handler) { + handler((SWGUser*)data, error); + } + } + ]; +} + +/// +/// Logs user into the system +/// +/// @param username The user name for login (optional) +/// +/// @param password The password for login in clear text (optional) +/// +/// @returns NSString* +/// +-(NSNumber*) loginUserWithUsername: (NSString*) username + password: (NSString*) password + completionHandler: (void (^)(NSString* output, NSError* error)) handler { + NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/user/login"]; + + // remove format in URL if needed + [resourcePath replaceOccurrencesOfString:@".{format}" withString:@".json" options:0 range:NSMakeRange(0,resourcePath.length)]; + + NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init]; + + NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; + if (username != nil) { + queryParams[@"username"] = username; + } + if (password != nil) { + queryParams[@"password"] = password; + } + NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.apiClient.configuration.defaultHeaders]; + [headerParams addEntriesFromDictionary:self.defaultHeaders]; + // HTTP header `Accept` + NSString *acceptHeader = [self.apiClient.sanitizer selectHeaderAccept:@[@"application/json", @"application/xml"]]; + if(acceptHeader.length > 0) { + headerParams[@"Accept"] = acceptHeader; + } + + // response content type + NSString *responseContentType = [[acceptHeader componentsSeparatedByString:@", "] firstObject] ?: @""; + + // request content type + NSString *requestContentType = [self.apiClient.sanitizer selectHeaderContentType:@[]]; + + // Authentication setting + NSArray *authSettings = @[]; + + id bodyParam = nil; + NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; + NSMutableDictionary *localVarFiles = [[NSMutableDictionary alloc] init]; + + return [self.apiClient requestWithPath: resourcePath + method: @"GET" + pathParams: pathParams + queryParams: queryParams + formParams: formParams + files: localVarFiles + body: bodyParam + headerParams: headerParams + authSettings: authSettings + requestContentType: requestContentType + responseContentType: responseContentType + responseType: @"NSString*" + completionBlock: ^(id data, NSError *error) { + if(handler) { + handler((NSString*)data, error); + } + } + ]; +} + +/// +/// Logs out current logged in user session +/// +/// @returns void +/// +-(NSNumber*) logoutUserWithCompletionHandler: + (void (^)(NSError* error)) handler { + NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/user/logout"]; + + // remove format in URL if needed + [resourcePath replaceOccurrencesOfString:@".{format}" withString:@".json" options:0 range:NSMakeRange(0,resourcePath.length)]; + + NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init]; + + NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; + NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.apiClient.configuration.defaultHeaders]; + [headerParams addEntriesFromDictionary:self.defaultHeaders]; + // HTTP header `Accept` + NSString *acceptHeader = [self.apiClient.sanitizer selectHeaderAccept:@[@"application/json", @"application/xml"]]; + if(acceptHeader.length > 0) { + headerParams[@"Accept"] = acceptHeader; + } + + // response content type + NSString *responseContentType = [[acceptHeader componentsSeparatedByString:@", "] firstObject] ?: @""; + + // request content type + NSString *requestContentType = [self.apiClient.sanitizer selectHeaderContentType:@[]]; + + // Authentication setting + NSArray *authSettings = @[]; + + id bodyParam = nil; + NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; + NSMutableDictionary *localVarFiles = [[NSMutableDictionary alloc] init]; + + return [self.apiClient requestWithPath: resourcePath + method: @"GET" + pathParams: pathParams + queryParams: queryParams + formParams: formParams + files: localVarFiles + body: bodyParam + headerParams: headerParams + authSettings: authSettings + requestContentType: requestContentType + responseContentType: responseContentType + responseType: nil + completionBlock: ^(id data, NSError *error) { + if(handler) { + handler(error); + } + } + ]; +} + +/// +/// Updated user +/// This can only be done by the logged in user. +/// @param username name that need to be deleted +/// +/// @param body Updated user object (optional) +/// +/// @returns void +/// +-(NSNumber*) updateUserWithUsername: (NSString*) username + body: (SWGUser*) body + completionHandler: (void (^)(NSError* error)) handler { + // verify the required parameter 'username' is set + if (username == nil) { + NSParameterAssert(username); + if(handler) { + NSDictionary * userInfo = @{NSLocalizedDescriptionKey : [NSString stringWithFormat:NSLocalizedString(@"Missing required parameter '%@'", nil),@"username"] }; + NSError* error = [NSError errorWithDomain:kSWGUserApiErrorDomain code:kSWGUserApiMissingParamErrorCode userInfo:userInfo]; + handler(error); + } + return nil; + } + + NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"/user/{username}"]; + + // remove format in URL if needed + [resourcePath replaceOccurrencesOfString:@".{format}" withString:@".json" options:0 range:NSMakeRange(0,resourcePath.length)]; + + NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init]; + if (username != nil) { + pathParams[@"username"] = username; + } + + NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init]; + NSMutableDictionary* headerParams = [NSMutableDictionary dictionaryWithDictionary:self.apiClient.configuration.defaultHeaders]; + [headerParams addEntriesFromDictionary:self.defaultHeaders]; + // HTTP header `Accept` + NSString *acceptHeader = [self.apiClient.sanitizer selectHeaderAccept:@[@"application/json", @"application/xml"]]; + if(acceptHeader.length > 0) { + headerParams[@"Accept"] = acceptHeader; + } + + // response content type + NSString *responseContentType = [[acceptHeader componentsSeparatedByString:@", "] firstObject] ?: @""; + + // request content type + NSString *requestContentType = [self.apiClient.sanitizer selectHeaderContentType:@[]]; + + // Authentication setting + NSArray *authSettings = @[]; + + id bodyParam = nil; + NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; + NSMutableDictionary *localVarFiles = [[NSMutableDictionary alloc] init]; + bodyParam = body; + + return [self.apiClient requestWithPath: resourcePath + method: @"PUT" + pathParams: pathParams + queryParams: queryParams + formParams: formParams + files: localVarFiles + body: bodyParam + headerParams: headerParams + authSettings: authSettings + requestContentType: requestContentType + responseContentType: responseContentType + responseType: nil + completionBlock: ^(id data, NSError *error) { + if(handler) { + handler(error); + } + } + ]; +} + + + +@end diff --git a/samples/client/petstore/objc/default/SwaggerClient/Core/JSONValueTransformer+ISO8601.h b/samples/client/petstore/objc/default/SwaggerClient/Core/JSONValueTransformer+ISO8601.h new file mode 100644 index 00000000000..dd8e721b3b9 --- /dev/null +++ b/samples/client/petstore/objc/default/SwaggerClient/Core/JSONValueTransformer+ISO8601.h @@ -0,0 +1,31 @@ +#import +#import +#import + +/** +* Swagger Petstore +* This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +* +* OpenAPI spec version: 1.0.0 +* Contact: apiteam@wordnik.com +* +* NOTE: This class is auto generated by the swagger code generator program. +* https://github.com/swagger-api/swagger-codegen.git +* Do not edit the class manually. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +@interface JSONValueTransformer (ISO8601) + +@end diff --git a/samples/client/petstore/objc/default/SwaggerClient/Core/JSONValueTransformer+ISO8601.m b/samples/client/petstore/objc/default/SwaggerClient/Core/JSONValueTransformer+ISO8601.m new file mode 100644 index 00000000000..cec8bdeea27 --- /dev/null +++ b/samples/client/petstore/objc/default/SwaggerClient/Core/JSONValueTransformer+ISO8601.m @@ -0,0 +1,10 @@ +#import "JSONValueTransformer+ISO8601.h" + +@implementation JSONValueTransformer (ISO8601) + +- (NSDate *) NSDateFromNSString:(NSString *)string +{ + return [NSDate dateWithISO8601String:string]; +} + +@end diff --git a/samples/client/petstore/objc/default/SwaggerClient/Core/SWGApi.h b/samples/client/petstore/objc/default/SwaggerClient/Core/SWGApi.h new file mode 100644 index 00000000000..93b564be3d1 --- /dev/null +++ b/samples/client/petstore/objc/default/SwaggerClient/Core/SWGApi.h @@ -0,0 +1,42 @@ +#import +#import "SWGObject.h" +#import "SWGApiClient.h" + +/** +* Swagger Petstore +* This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +* +* OpenAPI spec version: 1.0.0 +* Contact: apiteam@wordnik.com +* +* NOTE: This class is auto generated by the swagger code generator program. +* https://github.com/swagger-api/swagger-codegen.git +* Do not edit the class manually. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +@protocol SWGApi + +@property(nonatomic, assign) SWGApiClient *apiClient; + +-(id) initWithApiClient:(SWGApiClient *)apiClient; + +-(void) addHeader:(NSString*)value forKey:(NSString*)key DEPRECATED_MSG_ATTRIBUTE("setDefaultHeaderValue:forKey:"); + +-(void) setDefaultHeaderValue:(NSString*) value forKey:(NSString*)key; +-(NSString*) defaultHeaderForKey:(NSString*)key; + +-(NSUInteger) requestQueueSize; + +@end diff --git a/samples/client/petstore/objc/default/SwaggerClient/Core/SWGApiClient.h b/samples/client/petstore/objc/default/SwaggerClient/Core/SWGApiClient.h new file mode 100644 index 00000000000..2ec5c9b0fcc --- /dev/null +++ b/samples/client/petstore/objc/default/SwaggerClient/Core/SWGApiClient.h @@ -0,0 +1,210 @@ +#import +#import +#import +#import "SWGJSONResponseSerializer.h" +#import "SWGJSONRequestSerializer.h" +#import "SWGQueryParamCollection.h" +#import "SWGConfiguration.h" +#import "SWGResponseDeserializer.h" +#import "SWGSanitizer.h" +#import "SWGLogger.h" + +/** +* Swagger Petstore +* This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +* +* OpenAPI spec version: 1.0.0 +* Contact: apiteam@wordnik.com +* +* NOTE: This class is auto generated by the swagger code generator program. +* https://github.com/swagger-api/swagger-codegen.git +* Do not edit the class manually. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#import "SWGCategory.h" +#import "SWGOrder.h" +#import "SWGPet.h" +#import "SWGTag.h" +#import "SWGUser.h" + + + +@class SWGConfiguration; + +/** + * A key for `NSError` user info dictionaries. + * + * The corresponding value is the parsed response body for an HTTP error. + */ +extern NSString *const SWGResponseObjectErrorKey; + +@interface SWGApiClient : AFHTTPSessionManager + +@property(nonatomic, assign) NSURLRequestCachePolicy cachePolicy; +@property(nonatomic, assign) NSTimeInterval timeoutInterval; +@property(nonatomic, readonly) NSOperationQueue* queue; + +/// In order to ensure the HTTPResponseHeaders are correct, it is recommended to initialize one SWGApiClient instance per thread. +@property(nonatomic, readonly) NSDictionary* HTTPResponseHeaders; + +@property(nonatomic, strong) id responseDeserializer; + +@property(nonatomic, strong) id sanitizer; +/** + * Clears Cache + */ ++(void)clearCache; + +/** + * Turns on cache + * + * @param enabled If the cached is enable, must be `YES` or `NO` + */ ++(void)setCacheEnabled:(BOOL) enabled; + +/** + * Gets the request queue size + * + * @return The size of `queuedRequests` static variable. + */ ++(NSUInteger)requestQueueSize; + +/** + * Sets the client unreachable + * + * @param state off line state, must be `YES` or `NO` + */ ++(void) setOfflineState:(BOOL) state; + +/** + * Gets if the client is unreachable + * + * @return The client offline state + */ ++(BOOL) getOfflineState; + +/** + * Sets the client reachability, this may be overridden by the reachability manager if reachability changes + * + * @param The client reachability. + */ ++(void) setReachabilityStatus:(AFNetworkReachabilityStatus) status; + +/** + * Gets the client reachability + * + * @return The client reachability. + */ ++(AFNetworkReachabilityStatus) getReachabilityStatus; + +/** + * Gets the next request id + * + * @return The next executed request id. + */ ++(NSNumber*) nextRequestId; + +/** + * Generates request id and add it to the queue + * + * @return The next executed request id. + */ ++(NSNumber*) queueRequest; + +/** + * Removes request id from the queue + * + * @param requestId The request which will be removed. + */ ++(void) cancelRequest:(NSNumber*)requestId; + +/** + * Customizes the behavior when the reachability changed + * + * @param changeBlock The block will be executed when the reachability changed. + */ ++(void) setReachabilityChangeBlock:(void(^)(int))changeBlock; + +/** + * Sets the api client reachability strategy + */ +- (void)configureCacheReachibility; + +/** + * Sets header for request + * + * @param value The header value + * @param forKey The header key + */ +-(void)setHeaderValue:(NSString*) value + forKey:(NSString*) forKey; + +/** + * Updates header parameters and query parameters for authentication + * + * @param headers The header parameter will be udpated, passed by pointer to pointer. + * @param querys The query parameters will be updated, passed by pointer to pointer. + * @param authSettings The authentication names NSArray. + */ +- (void) updateHeaderParams:(NSDictionary **)headers + queryParams:(NSDictionary **)querys + WithAuthSettings:(NSArray *)authSettings; + +/** + * Performs request + * + * @param path Request url. + * @param method Request method. + * @param pathParams Request path parameters. + * @param queryParams Request query parameters. + * @param body Request body. + * @param headerParams Request header parameters. + * @param authSettings Request authentication names. + * @param requestContentType Request content-type. + * @param responseContentType Response content-type. + * @param completionBlock The block will be executed when the request completed. + * + * @return The request id. + */ +-(NSNumber*) requestWithPath:(NSString*) path + method:(NSString*) method + pathParams:(NSDictionary *) pathParams + queryParams:(NSDictionary*) queryParams + formParams:(NSDictionary *) formParams + files:(NSDictionary *) files + body:(id) body + headerParams:(NSDictionary*) headerParams + authSettings:(NSArray *) authSettings + requestContentType:(NSString*) requestContentType + responseContentType:(NSString*) responseContentType + responseType:(NSString *) responseType + completionBlock:(void (^)(id, NSError *))completionBlock; + +/** + * Custom security policy + * + * @return AFSecurityPolicy + */ +- (AFSecurityPolicy *) customSecurityPolicy; + +/** + * SWGConfiguration return sharedConfig + * + * @return SWGConfiguration + */ +- (SWGConfiguration*) configuration; + + +@end diff --git a/samples/client/petstore/objc/default/SwaggerClient/Core/SWGApiClient.m b/samples/client/petstore/objc/default/SwaggerClient/Core/SWGApiClient.m new file mode 100644 index 00000000000..f004200b2eb --- /dev/null +++ b/samples/client/petstore/objc/default/SwaggerClient/Core/SWGApiClient.m @@ -0,0 +1,504 @@ +#import "SWGApiClient.h" + +NSString *const SWGResponseObjectErrorKey = @"SWGResponseObject"; + +static NSUInteger requestId = 0; +static bool offlineState = false; +static NSMutableSet * queuedRequests = nil; +static bool cacheEnabled = false; +static AFNetworkReachabilityStatus reachabilityStatus = AFNetworkReachabilityStatusNotReachable; +static void (^reachabilityChangeBlock)(int); + + +static NSDictionary * SWG__headerFieldsForResponse(NSURLResponse *response) { + if(![response isKindOfClass:[NSHTTPURLResponse class]]) { + return nil; + } + return ((NSHTTPURLResponse*)response).allHeaderFields; +} + +static NSString * SWG__fileNameForResponse(NSURLResponse *response) { + NSDictionary * headers = SWG__headerFieldsForResponse(response); + if(!headers[@"Content-Disposition"]) { + return [NSString stringWithFormat:@"%@", [[NSProcessInfo processInfo] globallyUniqueString]]; + } + NSString *pattern = @"filename=['\"]?([^'\"\\s]+)['\"]?"; + NSRegularExpression *regexp = [NSRegularExpression regularExpressionWithPattern:pattern + options:NSRegularExpressionCaseInsensitive + error:nil]; + NSString *contentDispositionHeader = headers[@"Content-Disposition"]; + NSTextCheckingResult *match = [regexp firstMatchInString:contentDispositionHeader + options:0 + range:NSMakeRange(0, [contentDispositionHeader length])]; + return [contentDispositionHeader substringWithRange:[match rangeAtIndex:1]]; +} + + +@interface SWGApiClient () + +@property (nonatomic, strong) NSDictionary* HTTPResponseHeaders; + +@end + +@implementation SWGApiClient + +- (instancetype)init { + NSString *baseUrl = [[SWGConfiguration sharedConfig] host]; + return [self initWithBaseURL:[NSURL URLWithString:baseUrl]]; +} + +- (instancetype)initWithBaseURL:(NSURL *)url { + self = [super initWithBaseURL:url]; + if (self) { + self.timeoutInterval = 60; + self.requestSerializer = [AFJSONRequestSerializer serializer]; + self.responseSerializer = [AFJSONResponseSerializer serializer]; + self.securityPolicy = [self customSecurityPolicy]; + self.responseDeserializer = [[SWGResponseDeserializer alloc] init]; + self.sanitizer = [[SWGSanitizer alloc] init]; + // configure reachability + [self configureCacheReachibility]; + } + return self; +} + ++ (void)initialize { + if (self == [SWGApiClient class]) { + queuedRequests = [[NSMutableSet alloc] init]; + // initialize URL cache + [self configureCacheWithMemoryAndDiskCapacity:4*1024*1024 diskSize:32*1024*1024]; + } +} + +#pragma mark - Setter Methods + ++ (void) setOfflineState:(BOOL) state { + offlineState = state; +} + ++ (void) setCacheEnabled:(BOOL)enabled { + cacheEnabled = enabled; +} + ++(void) setReachabilityStatus:(AFNetworkReachabilityStatus)status { + reachabilityStatus = status; +} + +- (void)setHeaderValue:(NSString*) value forKey:(NSString*) forKey { + [self.requestSerializer setValue:value forHTTPHeaderField:forKey]; +} + +- (void)setRequestSerializer:(AFHTTPRequestSerializer *)requestSerializer { + [super setRequestSerializer:requestSerializer]; + requestSerializer.timeoutInterval = self.timeoutInterval; +} + +#pragma mark - Cache Methods + ++(void)clearCache { + [[NSURLCache sharedURLCache] removeAllCachedResponses]; +} + ++(void)configureCacheWithMemoryAndDiskCapacity: (unsigned long) memorySize + diskSize: (unsigned long) diskSize { + NSAssert(memorySize > 0, @"invalid in-memory cache size"); + NSAssert(diskSize >= 0, @"invalid disk cache size"); + + NSURLCache *cache = + [[NSURLCache alloc] + initWithMemoryCapacity:memorySize + diskCapacity:diskSize + diskPath:@"swagger_url_cache"]; + + [NSURLCache setSharedURLCache:cache]; +} + +#pragma mark - Request Methods + ++(NSUInteger)requestQueueSize { + return [queuedRequests count]; +} + ++(NSNumber*) nextRequestId { + @synchronized(self) { + return @(++requestId); + } +} + ++(NSNumber*) queueRequest { + NSNumber* requestId = [[self class] nextRequestId]; + SWGDebugLog(@"added %@ to request queue", requestId); + [queuedRequests addObject:requestId]; + return requestId; +} + ++(void) cancelRequest:(NSNumber*)requestId { + [queuedRequests removeObject:requestId]; +} + +-(Boolean) executeRequestWithId:(NSNumber*) requestId { + NSSet* matchingItems = [queuedRequests objectsPassingTest:^BOOL(id obj, BOOL *stop) { + return [obj intValue] == [requestId intValue]; + }]; + + if (matchingItems.count == 1) { + SWGDebugLog(@"removed request id %@", requestId); + [queuedRequests removeObject:requestId]; + return YES; + } else { + return NO; + } +} + +#pragma mark - Reachability Methods + ++(AFNetworkReachabilityStatus) getReachabilityStatus { + return reachabilityStatus; +} + ++(BOOL) getOfflineState { + return offlineState; +} + ++(void) setReachabilityChangeBlock:(void(^)(int))changeBlock { + reachabilityChangeBlock = changeBlock; +} + +- (void) configureCacheReachibility { + [self.reachabilityManager setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) { + reachabilityStatus = status; + SWGDebugLog(@"reachability changed to %@",AFStringFromNetworkReachabilityStatus(status)); + [SWGApiClient setOfflineState:status == AFNetworkReachabilityStatusUnknown || status == AFNetworkReachabilityStatusNotReachable]; + + // call the reachability block, if configured + if (reachabilityChangeBlock != nil) { + reachabilityChangeBlock(status); + } + }]; + + [self.reachabilityManager startMonitoring]; +} + +#pragma mark - Operation Methods + +- (void) operationWithCompletionBlock: (NSURLRequest *)request + requestId: (NSNumber *) requestId + completionBlock: (void (^)(id, NSError *))completionBlock { + __weak __typeof(self)weakSelf = self; + NSURLSessionDataTask* op = [self dataTaskWithRequest:request completionHandler:^(NSURLResponse *response, id responseObject, NSError *error) { + __strong __typeof(weakSelf)strongSelf = weakSelf; + if (![strongSelf executeRequestWithId:requestId]) { + return; + } + SWGDebugLogResponse(response, responseObject,request,error); + strongSelf.HTTPResponseHeaders = SWG__headerFieldsForResponse(response); + if(!error) { + completionBlock(responseObject, nil); + return; + } + NSMutableDictionary *userInfo = [error.userInfo mutableCopy]; + if (responseObject) { + // Add in the (parsed) response body. + userInfo[SWGResponseObjectErrorKey] = responseObject; + } + NSError *augmentedError = [error initWithDomain:error.domain code:error.code userInfo:userInfo]; + completionBlock(nil, augmentedError); + }]; + [op resume]; +} + +- (void) downloadOperationWithCompletionBlock: (NSURLRequest *)request + requestId: (NSNumber *) requestId + completionBlock: (void (^)(id, NSError *))completionBlock { + __weak __typeof(self)weakSelf = self; + NSURLSessionDataTask* op = [self dataTaskWithRequest:request completionHandler:^(NSURLResponse *response, id responseObject, NSError *error) { + __strong __typeof(weakSelf)strongSelf = weakSelf; + if (![strongSelf executeRequestWithId:requestId]) { + return; + } + strongSelf.HTTPResponseHeaders = SWG__headerFieldsForResponse(response); + SWGDebugLogResponse(response, responseObject,request,error); + if(error) { + NSMutableDictionary *userInfo = [error.userInfo mutableCopy]; + if (responseObject) { + userInfo[SWGResponseObjectErrorKey] = responseObject; + } + NSError *augmentedError = [error initWithDomain:error.domain code:error.code userInfo:userInfo]; + completionBlock(nil, augmentedError); + } + NSString *directory = [self configuration].tempFolderPath ?: NSTemporaryDirectory(); + NSString * filename = SWG__fileNameForResponse(response); + + NSString *filepath = [directory stringByAppendingPathComponent:filename]; + NSURL *file = [NSURL fileURLWithPath:filepath]; + + [responseObject writeToURL:file atomically:YES]; + + completionBlock(file, nil); + }]; + [op resume]; +} + +#pragma mark - Perform Request Methods + +-(NSNumber*) requestWithPath: (NSString*) path + method: (NSString*) method + pathParams: (NSDictionary *) pathParams + queryParams: (NSDictionary*) queryParams + formParams: (NSDictionary *) formParams + files: (NSDictionary *) files + body: (id) body + headerParams: (NSDictionary*) headerParams + authSettings: (NSArray *) authSettings + requestContentType: (NSString*) requestContentType + responseContentType: (NSString*) responseContentType + responseType: (NSString *) responseType + completionBlock: (void (^)(id, NSError *))completionBlock { + // setting request serializer + if ([requestContentType isEqualToString:@"application/json"]) { + self.requestSerializer = [SWGJSONRequestSerializer serializer]; + } + else if ([requestContentType isEqualToString:@"application/x-www-form-urlencoded"]) { + self.requestSerializer = [AFHTTPRequestSerializer serializer]; + } + else if ([requestContentType isEqualToString:@"multipart/form-data"]) { + self.requestSerializer = [AFHTTPRequestSerializer serializer]; + } + else { + self.requestSerializer = [AFHTTPRequestSerializer serializer]; + NSAssert(NO, @"Unsupported request type %@", requestContentType); + } + + // setting response serializer + if ([responseContentType isEqualToString:@"application/json"]) { + self.responseSerializer = [SWGJSONResponseSerializer serializer]; + } else { + self.responseSerializer = [AFHTTPResponseSerializer serializer]; + } + + // sanitize parameters + pathParams = [self.sanitizer sanitizeForSerialization:pathParams]; + queryParams = [self.sanitizer sanitizeForSerialization:queryParams]; + headerParams = [self.sanitizer sanitizeForSerialization:headerParams]; + formParams = [self.sanitizer sanitizeForSerialization:formParams]; + if(![body isKindOfClass:[NSData class]]) { + body = [self.sanitizer sanitizeForSerialization:body]; + } + + // auth setting + [self updateHeaderParams:&headerParams queryParams:&queryParams WithAuthSettings:authSettings]; + + NSMutableString *resourcePath = [NSMutableString stringWithString:path]; + [pathParams enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) { + NSString * safeString = ([obj isKindOfClass:[NSString class]]) ? obj : [NSString stringWithFormat:@"%@", obj]; + safeString = SWGPercentEscapedStringFromString(safeString); + [resourcePath replaceCharactersInRange:[resourcePath rangeOfString:[NSString stringWithFormat:@"{%@}", key]] withString:safeString]; + }]; + + NSMutableURLRequest * request = nil; + + NSString* pathWithQueryParams = [self pathWithQueryParamsToString:resourcePath queryParams:queryParams]; + if ([pathWithQueryParams hasPrefix:@"/"]) { + pathWithQueryParams = [pathWithQueryParams substringFromIndex:1]; + } + + NSString* urlString = [[NSURL URLWithString:pathWithQueryParams relativeToURL:self.baseURL] absoluteString]; + if (files.count > 0) { + __weak __typeof(self)weakSelf = self; + request = [self.requestSerializer multipartFormRequestWithMethod:@"POST" + URLString:urlString + parameters:nil + constructingBodyWithBlock:^(id formData) { + [formParams enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) { + NSString *objString = [weakSelf.sanitizer parameterToString:obj]; + NSData *data = [objString dataUsingEncoding:NSUTF8StringEncoding]; + [formData appendPartWithFormData:data name:key]; + }]; + [files enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) { + NSURL *filePath = (NSURL *)obj; + [formData appendPartWithFileURL:filePath name:key error:nil]; + }]; + } error:nil]; + } + else { + if (formParams) { + request = [self.requestSerializer requestWithMethod:method + URLString:urlString + parameters:formParams + error:nil]; + } + if (body) { + request = [self.requestSerializer requestWithMethod:method + URLString:urlString + parameters:body + error:nil]; + } + } + + // request cache + BOOL hasHeaderParams = [headerParams count] > 0; + if (offlineState) { + SWGDebugLog(@"%@ cache forced", resourcePath); + [request setCachePolicy:NSURLRequestReturnCacheDataDontLoad]; + } + else if(!hasHeaderParams && [method isEqualToString:@"GET"] && cacheEnabled) { + SWGDebugLog(@"%@ cache enabled", resourcePath); + [request setCachePolicy:NSURLRequestUseProtocolCachePolicy]; + } + else { + SWGDebugLog(@"%@ cache disabled", resourcePath); + [request setCachePolicy:NSURLRequestReloadIgnoringLocalCacheData]; + } + + if (hasHeaderParams){ + for(NSString * key in [headerParams keyEnumerator]){ + [request setValue:[headerParams valueForKey:key] forHTTPHeaderField:key]; + } + } + [self.requestSerializer setValue:responseContentType forHTTPHeaderField:@"Accept"]; + + [self postProcessRequest:request]; + + NSNumber* requestId = [SWGApiClient queueRequest]; + if ([responseType isEqualToString:@"NSURL*"] || [responseType isEqualToString:@"NSURL"]) { + [self downloadOperationWithCompletionBlock:request requestId:requestId completionBlock:^(id data, NSError *error) { + completionBlock(data, error); + }]; + } + else { + [self operationWithCompletionBlock:request requestId:requestId completionBlock:^(id data, NSError *error) { + NSError * serializationError; + id response = [self.responseDeserializer deserialize:data class:responseType error:&serializationError]; + if(!response && !error){ + error = serializationError; + } + completionBlock(response, error); + }]; + } + return requestId; +} + +//Added for easier override to modify request +-(void)postProcessRequest:(NSMutableURLRequest *)request { + // Always disable cookies! + [request setHTTPShouldHandleCookies:NO]; +} + +#pragma mark - + +- (NSString*) pathWithQueryParamsToString:(NSString*) path + queryParams:(NSDictionary*) queryParams { + if(queryParams.count == 0) { + return path; + } + NSString * separator = nil; + NSUInteger counter = 0; + + NSMutableString * requestUrl = [NSMutableString stringWithFormat:@"%@", path]; + + NSDictionary *separatorStyles = @{@"csv" : @",", + @"tsv" : @"\t", + @"pipes": @"|" + }; + for(NSString * key in [queryParams keyEnumerator]){ + if (counter == 0) { + separator = @"?"; + } else { + separator = @"&"; + } + id queryParam = [queryParams valueForKey:key]; + if(!queryParam) { + continue; + } + NSString *safeKey = SWGPercentEscapedStringFromString(key); + if ([queryParam isKindOfClass:[NSString class]]){ + [requestUrl appendString:[NSString stringWithFormat:@"%@%@=%@", separator, safeKey, SWGPercentEscapedStringFromString(queryParam)]]; + + } else if ([queryParam isKindOfClass:[SWGQueryParamCollection class]]){ + SWGQueryParamCollection * coll = (SWGQueryParamCollection*) queryParam; + NSArray* values = [coll values]; + NSString* format = [coll format]; + + if([format isEqualToString:@"multi"]) { + for(id obj in values) { + if (counter > 0) { + separator = @"&"; + } + NSString * safeValue = SWGPercentEscapedStringFromString([NSString stringWithFormat:@"%@",obj]); + [requestUrl appendString:[NSString stringWithFormat:@"%@%@=%@", separator, safeKey, safeValue]]; + counter += 1; + } + continue; + } + NSString * separatorStyle = separatorStyles[format]; + NSString * safeValue = SWGPercentEscapedStringFromString([values componentsJoinedByString:separatorStyle]); + [requestUrl appendString:[NSString stringWithFormat:@"%@%@=%@", separator, safeKey, safeValue]]; + } else { + NSString * safeValue = SWGPercentEscapedStringFromString([NSString stringWithFormat:@"%@",queryParam]); + [requestUrl appendString:[NSString stringWithFormat:@"%@%@=%@", separator, safeKey, safeValue]]; + } + counter += 1; + } + return requestUrl; +} + +/** + * Update header and query params based on authentication settings + */ +- (void) updateHeaderParams:(NSDictionary *__autoreleasing *)headers + queryParams:(NSDictionary *__autoreleasing *)querys + WithAuthSettings:(NSArray *)authSettings { + + if ([authSettings count] == 0) { + return; + } + + NSMutableDictionary *headersWithAuth = [NSMutableDictionary dictionaryWithDictionary:*headers]; + NSMutableDictionary *querysWithAuth = [NSMutableDictionary dictionaryWithDictionary:*querys]; + + NSDictionary* configurationAuthSettings = [[self configuration] authSettings]; + for (NSString *auth in authSettings) { + NSDictionary *authSetting = configurationAuthSettings[auth]; + if(!authSetting) { // auth setting is set only if the key is non-empty + continue; + } + NSString *type = authSetting[@"in"]; + NSString *key = authSetting[@"key"]; + NSString *value = authSetting[@"value"]; + if ([type isEqualToString:@"header"] && [key length] > 0 ) { + headersWithAuth[key] = value; + } else if ([type isEqualToString:@"query"] && [key length] != 0) { + querysWithAuth[key] = value; + } + } + + *headers = [NSDictionary dictionaryWithDictionary:headersWithAuth]; + *querys = [NSDictionary dictionaryWithDictionary:querysWithAuth]; +} + +- (AFSecurityPolicy *) customSecurityPolicy { + AFSecurityPolicy *securityPolicy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeNone]; + + SWGConfiguration *config = [self configuration]; + + if (config.sslCaCert) { + NSData *certData = [NSData dataWithContentsOfFile:config.sslCaCert]; + [securityPolicy setPinnedCertificates:@[certData]]; + } + + if (config.verifySSL) { + [securityPolicy setAllowInvalidCertificates:NO]; + } + else { + [securityPolicy setAllowInvalidCertificates:YES]; + [securityPolicy setValidatesDomainName:NO]; + } + + return securityPolicy; +} + +- (SWGConfiguration*) configuration { + return [SWGConfiguration sharedConfig]; +} + +@end diff --git a/samples/client/petstore/objc/default/SwaggerClient/Core/SWGConfiguration.h b/samples/client/petstore/objc/default/SwaggerClient/Core/SWGConfiguration.h new file mode 100644 index 00000000000..b6c37405ca2 --- /dev/null +++ b/samples/client/petstore/objc/default/SwaggerClient/Core/SWGConfiguration.h @@ -0,0 +1,182 @@ +#import +#import "SWGApiClient.h" +#import "SWGLogger.h" + +/** +* Swagger Petstore +* This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +* +* OpenAPI spec version: 1.0.0 +* Contact: apiteam@wordnik.com +* +* NOTE: This class is auto generated by the swagger code generator program. +* https://github.com/swagger-api/swagger-codegen.git +* Do not edit the class manually. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +@class SWGApiClient; + +@interface SWGConfiguration : NSObject + +/** + * Default api logger + */ +@property (nonatomic, strong) SWGLogger * logger; + +/** + * Default api client + */ +@property (nonatomic) SWGApiClient *apiClient; + +/** + * Default base url + */ +@property (nonatomic) NSString *host; + +/** + * Api key values for Api Key type Authentication + * + * To add or remove api key, use `setApiKey:forApiKeyIdentifier:`. + */ +@property (readonly, nonatomic, strong) NSDictionary *apiKey; + +/** + * Api key prefix values to be prepend to the respective api key + * + * To add or remove prefix, use `setApiKeyPrefix:forApiKeyPrefixIdentifier:`. + */ +@property (readonly, nonatomic, strong) NSDictionary *apiKeyPrefix; + +/** + * Username for HTTP Basic Authentication + */ + @property (nonatomic) NSString *username; + +/** + * Password for HTTP Basic Authentication + */ +@property (nonatomic) NSString *password; + +/** + * Access token for OAuth + */ +@property (nonatomic) NSString *accessToken; + +/** + * Temp folder for file download + */ +@property (nonatomic) NSString *tempFolderPath; + +/** + * Debug switch, default false + */ +@property (nonatomic) BOOL debug; + +/** + * Gets configuration singleton instance + */ ++ (instancetype) sharedConfig; + +/** + * SSL/TLS verification + * Set this to NO to skip verifying SSL certificate when calling API from https server + */ +@property (nonatomic) BOOL verifySSL; + +/** + * SSL/TLS verification + * Set this to customize the certificate file to verify the peer + */ +@property (nonatomic) NSString *sslCaCert; + +/** + * Sets API key + * + * To remove a apiKey for an identifier, just set the apiKey to nil. + * + * @param apiKey API key or token. + * @param identifier API key identifier (authentication schema). + * + */ +- (void) setApiKey:(NSString *)apiKey forApiKeyIdentifier:(NSString*)identifier; + +/** + * Removes api key + * + * @param identifier API key identifier. + */ +- (void) removeApiKey:(NSString *)identifier; + +/** + * Sets the prefix for API key + * + * @param apiKeyPrefix API key prefix. + * @param identifier API key identifier. + */ +- (void) setApiKeyPrefix:(NSString *)prefix forApiKeyPrefixIdentifier:(NSString *)identifier; + +/** + * Removes api key prefix + * + * @param identifier API key identifier. + */ +- (void) removeApiKeyPrefix:(NSString *)identifier; + +/** + * Gets API key (with prefix if set) + */ +- (NSString *) getApiKeyWithPrefix:(NSString *) key; + +/** + * Gets Basic Auth token + */ +- (NSString *) getBasicAuthToken; + +/** + * Gets OAuth access token + */ +- (NSString *) getAccessToken; + +/** + * Gets Authentication Settings + */ +- (NSDictionary *) authSettings; + +/** +* Default headers for all services +*/ +@property (readonly, nonatomic, strong) NSDictionary *defaultHeaders; + +/** +* Removes header from defaultHeaders +* +* @param Header name. +*/ +-(void) removeDefaultHeaderForKey:(NSString*)key; + +/** +* Sets the header for key +* +* @param value Value for header name +* @param key Header name +*/ +-(void) setDefaultHeaderValue:(NSString*) value forKey:(NSString*)key; + +/** +* @param Header key name. +*/ +-(NSString*) defaultHeaderForKey:(NSString*)key; + +@end diff --git a/samples/client/petstore/objc/default/SwaggerClient/Core/SWGConfiguration.m b/samples/client/petstore/objc/default/SwaggerClient/Core/SWGConfiguration.m new file mode 100644 index 00000000000..24172638bba --- /dev/null +++ b/samples/client/petstore/objc/default/SwaggerClient/Core/SWGConfiguration.m @@ -0,0 +1,160 @@ +#import "SWGConfiguration.h" + +@interface SWGConfiguration () + +@property (nonatomic, strong) NSMutableDictionary *mutableDefaultHeaders; +@property (nonatomic, strong) NSMutableDictionary *mutableApiKey; +@property (nonatomic, strong) NSMutableDictionary *mutableApiKeyPrefix; + +@end + +@implementation SWGConfiguration + +#pragma mark - Singleton Methods + ++ (instancetype) sharedConfig { + static SWGConfiguration *shardConfig = nil; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + shardConfig = [[self alloc] init]; + }); + return shardConfig; +} + +#pragma mark - Initialize Methods + +- (instancetype) init { + self = [super init]; + if (self) { + self.apiClient = nil; + self.host = @"http://petstore.swagger.io/v2"; + self.username = @""; + self.password = @""; + self.accessToken= @""; + self.verifySSL = YES; + self.mutableApiKey = [NSMutableDictionary dictionary]; + self.mutableApiKeyPrefix = [NSMutableDictionary dictionary]; + self.mutableDefaultHeaders = [NSMutableDictionary dictionary]; + self.mutableDefaultHeaders[@"User-Agent"] = [NSString stringWithFormat:@"Swagger-Codegen/1.0.0/objc (%@; iOS %@; Scale/%0.2f)",[[UIDevice currentDevice] model], [[UIDevice currentDevice] systemVersion], [[UIScreen mainScreen] scale]]; + self.logger = [SWGLogger sharedLogger]; + } + return self; +} + +#pragma mark - Instance Methods + +- (NSString *) getApiKeyWithPrefix:(NSString *)key { + NSString *prefix = self.apiKeyPrefix[key]; + NSString *apiKey = self.apiKey[key]; + if (prefix && apiKey != (id)[NSNull null] && apiKey.length > 0) { // both api key prefix and api key are set + return [NSString stringWithFormat:@"%@ %@", prefix, apiKey]; + } + else if (apiKey != (id)[NSNull null] && apiKey.length > 0) { // only api key, no api key prefix + return [NSString stringWithFormat:@"%@", self.apiKey[key]]; + } + else { // return empty string if nothing is set + return @""; + } +} + +- (NSString *) getBasicAuthToken { + // return empty string if username and password are empty + if (self.username.length == 0 && self.password.length == 0){ + return @""; + } + + NSString *basicAuthCredentials = [NSString stringWithFormat:@"%@:%@", self.username, self.password]; + NSData *data = [basicAuthCredentials dataUsingEncoding:NSUTF8StringEncoding]; + basicAuthCredentials = [NSString stringWithFormat:@"Basic %@", [data base64EncodedStringWithOptions:0]]; + + return basicAuthCredentials; +} + +- (NSString *) getAccessToken { + if (self.accessToken.length == 0) { // token not set, return empty string + return @""; + } else { + return [NSString stringWithFormat:@"Bearer %@", self.accessToken]; + } +} + +#pragma mark - Setter Methods + +- (void) setApiKey:(NSString *)apiKey forApiKeyIdentifier:(NSString *)identifier { + [self.mutableApiKey setValue:apiKey forKey:identifier]; +} + +- (void) removeApiKey:(NSString *)identifier { + [self.mutableApiKey removeObjectForKey:identifier]; +} + +- (void) setApiKeyPrefix:(NSString *)prefix forApiKeyPrefixIdentifier:(NSString *)identifier { + [self.mutableApiKeyPrefix setValue:prefix forKey:identifier]; +} + +- (void) removeApiKeyPrefix:(NSString *)identifier { + [self.mutableApiKeyPrefix removeObjectForKey:identifier]; +} + +#pragma mark - Getter Methods + +- (NSDictionary *) apiKey { + return [NSDictionary dictionaryWithDictionary:self.mutableApiKey]; +} + +- (NSDictionary *) apiKeyPrefix { + return [NSDictionary dictionaryWithDictionary:self.mutableApiKeyPrefix]; +} + +#pragma mark - + +- (NSDictionary *) authSettings { + return @{ + @"petstore_auth": + @{ + @"type": @"oauth", + @"in": @"header", + @"key": @"Authorization", + @"value": [self getAccessToken] + }, + @"api_key": + @{ + @"type": @"api_key", + @"in": @"header", + @"key": @"api_key", + @"value": [self getApiKeyWithPrefix:@"api_key"] + }, + }; +} + +-(BOOL)debug { + return self.logger.isEnabled; +} + +-(void)setDebug:(BOOL)debug { + self.logger.enabled = debug; +} + + + +- (void)setDefaultHeaderValue:(NSString *)value forKey:(NSString *)key { + if(!value) { + [self.mutableDefaultHeaders removeObjectForKey:key]; + return; + } + self.mutableDefaultHeaders[key] = value; +} + +-(void) removeDefaultHeaderForKey:(NSString*)key { + [self.mutableDefaultHeaders removeObjectForKey:key]; +} + +- (NSString *)defaultHeaderForKey:(NSString *)key { + return self.mutableDefaultHeaders[key]; +} + +- (NSDictionary *)defaultHeaders { + return [self.mutableDefaultHeaders copy]; +} + +@end diff --git a/samples/client/petstore/objc/default/SwaggerClient/Core/SWGJSONRequestSerializer.h b/samples/client/petstore/objc/default/SwaggerClient/Core/SWGJSONRequestSerializer.h new file mode 100644 index 00000000000..d9c4d4ad060 --- /dev/null +++ b/samples/client/petstore/objc/default/SwaggerClient/Core/SWGJSONRequestSerializer.h @@ -0,0 +1,29 @@ +#import +#import + +/** +* Swagger Petstore +* This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +* +* OpenAPI spec version: 1.0.0 +* Contact: apiteam@wordnik.com +* +* NOTE: This class is auto generated by the swagger code generator program. +* https://github.com/swagger-api/swagger-codegen.git +* Do not edit the class manually. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +@interface SWGJSONRequestSerializer : AFJSONRequestSerializer +@end diff --git a/samples/client/petstore/objc/default/SwaggerClient/Core/SWGJSONRequestSerializer.m b/samples/client/petstore/objc/default/SwaggerClient/Core/SWGJSONRequestSerializer.m new file mode 100644 index 00000000000..221765e4839 --- /dev/null +++ b/samples/client/petstore/objc/default/SwaggerClient/Core/SWGJSONRequestSerializer.m @@ -0,0 +1,37 @@ +#import "SWGJSONRequestSerializer.h" + +@implementation SWGJSONRequestSerializer + +/// +/// When customize a request serializer, +/// the serializer must conform the protocol `AFURLRequestSerialization` +/// and implements the protocol method `requestBySerializingRequest:withParameters:error:` +/// +/// @param request The original request. +/// @param parameters The parameters to be encoded. +/// @param error The error that occurred while attempting to encode the request parameters. +/// +/// @return A serialized request. +/// +- (NSURLRequest *)requestBySerializingRequest:(NSURLRequest *)request + withParameters:(id)parameters + error:(NSError *__autoreleasing *)error +{ + if (!parameters) { + return request; + } + // If the body data which will be serialized isn't NSArray or NSDictionary + // then put the data in the http request body directly. + if ([parameters isKindOfClass:[NSArray class]] || [parameters isKindOfClass:[NSDictionary class]]) { + return [super requestBySerializingRequest:request withParameters:parameters error:error]; + } + NSMutableURLRequest *mutableRequest = [request mutableCopy]; + if([parameters isKindOfClass:[NSData class]]) { + [mutableRequest setHTTPBody:parameters]; + } else { + [mutableRequest setHTTPBody:[parameters dataUsingEncoding:self.stringEncoding]]; + } + return mutableRequest; +} + +@end diff --git a/samples/client/petstore/objc/default/SwaggerClient/Core/SWGJSONResponseSerializer.h b/samples/client/petstore/objc/default/SwaggerClient/Core/SWGJSONResponseSerializer.h new file mode 100644 index 00000000000..20535a6b92e --- /dev/null +++ b/samples/client/petstore/objc/default/SwaggerClient/Core/SWGJSONResponseSerializer.h @@ -0,0 +1,30 @@ +#import +#import + +/** +* Swagger Petstore +* This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +* +* OpenAPI spec version: 1.0.0 +* Contact: apiteam@wordnik.com +* +* NOTE: This class is auto generated by the swagger code generator program. +* https://github.com/swagger-api/swagger-codegen.git +* Do not edit the class manually. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +@interface SWGJSONResponseSerializer : AFJSONResponseSerializer + +@end diff --git a/samples/client/petstore/objc/default/SwaggerClient/Core/SWGJSONResponseSerializer.m b/samples/client/petstore/objc/default/SwaggerClient/Core/SWGJSONResponseSerializer.m new file mode 100644 index 00000000000..73c696d341a --- /dev/null +++ b/samples/client/petstore/objc/default/SwaggerClient/Core/SWGJSONResponseSerializer.m @@ -0,0 +1,39 @@ +#import "SWGJSONResponseSerializer.h" + +@implementation SWGJSONResponseSerializer + +/// +/// When customize a response serializer, +/// the serializer must conform the protocol `AFURLResponseSerialization` +/// and implements the protocol method `responseObjectForResponse:error:` +/// +/// @param response The response to be processed. +/// @param data The response data to be decoded. +/// @param error The error that occurred while attempting to decode the response data. +/// +/// @return The object decoded from the specified response data. +/// +- (id) responseObjectForResponse:(NSURLResponse *)response + data:(NSData *)data + error:(NSError *__autoreleasing *)error { + NSDictionary *responseJson = [super responseObjectForResponse:response data:data error:error]; + + // if response data is not a valid json, return string of data. + if ([self isParseError:*error]) { + *error = nil; + NSString *responseString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; + return responseString; + } + + return responseJson; +} + +-(BOOL)isParseError:(NSError *)error { + return [error.domain isEqualToString:NSCocoaErrorDomain] && error.code == 3840; +} + ++ (instancetype)serializer { + return [self serializerWithReadingOptions:NSJSONReadingAllowFragments]; +} + +@end diff --git a/samples/client/petstore/objc/default/SwaggerClient/Core/SWGLogger.h b/samples/client/petstore/objc/default/SwaggerClient/Core/SWGLogger.h new file mode 100644 index 00000000000..cb4279f182b --- /dev/null +++ b/samples/client/petstore/objc/default/SwaggerClient/Core/SWGLogger.h @@ -0,0 +1,72 @@ +#import + +/** +* Swagger Petstore +* This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +* +* OpenAPI spec version: 1.0.0 +* Contact: apiteam@wordnik.com +* +* NOTE: This class is auto generated by the swagger code generator program. +* https://github.com/swagger-api/swagger-codegen.git +* Do not edit the class manually. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#ifndef SWGDebugLogResponse +#define SWGDebugLogResponse(response, responseObject,request, error) [[SWGLogger sharedLogger] logResponse:response responseObject:responseObject request:request error:error]; +#endif + +/** + * Log debug message macro + */ +#ifndef SWGDebugLog +#define SWGDebugLog(format, ...) [[SWGLogger sharedLogger] debugLog:[NSString stringWithFormat:@"%s", __PRETTY_FUNCTION__] message: format, ##__VA_ARGS__]; +#endif + +@interface SWGLogger : NSObject + ++(instancetype)sharedLogger; + +/** + * Enabled switch, default NO - default set by SWGConfiguration debug property + */ +@property (nonatomic, assign, getter=isEnabled) BOOL enabled; + +/** + * Debug file location, default log in console + */ +@property (nonatomic, strong) NSString *loggingFile; + +/** + * Log file handler, this property is used by sdk internally. + */ +@property (nonatomic, strong, readonly) NSFileHandle *loggingFileHandler; + +/** + * Log debug message + */ +-(void)debugLog:(NSString *)method message:(NSString *)format, ...; + +/** + * Logs request and response + * + * @param response NSURLResponse for the HTTP request. + * @param responseObject response object of the HTTP request. + * @param request The HTTP request. + * @param error The error of the HTTP request. + */ +- (void)logResponse:(NSURLResponse *)response responseObject:(id)responseObject request:(NSURLRequest *)request error:(NSError *)error; + +@end diff --git a/samples/client/petstore/objc/default/SwaggerClient/Core/SWGLogger.m b/samples/client/petstore/objc/default/SwaggerClient/Core/SWGLogger.m new file mode 100644 index 00000000000..322ae9678d7 --- /dev/null +++ b/samples/client/petstore/objc/default/SwaggerClient/Core/SWGLogger.m @@ -0,0 +1,74 @@ +#import "SWGLogger.h" + +@interface SWGLogger () + +@end + +@implementation SWGLogger + ++ (instancetype) sharedLogger { + static SWGLogger *shardLogger = nil; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + shardLogger = [[self alloc] init]; + }); + return shardLogger; +} + +#pragma mark - Log Methods + +- (void)debugLog:(NSString *)method + message:(NSString *)format, ... { + if (!self.isEnabled) { + return; + } + + NSMutableString *message = [NSMutableString stringWithCapacity:1]; + + if (method) { + [message appendFormat:@"%@: ", method]; + } + + va_list args; + va_start(args, format); + + [message appendString:[[NSString alloc] initWithFormat:format arguments:args]]; + + // If set logging file handler, log into file, + // otherwise log into console. + if (self.loggingFileHandler) { + [self.loggingFileHandler seekToEndOfFile]; + [self.loggingFileHandler writeData:[message dataUsingEncoding:NSUTF8StringEncoding]]; + } else { + NSLog(@"%@", message); + } + + va_end(args); +} + +- (void)logResponse:(NSURLResponse *)response responseObject:(id)responseObject request:(NSURLRequest *)request error:(NSError *)error { + NSString *message = [NSString stringWithFormat:@"\n[DEBUG] HTTP request body \n~BEGIN~\n %@\n~END~\n"\ + "[DEBUG] HTTP response body \n~BEGIN~\n %@\n~END~\n", + [[NSString alloc] initWithData:request.HTTPBody encoding:NSUTF8StringEncoding], + responseObject]; + + SWGDebugLog(message); +} + +- (void) setLoggingFile:(NSString *)loggingFile { + if(_loggingFile == loggingFile) { + return; + } + // close old file handler + if ([self.loggingFileHandler isKindOfClass:[NSFileHandle class]]) { + [self.loggingFileHandler closeFile]; + } + _loggingFile = loggingFile; + _loggingFileHandler = [NSFileHandle fileHandleForWritingAtPath:_loggingFile]; + if (_loggingFileHandler == nil) { + [[NSFileManager defaultManager] createFileAtPath:_loggingFile contents:nil attributes:nil]; + _loggingFileHandler = [NSFileHandle fileHandleForWritingAtPath:_loggingFile]; + } +} + +@end diff --git a/samples/client/petstore/objc/default/SwaggerClient/Core/SWGObject.h b/samples/client/petstore/objc/default/SwaggerClient/Core/SWGObject.h new file mode 100644 index 00000000000..be57583b8f6 --- /dev/null +++ b/samples/client/petstore/objc/default/SwaggerClient/Core/SWGObject.h @@ -0,0 +1,30 @@ +#import +#import + +/** +* Swagger Petstore +* This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +* +* OpenAPI spec version: 1.0.0 +* Contact: apiteam@wordnik.com +* +* NOTE: This class is auto generated by the swagger code generator program. +* https://github.com/swagger-api/swagger-codegen.git +* Do not edit the class manually. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +@interface SWGObject : JSONModel + +@end diff --git a/samples/client/petstore/objc/default/SwaggerClient/Core/SWGObject.m b/samples/client/petstore/objc/default/SwaggerClient/Core/SWGObject.m new file mode 100644 index 00000000000..8085c404f7e --- /dev/null +++ b/samples/client/petstore/objc/default/SwaggerClient/Core/SWGObject.m @@ -0,0 +1,13 @@ +#import "SWGObject.h" + +@implementation SWGObject + +/** + * Gets the string presentation of the object. + * This method will be called when logging model object using `NSLog`. + */ +- (NSString *)description { + return [[self toDictionary] description]; +} + +@end diff --git a/samples/client/petstore/objc/default/SwaggerClient/Core/SWGQueryParamCollection.h b/samples/client/petstore/objc/default/SwaggerClient/Core/SWGQueryParamCollection.h new file mode 100644 index 00000000000..69a5ab3c133 --- /dev/null +++ b/samples/client/petstore/objc/default/SwaggerClient/Core/SWGQueryParamCollection.h @@ -0,0 +1,35 @@ +#import + +/** +* Swagger Petstore +* This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +* +* OpenAPI spec version: 1.0.0 +* Contact: apiteam@wordnik.com +* +* NOTE: This class is auto generated by the swagger code generator program. +* https://github.com/swagger-api/swagger-codegen.git +* Do not edit the class manually. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +@interface SWGQueryParamCollection : NSObject + +@property(nonatomic, readonly) NSArray* values; +@property(nonatomic, readonly) NSString* format; + +- (id) initWithValuesAndFormat: (NSArray*) values + format: (NSString*) format; + +@end diff --git a/samples/client/petstore/objc/default/SwaggerClient/Core/SWGQueryParamCollection.m b/samples/client/petstore/objc/default/SwaggerClient/Core/SWGQueryParamCollection.m new file mode 100644 index 00000000000..83303045185 --- /dev/null +++ b/samples/client/petstore/objc/default/SwaggerClient/Core/SWGQueryParamCollection.m @@ -0,0 +1,16 @@ +#import "SWGQueryParamCollection.h" + +@implementation SWGQueryParamCollection + +@synthesize values = _values; +@synthesize format = _format; + +- (id) initWithValuesAndFormat: (NSArray*) values + format: (NSString*) format { + _values = values; + _format = format; + + return self; +} + +@end diff --git a/samples/client/petstore/objc/default/SwaggerClient/Core/SWGResponseDeserializer.h b/samples/client/petstore/objc/default/SwaggerClient/Core/SWGResponseDeserializer.h new file mode 100644 index 00000000000..c0d7b716a01 --- /dev/null +++ b/samples/client/petstore/objc/default/SwaggerClient/Core/SWGResponseDeserializer.h @@ -0,0 +1,68 @@ +#import + +/** +* Swagger Petstore +* This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +* +* OpenAPI spec version: 1.0.0 +* Contact: apiteam@wordnik.com +* +* NOTE: This class is auto generated by the swagger code generator program. +* https://github.com/swagger-api/swagger-codegen.git +* Do not edit the class manually. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/** + * A key for deserialization ErrorDomain + */ +extern NSString *const SWGDeserializationErrorDomainKey; + +/** + * Code for deserialization type mismatch error + */ +extern NSInteger const SWGTypeMismatchErrorCode; + +/** + * Code for deserialization empty value error + */ +extern NSInteger const SWGEmptyValueOccurredErrorCode; + +/** + * Error code for unknown response + */ +extern NSInteger const SWGUnknownResponseObjectErrorCode; + +@protocol SWGResponseDeserializer + +/** + * Deserializes the given data to Objective-C object. + * + * @param data The data will be deserialized. + * @param class The type of objective-c object. + * @param error The error + */ +- (id) deserialize:(id) data class:(NSString *) className error:(NSError**)error; + +@end + +@interface SWGResponseDeserializer : NSObject + +/** + * If an null value occurs in dictionary or array if set to YES whole response will be invalid else will be ignored + * @default NO + */ +@property (nonatomic, assign) BOOL treatNullAsError; + +@end diff --git a/samples/client/petstore/objc/default/SwaggerClient/Core/SWGResponseDeserializer.m b/samples/client/petstore/objc/default/SwaggerClient/Core/SWGResponseDeserializer.m new file mode 100644 index 00000000000..a0efd1d5927 --- /dev/null +++ b/samples/client/petstore/objc/default/SwaggerClient/Core/SWGResponseDeserializer.m @@ -0,0 +1,231 @@ +#import "SWGResponseDeserializer.h" +#import +#import + +NSString *const SWGDeserializationErrorDomainKey = @"SWGDeserializationErrorDomainKey"; + +NSInteger const SWGTypeMismatchErrorCode = 143553; + +NSInteger const SWGEmptyValueOccurredErrorCode = 143509; + +NSInteger const SWGUnknownResponseObjectErrorCode = 143528; + + +@interface SWGResponseDeserializer () + +@property (nonatomic, strong) NSNumberFormatter* numberFormatter; +@property (nonatomic, strong) NSArray *primitiveTypes; +@property (nonatomic, strong) NSArray *basicReturnTypes; + +@property (nonatomic, strong) NSRegularExpression* arrayOfModelsPatExpression; +@property (nonatomic, strong) NSRegularExpression* arrayOfPrimitivesPatExpression; +@property (nonatomic, strong) NSRegularExpression* dictPatExpression; +@property (nonatomic, strong) NSRegularExpression* dictModelsPatExpression; + +@end + +@implementation SWGResponseDeserializer + +- (instancetype)init { + self = [super init]; + if (self) { + NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init]; + formatter.numberStyle = NSNumberFormatterDecimalStyle; + _numberFormatter = formatter; + _primitiveTypes = @[@"NSString", @"NSDate", @"NSNumber"]; + _basicReturnTypes = @[@"NSObject", @"id", @"NSData"]; + _arrayOfModelsPatExpression = [NSRegularExpression regularExpressionWithPattern:@"NSArray<(.+)>" + options:NSRegularExpressionCaseInsensitive + error:nil]; + _arrayOfPrimitivesPatExpression = [NSRegularExpression regularExpressionWithPattern:@"NSArray\\* /\\* (.+) \\*/" + options:NSRegularExpressionCaseInsensitive + error:nil]; + _dictPatExpression = [NSRegularExpression regularExpressionWithPattern:@"NSDictionary\\* /\\* (.+?), (.+) \\*/" + options:NSRegularExpressionCaseInsensitive + error:nil]; + _dictModelsPatExpression = [NSRegularExpression regularExpressionWithPattern:@"NSDictionary\\<(.+?), (.+)*\\>" + options:NSRegularExpressionCaseInsensitive + error:nil]; + } + return self; +} + +#pragma mark - Deserialize methods + +- (id) deserialize:(id) data class:(NSString *) className error:(NSError **) error { + // return nil if data is nil or className is nil + if (!data || !className || [data isKindOfClass:[NSNull class]]) { + return nil; + } + + // remove "*" from className, if ends with "*" + if ([className hasSuffix:@"*"]) { + className = [className substringToIndex:[className length] - 1]; + } + // pure object + if ([self.basicReturnTypes containsObject:className]) { + return data; + } + + // primitives + if ([self.primitiveTypes containsObject:className]) { + return [self deserializePrimitiveValue:data class:className error:error]; + } + + NSTextCheckingResult *match = nil; + NSRange range = NSMakeRange(0, [className length]); + // list of models + match = [self.arrayOfModelsPatExpression firstMatchInString:className options:0 range:range]; + if (match) { + NSString *innerType = [className substringWithRange:[match rangeAtIndex:1]]; + return [self deserializeArrayValue:data innerType:innerType error:error]; + } + + // list of primitives + match = [self.arrayOfPrimitivesPatExpression firstMatchInString:className options:0 range:range]; + if (match) { + NSString *innerType = [className substringWithRange:[match rangeAtIndex:1]]; + return [self deserializeArrayValue:data innerType:innerType error:error]; + } + + // map + match = [self.dictPatExpression firstMatchInString:className options:0 range:range]; + if (match) { + NSString *valueType = [className substringWithRange:[match rangeAtIndex:2]]; + return [self deserializeDictionaryValue:data valueType:valueType error:error]; + } + + match = [self.dictModelsPatExpression firstMatchInString:className options:0 range:range]; + if (match) { + NSString *valueType = [className substringWithRange:[match rangeAtIndex:2]]; + return [self deserializeDictionaryValue:data valueType:valueType error:error]; + } + + // model + Class ModelClass = NSClassFromString(className); + if ([ModelClass instancesRespondToSelector:@selector(initWithDictionary:error:)]) { + return [(JSONModel *) [ModelClass alloc] initWithDictionary:data error:error]; + } + + if(error) { + *error = [self unknownResponseErrorWithExpectedType:className data:data]; + } + return nil; +} + +- (id) deserializeDictionaryValue:(id) data valueType:(NSString *) valueType error:(NSError**)error { + if(![data isKindOfClass: [NSDictionary class]]) { + if(error) { + *error = [self typeMismatchErrorWithExpectedType:NSStringFromClass([NSDictionary class]) data:data]; + } + return nil; + } + __block NSMutableDictionary *resultDict = [NSMutableDictionary dictionaryWithCapacity:[data count]]; + for (id key in [data allKeys]) { + id obj = [data valueForKey:key]; + id dicObj = [self deserialize:obj class:valueType error:error]; + if(dicObj) { + [resultDict setValue:dicObj forKey:key]; + } else if([obj isKindOfClass:[NSNull class]]) { + if(self.treatNullAsError) { + if (error) { + *error = [self emptyValueOccurredError]; + } + resultDict = nil; + break; + } + } else { + resultDict = nil; + break; + } + } + return resultDict; +} + +- (id) deserializeArrayValue:(id) data innerType:(NSString *) innerType error:(NSError**)error { + if(![data isKindOfClass: [NSArray class]]) { + if(error) { + *error = [self typeMismatchErrorWithExpectedType:NSStringFromClass([NSArray class]) data:data]; + } + return nil; + } + NSMutableArray* resultArray = [NSMutableArray arrayWithCapacity:[data count]]; + for (id obj in data) { + id arrObj = [self deserialize:obj class:innerType error:error]; + if(arrObj) { + [resultArray addObject:arrObj]; + } else if([obj isKindOfClass:[NSNull class]]) { + if(self.treatNullAsError) { + if (error) { + *error = [self emptyValueOccurredError]; + } + resultArray = nil; + break; + } + } else { + resultArray = nil; + break; + } + } + return resultArray; +}; + +- (id) deserializePrimitiveValue:(id) data class:(NSString *) className error:(NSError**)error { + if ([className isEqualToString:@"NSString"]) { + return [NSString stringWithString:data]; + } + else if ([className isEqualToString:@"NSDate"]) { + return [self deserializeDateValue:data error:error]; + } + else if ([className isEqualToString:@"NSNumber"]) { + // NSNumber from NSNumber + if ([data isKindOfClass:[NSNumber class]]) { + return data; + } + else if ([data isKindOfClass:[NSString class]]) { + // NSNumber (NSCFBoolean) from NSString + if ([[data lowercaseString] isEqualToString:@"true"] || [[data lowercaseString] isEqualToString:@"false"]) { + return @([data boolValue]); + // NSNumber from NSString + } else { + NSNumber* formattedValue = [self.numberFormatter numberFromString:data]; + if(!formattedValue && [data length] > 0 && error) { + *error = [self typeMismatchErrorWithExpectedType:className data:data]; + } + return formattedValue; + } + } + } + if(error) { + *error = [self typeMismatchErrorWithExpectedType:className data:data]; + } + return nil; +} + +- (id) deserializeDateValue:(id) data error:(NSError**)error { + NSDate *date =[NSDate dateWithISO8601String:data]; + if(!date && [data length] > 0 && error) { + *error = [self typeMismatchErrorWithExpectedType:NSStringFromClass([NSDate class]) data:data]; + } + return date; +}; + +-(NSError *)typeMismatchErrorWithExpectedType:(NSString *)expected data:(id)data { + NSString * message = [NSString stringWithFormat:NSLocalizedString(@"Received response [%@] is not an object of type %@",nil),data, expected]; + NSDictionary * userInfo = @{NSLocalizedDescriptionKey : message}; + return [NSError errorWithDomain:SWGDeserializationErrorDomainKey code:SWGTypeMismatchErrorCode userInfo:userInfo]; +} + +-(NSError *)emptyValueOccurredError { + NSString * message = NSLocalizedString(@"Received response contains null value in dictionary or array response",nil); + NSDictionary * userInfo = @{NSLocalizedDescriptionKey : message}; + return [NSError errorWithDomain:SWGDeserializationErrorDomainKey code:SWGEmptyValueOccurredErrorCode userInfo:userInfo]; +} + +-(NSError *)unknownResponseErrorWithExpectedType:(NSString *)expected data:(id)data { + NSString * message = [NSString stringWithFormat:NSLocalizedString(@"Unknown response expected type %@ [reponse: %@]",nil),expected,data]; + NSDictionary * userInfo = @{NSLocalizedDescriptionKey : message}; + return [NSError errorWithDomain:SWGDeserializationErrorDomainKey code:SWGUnknownResponseObjectErrorCode userInfo:userInfo]; +} + +@end diff --git a/samples/client/petstore/objc/default/SwaggerClient/Core/SWGSanitizer.h b/samples/client/petstore/objc/default/SwaggerClient/Core/SWGSanitizer.h new file mode 100644 index 00000000000..59699c2bdd5 --- /dev/null +++ b/samples/client/petstore/objc/default/SwaggerClient/Core/SWGSanitizer.h @@ -0,0 +1,67 @@ +#import + +/** +* Swagger Petstore +* This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +* +* OpenAPI spec version: 1.0.0 +* Contact: apiteam@wordnik.com +* +* NOTE: This class is auto generated by the swagger code generator program. +* https://github.com/swagger-api/swagger-codegen.git +* Do not edit the class manually. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +extern NSString * SWGPercentEscapedStringFromString(NSString *string); + +@protocol SWGSanitizer + +/** + * Sanitize object for request + * + * @param object The query/path/header/form/body param to be sanitized. + */ +- (id) sanitizeForSerialization:(id) object; + +/** + * Convert parameter to NSString + */ +- (NSString *) parameterToString: (id) param; + +/** + * Detects Accept header from accepts NSArray + * + * @param accepts NSArray of header + * + * @return The Accept header + */ +-(NSString *) selectHeaderAccept:(NSArray *)accepts; + +/** + * Detects Content-Type header from contentTypes NSArray + * + * @param contentTypes NSArray of header + * + * @return The Content-Type header + */ +-(NSString *) selectHeaderContentType:(NSArray *)contentTypes; + +@end + +@interface SWGSanitizer : NSObject + + + +@end diff --git a/samples/client/petstore/objc/default/SwaggerClient/Core/SWGSanitizer.m b/samples/client/petstore/objc/default/SwaggerClient/Core/SWGSanitizer.m new file mode 100644 index 00000000000..a74f72afbe3 --- /dev/null +++ b/samples/client/petstore/objc/default/SwaggerClient/Core/SWGSanitizer.m @@ -0,0 +1,168 @@ +#import "SWGSanitizer.h" +#import "SWGObject.h" +#import "SWGQueryParamCollection.h" +#import + +NSString * SWGPercentEscapedStringFromString(NSString *string) { + static NSString * const kSWGCharactersGeneralDelimitersToEncode = @":#[]@"; + static NSString * const kSWGCharactersSubDelimitersToEncode = @"!$&'()*+,;="; + + NSMutableCharacterSet * allowedCharacterSet = [[NSCharacterSet URLQueryAllowedCharacterSet] mutableCopy]; + [allowedCharacterSet removeCharactersInString:[kSWGCharactersGeneralDelimitersToEncode stringByAppendingString:kSWGCharactersSubDelimitersToEncode]]; + + static NSUInteger const batchSize = 50; + + NSUInteger index = 0; + NSMutableString *escaped = @"".mutableCopy; + + while (index < string.length) { + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wgnu" + NSUInteger length = MIN(string.length - index, batchSize); + #pragma GCC diagnostic pop + NSRange range = NSMakeRange(index, length); + + // To avoid breaking up character sequences such as 👴🏻👮🏽 + range = [string rangeOfComposedCharacterSequencesForRange:range]; + + NSString *substring = [string substringWithRange:range]; + NSString *encoded = [substring stringByAddingPercentEncodingWithAllowedCharacters:allowedCharacterSet]; + [escaped appendString:encoded]; + + index += range.length; + } + + return escaped; +} + +@interface SWGSanitizer () + +@property (nonatomic, strong) NSRegularExpression* jsonHeaderTypeExpression; + +@end + +@implementation SWGSanitizer + +static NSString * kApplicationJSONType = @"application/json"; + +-(instancetype)init { + self = [super init]; + if ( !self ) { + return nil; + } + _jsonHeaderTypeExpression = [NSRegularExpression regularExpressionWithPattern:@"(.*)application(.*)json(.*)" options:NSRegularExpressionCaseInsensitive error:nil]; + return self; +} + + +- (id) sanitizeForSerialization:(id) object { + if (object == nil) { + return nil; + } + else if ([object isKindOfClass:[NSString class]] || [object isKindOfClass:[NSNumber class]] || [object isKindOfClass:[SWGQueryParamCollection class]]) { + return object; + } + else if ([object isKindOfClass:[NSDate class]]) { + return [self dateParameterToString:object]; + } + else if ([object isKindOfClass:[NSArray class]]) { + NSArray *objectArray = object; + NSMutableArray *sanitizedObjs = [NSMutableArray arrayWithCapacity:[objectArray count]]; + [object enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { + id sanitizedObj = [self sanitizeForSerialization:obj]; + if (sanitizedObj) { + [sanitizedObjs addObject:sanitizedObj]; + } + }]; + return sanitizedObjs; + } + else if ([object isKindOfClass:[NSDictionary class]]) { + NSDictionary *objectDict = object; + NSMutableDictionary *sanitizedObjs = [NSMutableDictionary dictionaryWithCapacity:[objectDict count]]; + [object enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) { + id sanitizedObj = [self sanitizeForSerialization:obj]; + if (sanitizedObj) { + sanitizedObjs[key] = sanitizedObj; + } + }]; + return sanitizedObjs; + } + else if ([object isKindOfClass:[SWGObject class]]) { + return [object toDictionary]; + } + else { + NSException *e = [NSException + exceptionWithName:@"InvalidObjectArgumentException" + reason:[NSString stringWithFormat:@"*** The argument object: %@ is invalid", object] + userInfo:nil]; + @throw e; + } +} + +- (NSString *) parameterToString:(id)param { + if ([param isKindOfClass:[NSString class]]) { + return param; + } + else if ([param isKindOfClass:[NSNumber class]]) { + return [param stringValue]; + } + else if ([param isKindOfClass:[NSDate class]]) { + return [self dateParameterToString:param]; + } + else if ([param isKindOfClass:[NSArray class]]) { + NSMutableArray *mutableParam = [NSMutableArray array]; + [param enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { + [mutableParam addObject:[self parameterToString:obj]]; + }]; + return [mutableParam componentsJoinedByString:@","]; + } + else { + NSException *e = [NSException + exceptionWithName:@"InvalidObjectArgumentException" + reason:[NSString stringWithFormat:@"*** The argument object: %@ is invalid", param] + userInfo:nil]; + @throw e; + } +} + +- (NSString *)dateParameterToString:(id)param { + return [param ISO8601String]; +} + +#pragma mark - Utility Methods + +/* + * Detect `Accept` from accepts + */ +- (NSString *) selectHeaderAccept:(NSArray *)accepts { + if (accepts.count == 0) { + return @""; + } + NSMutableArray *lowerAccepts = [[NSMutableArray alloc] initWithCapacity:[accepts count]]; + for (NSString *string in accepts) { + if ([self.jsonHeaderTypeExpression matchesInString:string options:0 range:NSMakeRange(0, [string length])].count > 0) { + return kApplicationJSONType; + } + [lowerAccepts addObject:[string lowercaseString]]; + } + return [lowerAccepts componentsJoinedByString:@", "]; +} + +/* + * Detect `Content-Type` from contentTypes + */ +- (NSString *) selectHeaderContentType:(NSArray *)contentTypes { + if (contentTypes.count == 0) { + return kApplicationJSONType; + } + NSMutableArray *lowerContentTypes = [[NSMutableArray alloc] initWithCapacity:[contentTypes count]]; + for (NSString *string in contentTypes) { + if([self.jsonHeaderTypeExpression matchesInString:string options:0 range:NSMakeRange(0, [string length])].count > 0){ + return kApplicationJSONType; + } + [lowerContentTypes addObject:[string lowercaseString]]; + } + return [lowerContentTypes firstObject]; +} + +@end diff --git a/samples/client/petstore/objc/default/SwaggerClient/Model/SWGCategory.h b/samples/client/petstore/objc/default/SwaggerClient/Model/SWGCategory.h new file mode 100644 index 00000000000..1565724cf8c --- /dev/null +++ b/samples/client/petstore/objc/default/SwaggerClient/Model/SWGCategory.h @@ -0,0 +1,40 @@ +#import +#import "SWGObject.h" + +/** +* Swagger Petstore +* This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +* +* OpenAPI spec version: 1.0.0 +* Contact: apiteam@wordnik.com +* +* NOTE: This class is auto generated by the swagger code generator program. +* https://github.com/swagger-api/swagger-codegen.git +* Do not edit the class manually. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + + +@protocol SWGCategory +@end + +@interface SWGCategory : SWGObject + + +@property(nonatomic) NSNumber* _id; + +@property(nonatomic) NSString* name; + +@end diff --git a/samples/client/petstore/objc/default/SwaggerClient/Model/SWGCategory.m b/samples/client/petstore/objc/default/SwaggerClient/Model/SWGCategory.m new file mode 100644 index 00000000000..00745d1f499 --- /dev/null +++ b/samples/client/petstore/objc/default/SwaggerClient/Model/SWGCategory.m @@ -0,0 +1,34 @@ +#import "SWGCategory.h" + +@implementation SWGCategory + +- (instancetype)init { + self = [super init]; + if (self) { + // initialize property's default value, if any + + } + return self; +} + + +/** + * Maps json key to property name. + * This method is used by `JSONModel`. + */ ++ (JSONKeyMapper *)keyMapper { + return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"name": @"name" }]; +} + +/** + * Indicates whether the property with the given name is optional. + * If `propertyName` is optional, then return `YES`, otherwise return `NO`. + * This method is used by `JSONModel`. + */ ++ (BOOL)propertyIsOptional:(NSString *)propertyName { + + NSArray *optionalProperties = @[@"_id", @"name"]; + return [optionalProperties containsObject:propertyName]; +} + +@end diff --git a/samples/client/petstore/objc/default/SwaggerClient/Model/SWGOrder.h b/samples/client/petstore/objc/default/SwaggerClient/Model/SWGOrder.h new file mode 100644 index 00000000000..5c29f61c0e6 --- /dev/null +++ b/samples/client/petstore/objc/default/SwaggerClient/Model/SWGOrder.h @@ -0,0 +1,49 @@ +#import +#import "SWGObject.h" + +/** +* Swagger Petstore +* This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +* +* OpenAPI spec version: 1.0.0 +* Contact: apiteam@wordnik.com +* +* NOTE: This class is auto generated by the swagger code generator program. +* https://github.com/swagger-api/swagger-codegen.git +* Do not edit the class manually. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + + +@protocol SWGOrder +@end + +@interface SWGOrder : SWGObject + + +@property(nonatomic) NSNumber* _id; + +@property(nonatomic) NSNumber* petId; + +@property(nonatomic) NSNumber* quantity; + +@property(nonatomic) NSDate* shipDate; +/* Order Status [optional] + */ +@property(nonatomic) NSString* status; + +@property(nonatomic) NSNumber* complete; + +@end diff --git a/samples/client/petstore/objc/default/SwaggerClient/Model/SWGOrder.m b/samples/client/petstore/objc/default/SwaggerClient/Model/SWGOrder.m new file mode 100644 index 00000000000..e0b44e06954 --- /dev/null +++ b/samples/client/petstore/objc/default/SwaggerClient/Model/SWGOrder.m @@ -0,0 +1,34 @@ +#import "SWGOrder.h" + +@implementation SWGOrder + +- (instancetype)init { + self = [super init]; + if (self) { + // initialize property's default value, if any + + } + return self; +} + + +/** + * Maps json key to property name. + * This method is used by `JSONModel`. + */ ++ (JSONKeyMapper *)keyMapper { + return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"petId": @"petId", @"quantity": @"quantity", @"shipDate": @"shipDate", @"status": @"status", @"complete": @"complete" }]; +} + +/** + * Indicates whether the property with the given name is optional. + * If `propertyName` is optional, then return `YES`, otherwise return `NO`. + * This method is used by `JSONModel`. + */ ++ (BOOL)propertyIsOptional:(NSString *)propertyName { + + NSArray *optionalProperties = @[@"_id", @"petId", @"quantity", @"shipDate", @"status", @"complete"]; + return [optionalProperties containsObject:propertyName]; +} + +@end diff --git a/samples/client/petstore/objc/default/SwaggerClient/Model/SWGPet.h b/samples/client/petstore/objc/default/SwaggerClient/Model/SWGPet.h new file mode 100644 index 00000000000..90de23fbbf5 --- /dev/null +++ b/samples/client/petstore/objc/default/SwaggerClient/Model/SWGPet.h @@ -0,0 +1,51 @@ +#import +#import "SWGObject.h" + +/** +* Swagger Petstore +* This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +* +* OpenAPI spec version: 1.0.0 +* Contact: apiteam@wordnik.com +* +* NOTE: This class is auto generated by the swagger code generator program. +* https://github.com/swagger-api/swagger-codegen.git +* Do not edit the class manually. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#import "SWGCategory.h" +#import "SWGTag.h" + + +@protocol SWGPet +@end + +@interface SWGPet : SWGObject + + +@property(nonatomic) NSNumber* _id; + +@property(nonatomic) SWGCategory* category; + +@property(nonatomic) NSString* name; + +@property(nonatomic) NSArray* photoUrls; + +@property(nonatomic) NSArray* tags; +/* pet status in the store [optional] + */ +@property(nonatomic) NSString* status; + +@end diff --git a/samples/client/petstore/objc/default/SwaggerClient/Model/SWGPet.m b/samples/client/petstore/objc/default/SwaggerClient/Model/SWGPet.m new file mode 100644 index 00000000000..a1c63520dc4 --- /dev/null +++ b/samples/client/petstore/objc/default/SwaggerClient/Model/SWGPet.m @@ -0,0 +1,34 @@ +#import "SWGPet.h" + +@implementation SWGPet + +- (instancetype)init { + self = [super init]; + if (self) { + // initialize property's default value, if any + + } + return self; +} + + +/** + * Maps json key to property name. + * This method is used by `JSONModel`. + */ ++ (JSONKeyMapper *)keyMapper { + return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"category": @"category", @"name": @"name", @"photoUrls": @"photoUrls", @"tags": @"tags", @"status": @"status" }]; +} + +/** + * Indicates whether the property with the given name is optional. + * If `propertyName` is optional, then return `YES`, otherwise return `NO`. + * This method is used by `JSONModel`. + */ ++ (BOOL)propertyIsOptional:(NSString *)propertyName { + + NSArray *optionalProperties = @[@"_id", @"category", @"tags", @"status"]; + return [optionalProperties containsObject:propertyName]; +} + +@end diff --git a/samples/client/petstore/objc/default/SwaggerClient/Model/SWGTag.h b/samples/client/petstore/objc/default/SwaggerClient/Model/SWGTag.h new file mode 100644 index 00000000000..97aa6162af6 --- /dev/null +++ b/samples/client/petstore/objc/default/SwaggerClient/Model/SWGTag.h @@ -0,0 +1,40 @@ +#import +#import "SWGObject.h" + +/** +* Swagger Petstore +* This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +* +* OpenAPI spec version: 1.0.0 +* Contact: apiteam@wordnik.com +* +* NOTE: This class is auto generated by the swagger code generator program. +* https://github.com/swagger-api/swagger-codegen.git +* Do not edit the class manually. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + + +@protocol SWGTag +@end + +@interface SWGTag : SWGObject + + +@property(nonatomic) NSNumber* _id; + +@property(nonatomic) NSString* name; + +@end diff --git a/samples/client/petstore/objc/default/SwaggerClient/Model/SWGTag.m b/samples/client/petstore/objc/default/SwaggerClient/Model/SWGTag.m new file mode 100644 index 00000000000..e71829873d1 --- /dev/null +++ b/samples/client/petstore/objc/default/SwaggerClient/Model/SWGTag.m @@ -0,0 +1,34 @@ +#import "SWGTag.h" + +@implementation SWGTag + +- (instancetype)init { + self = [super init]; + if (self) { + // initialize property's default value, if any + + } + return self; +} + + +/** + * Maps json key to property name. + * This method is used by `JSONModel`. + */ ++ (JSONKeyMapper *)keyMapper { + return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"name": @"name" }]; +} + +/** + * Indicates whether the property with the given name is optional. + * If `propertyName` is optional, then return `YES`, otherwise return `NO`. + * This method is used by `JSONModel`. + */ ++ (BOOL)propertyIsOptional:(NSString *)propertyName { + + NSArray *optionalProperties = @[@"_id", @"name"]; + return [optionalProperties containsObject:propertyName]; +} + +@end diff --git a/samples/client/petstore/objc/default/SwaggerClient/Model/SWGUser.h b/samples/client/petstore/objc/default/SwaggerClient/Model/SWGUser.h new file mode 100644 index 00000000000..2c94220a57e --- /dev/null +++ b/samples/client/petstore/objc/default/SwaggerClient/Model/SWGUser.h @@ -0,0 +1,53 @@ +#import +#import "SWGObject.h" + +/** +* Swagger Petstore +* This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +* +* OpenAPI spec version: 1.0.0 +* Contact: apiteam@wordnik.com +* +* NOTE: This class is auto generated by the swagger code generator program. +* https://github.com/swagger-api/swagger-codegen.git +* Do not edit the class manually. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + + +@protocol SWGUser +@end + +@interface SWGUser : SWGObject + + +@property(nonatomic) NSNumber* _id; + +@property(nonatomic) NSString* username; + +@property(nonatomic) NSString* firstName; + +@property(nonatomic) NSString* lastName; + +@property(nonatomic) NSString* email; + +@property(nonatomic) NSString* password; + +@property(nonatomic) NSString* phone; +/* User Status [optional] + */ +@property(nonatomic) NSNumber* userStatus; + +@end diff --git a/samples/client/petstore/objc/default/SwaggerClient/Model/SWGUser.m b/samples/client/petstore/objc/default/SwaggerClient/Model/SWGUser.m new file mode 100644 index 00000000000..c8195660df6 --- /dev/null +++ b/samples/client/petstore/objc/default/SwaggerClient/Model/SWGUser.m @@ -0,0 +1,34 @@ +#import "SWGUser.h" + +@implementation SWGUser + +- (instancetype)init { + self = [super init]; + if (self) { + // initialize property's default value, if any + + } + return self; +} + + +/** + * Maps json key to property name. + * This method is used by `JSONModel`. + */ ++ (JSONKeyMapper *)keyMapper { + return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"username": @"username", @"firstName": @"firstName", @"lastName": @"lastName", @"email": @"email", @"password": @"password", @"phone": @"phone", @"userStatus": @"userStatus" }]; +} + +/** + * Indicates whether the property with the given name is optional. + * If `propertyName` is optional, then return `YES`, otherwise return `NO`. + * This method is used by `JSONModel`. + */ ++ (BOOL)propertyIsOptional:(NSString *)propertyName { + + NSArray *optionalProperties = @[@"_id", @"username", @"firstName", @"lastName", @"email", @"password", @"phone", @"userStatus"]; + return [optionalProperties containsObject:propertyName]; +} + +@end diff --git a/samples/client/petstore/objc/default/SwaggerClientTests/Podfile b/samples/client/petstore/objc/default/SwaggerClientTests/Podfile new file mode 100644 index 00000000000..22654e6adda --- /dev/null +++ b/samples/client/petstore/objc/default/SwaggerClientTests/Podfile @@ -0,0 +1,12 @@ +source 'https://github.com/CocoaPods/Specs.git' + +target 'SwaggerClient_Example' do + pod "SwaggerClient", :path => "../" +end + +target 'SwaggerClient_Tests' do + pod "SwaggerClient", :path => "../" + + pod 'Specta' + pod 'Expecta' +end diff --git a/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient.xcodeproj/project.pbxproj b/samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient.xcodeproj/project.pbxproj similarity index 98% rename from samples/client/petstore/objc/SwaggerClientTests/SwaggerClient.xcodeproj/project.pbxproj rename to samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient.xcodeproj/project.pbxproj index 1a8aa88ce42..cd20eb43998 100644 --- a/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient.xcodeproj/project.pbxproj +++ b/samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient.xcodeproj/project.pbxproj @@ -24,7 +24,6 @@ B2ADC0B1C8A60A05C48B4DF7 /* DatabaseHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = B2ADC55130D5E329ED945E8F /* DatabaseHelper.m */; }; B2ADC17C287DCABF329BA8AC /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B2ADC7027D4B025ABCA7999F /* Main.storyboard */; }; B2ADC2D632658A5F73C6CE66 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B2ADC65E342ADA697322D68C /* Images.xcassets */; }; - B2ADC3C7634D15595DD14814 /* BuildersTest.m in Sources */ = {isa = PBXBuildFile; fileRef = B2ADC838FCC22F4BC6C41106 /* BuildersTest.m */; }; B2ADC56977372855A63F4E4D /* Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B2ADC084A2C0BDF217832B03 /* Launch Screen.storyboard */; }; CF0ADB481B5F95D6008A2729 /* PetTest.m in Sources */ = {isa = PBXBuildFile; fileRef = CF0ADB471B5F95D6008A2729 /* PetTest.m */; }; CF8F71391B5F73AC00162980 /* DeserializationTest.m in Sources */ = {isa = PBXBuildFile; fileRef = CF8F71381B5F73AC00162980 /* DeserializationTest.m */; }; @@ -72,7 +71,6 @@ B2ADC55130D5E329ED945E8F /* DatabaseHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DatabaseHelper.m; sourceTree = ""; }; B2ADC65E342ADA697322D68C /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = SwaggerClient/Images.xcassets; sourceTree = ""; }; B2ADC7027D4B025ABCA7999F /* Main.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Main.storyboard; path = SwaggerClient/Main.storyboard; sourceTree = ""; }; - B2ADC838FCC22F4BC6C41106 /* BuildersTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BuildersTest.m; sourceTree = ""; }; BFB4BE760737508B3CFC23B2 /* Pods-SwaggerClient_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwaggerClient_Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-SwaggerClient_Example/Pods-SwaggerClient_Example.release.xcconfig"; sourceTree = ""; }; CF0ADB471B5F95D6008A2729 /* PetTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PetTest.m; sourceTree = ""; }; CF8F71381B5F73AC00162980 /* DeserializationTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DeserializationTest.m; sourceTree = ""; }; @@ -181,7 +179,6 @@ CFDFB40D1B3CFEC3009739C5 /* UserApiTest.m */, 6003F5BB195388D20070C39A /* Tests.m */, 6003F5B6195388D20070C39A /* Supporting Files */, - B2ADC838FCC22F4BC6C41106 /* BuildersTest.m */, B2ADCA62DE4AC0F5BAB42208 /* Helpers */, ); path = Tests; @@ -438,7 +435,6 @@ CFDFB4151B3D000B009739C5 /* SWGApiClientTest.m in Sources */, CFDFB4121B3CFFA8009739C5 /* UserApiTest.m in Sources */, CF8F71391B5F73AC00162980 /* DeserializationTest.m in Sources */, - B2ADC3C7634D15595DD14814 /* BuildersTest.m in Sources */, B2ADC0B1C8A60A05C48B4DF7 /* DatabaseHelper.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000000..13bdd8ab8b7 --- /dev/null +++ b/samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient.xcodeproj/xcshareddata/xcschemes/All Tests.xcscheme b/samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient.xcodeproj/xcshareddata/xcschemes/All Tests.xcscheme new file mode 100644 index 00000000000..5c68411bb2d --- /dev/null +++ b/samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient.xcodeproj/xcshareddata/xcschemes/All Tests.xcscheme @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient.xcodeproj/xcshareddata/xcschemes/SwaggerClient-Example.xcscheme b/samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient.xcodeproj/xcshareddata/xcschemes/SwaggerClient-Example.xcscheme new file mode 100644 index 00000000000..d34e508f438 --- /dev/null +++ b/samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient.xcodeproj/xcshareddata/xcschemes/SwaggerClient-Example.xcscheme @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient/Images.xcassets/AppIcon.appiconset/Contents.json b/samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient/Images.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000000..f697f61f4aa --- /dev/null +++ b/samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient/Images.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,53 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient/Images.xcassets/LaunchImage.launchimage/Contents.json b/samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient/Images.xcassets/LaunchImage.launchimage/Contents.json new file mode 100644 index 00000000000..4458b40c055 --- /dev/null +++ b/samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient/Images.xcassets/LaunchImage.launchimage/Contents.json @@ -0,0 +1,51 @@ +{ + "images" : [ + { + "orientation" : "portrait", + "idiom" : "iphone", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "2x" + }, + { + "orientation" : "portrait", + "idiom" : "iphone", + "subtype" : "retina4", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "2x" + }, + { + "orientation" : "portrait", + "idiom" : "ipad", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "1x" + }, + { + "orientation" : "landscape", + "idiom" : "ipad", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "1x" + }, + { + "orientation" : "portrait", + "idiom" : "ipad", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "2x" + }, + { + "orientation" : "landscape", + "idiom" : "ipad", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient/Launch Screen.storyboard b/samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient/Launch Screen.storyboard new file mode 100644 index 00000000000..36df4e16819 --- /dev/null +++ b/samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient/Launch Screen.storyboard @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient/Main.storyboard b/samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient/Main.storyboard new file mode 100644 index 00000000000..f204320d333 --- /dev/null +++ b/samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient/Main.storyboard @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient/SWGAppDelegate.h b/samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient/SWGAppDelegate.h new file mode 100644 index 00000000000..eb867594fde --- /dev/null +++ b/samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient/SWGAppDelegate.h @@ -0,0 +1,15 @@ +// +// SWGAppDelegate.h +// SwaggerClient +// +// Created by CocoaPods on 06/26/2015. +// Copyright (c) 2014 geekerzp. All rights reserved. +// + +@import UIKit; + +@interface SWGAppDelegate : UIResponder + +@property (strong, nonatomic) UIWindow *window; + +@end diff --git a/samples/client/petstore/objc/SwaggerClientTests/SwaggerClient/SWGAppDelegate.m b/samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient/SWGAppDelegate.m similarity index 100% rename from samples/client/petstore/objc/SwaggerClientTests/SwaggerClient/SWGAppDelegate.m rename to samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient/SWGAppDelegate.m diff --git a/samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient/SWGViewController.h b/samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient/SWGViewController.h new file mode 100644 index 00000000000..7847f2d05b1 --- /dev/null +++ b/samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient/SWGViewController.h @@ -0,0 +1,13 @@ +// +// SWGViewController.h +// SwaggerClient +// +// Created by geekerzp on 06/26/2015. +// Copyright (c) 2014 geekerzp. All rights reserved. +// + +@import UIKit; + +@interface SWGViewController : UIViewController + +@end diff --git a/samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient/SWGViewController.m b/samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient/SWGViewController.m new file mode 100644 index 00000000000..7f8e3d67881 --- /dev/null +++ b/samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient/SWGViewController.m @@ -0,0 +1,60 @@ +// +// SWGViewController.m +// SwaggerClient +// +// Created by geekerzp on 06/26/2015. +// Copyright (c) 2014 geekerzp. All rights reserved. +// + +#import "SWGViewController.h" +#import +#import +#import +#import + +@interface SWGViewController () + +@end + +@implementation SWGViewController + +- (void)viewDidLoad +{ + [super viewDidLoad]; + + SWGConfiguration *config = [SWGConfiguration sharedConfig]; + config.debug = YES; + + SWGPetApi *api = [[SWGPetApi alloc] init]; + NSURL *file = [NSURL fileURLWithPath:@"/Users/geekerzp/tmp/test.jpg"]; + [api uploadFileWithPetId:@2 additionalMetadata:@"2" file:file completionHandler:^(NSError *error) { + NSLog(@"*** error: %@", error); + }]; +} + +- (SWGPet*) createPet { + SWGPet * pet = [[SWGPet alloc] init]; + pet._id = @((long) [[NSDate date] timeIntervalSince1970]); + pet.name = @"monkey"; + + SWGCategory * category = [[SWGCategory alloc] init]; + category._id = [[NSNumber alloc] initWithInteger:arc4random_uniform(100000)]; + category.name = @"super-happy"; + pet.category = category; + + SWGTag *tag1 = [[SWGTag alloc] init]; + tag1._id = [[NSNumber alloc] initWithInteger:arc4random_uniform(100000)]; + tag1.name = @"test tag 1"; + SWGTag *tag2 = [[SWGTag alloc] init]; + tag2._id = [[NSNumber alloc] initWithInteger:arc4random_uniform(100000)]; + tag2.name = @"test tag 2"; + pet.tags = (NSArray *) @[tag1, tag2]; + + pet.status = @"available"; + + NSArray * photos = @[@"http://foo.bar.com/3", @"http://foo.bar.com/4"]; + pet.photoUrls = photos; + return pet; +} + +@end diff --git a/samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient/SwaggerClient-Info.plist b/samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient/SwaggerClient-Info.plist new file mode 100644 index 00000000000..e21b2835ad7 --- /dev/null +++ b/samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient/SwaggerClient-Info.plist @@ -0,0 +1,54 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleDisplayName + ${PRODUCT_NAME} + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + LSRequiresIPhoneOS + + NSAppTransportSecurity + + NSAllowsArbitraryLoads + + + UILaunchStoryboardName + Launch Screen + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient/SwaggerClient-Prefix.pch b/samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient/SwaggerClient-Prefix.pch new file mode 100644 index 00000000000..7825372cbdd --- /dev/null +++ b/samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient/SwaggerClient-Prefix.pch @@ -0,0 +1,16 @@ +// +// Prefix header +// +// The contents of this file are implicitly included at the beginning of every source file. +// + +#import + +#ifndef __IPHONE_5_0 +#warning "This project uses features only available in iOS SDK 5.0 and later." +#endif + +#ifdef __OBJC__ + @import UIKit; + @import Foundation; +#endif diff --git a/samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient/en.lproj/InfoPlist.strings b/samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient/en.lproj/InfoPlist.strings new file mode 100644 index 00000000000..477b28ff8f8 --- /dev/null +++ b/samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient/en.lproj/InfoPlist.strings @@ -0,0 +1,2 @@ +/* Localized versions of Info.plist keys */ + diff --git a/samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient/main.m b/samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient/main.m new file mode 100644 index 00000000000..4a47f1fd69e --- /dev/null +++ b/samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient/main.m @@ -0,0 +1,17 @@ +// +// main.m +// SwaggerClient +// +// Created by geekerzp on 06/26/2015. +// Copyright (c) 2014 geekerzp. All rights reserved. +// + +@import UIKit; +#import "SWGAppDelegate.h" + +int main(int argc, char * argv[]) +{ + @autoreleasepool { + return UIApplicationMain(argc, argv, nil, NSStringFromClass([SWGAppDelegate class])); + } +} diff --git a/samples/client/petstore/objc/SwaggerClientTests/Tests/DeserializationTest.m b/samples/client/petstore/objc/default/SwaggerClientTests/Tests/DeserializationTest.m similarity index 100% rename from samples/client/petstore/objc/SwaggerClientTests/Tests/DeserializationTest.m rename to samples/client/petstore/objc/default/SwaggerClientTests/Tests/DeserializationTest.m diff --git a/samples/client/petstore/objc/default/SwaggerClientTests/Tests/Helpers/DatabaseHelper.h b/samples/client/petstore/objc/default/SwaggerClientTests/Tests/Helpers/DatabaseHelper.h new file mode 100644 index 00000000000..8216e012a32 --- /dev/null +++ b/samples/client/petstore/objc/default/SwaggerClientTests/Tests/Helpers/DatabaseHelper.h @@ -0,0 +1,14 @@ +#import +#import + +@interface DatabaseHelper : NSObject + ++ (NSManagedObjectContext *)createContextWithModelName:(NSString *)mName; + ++ (void)clearContext:(NSManagedObjectContext *)ctx fromEntitiesWithName:(NSString *)entityName; + ++ (NSManagedObjectModel *)createModelWithModelName:(NSString *)mName; + ++ (NSManagedObjectContext *)createDatabaseWithModel:(NSManagedObjectModel*)model; + +@end diff --git a/samples/client/petstore/objc/default/SwaggerClientTests/Tests/Helpers/DatabaseHelper.m b/samples/client/petstore/objc/default/SwaggerClientTests/Tests/Helpers/DatabaseHelper.m new file mode 100644 index 00000000000..3433ac19ddb --- /dev/null +++ b/samples/client/petstore/objc/default/SwaggerClientTests/Tests/Helpers/DatabaseHelper.m @@ -0,0 +1,42 @@ +#import "DatabaseHelper.h" + +@implementation DatabaseHelper + + ++ (NSManagedObjectContext *)createContextWithModelName:(NSString *)mName { + NSManagedObjectModel *model = [self createModelWithModelName:mName]; + return [self createDatabaseWithModel:model]; +} + ++ (NSManagedObjectContext *)createDatabaseWithModel:(NSManagedObjectModel*)model { + NSPersistentStoreCoordinator *coordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:model]; + [coordinator addPersistentStoreWithType:NSInMemoryStoreType configuration:nil URL:nil options:nil error:nil]; + + NSManagedObjectContext *testingContext = [[NSManagedObjectContext alloc] initWithConcurrencyType:NSMainQueueConcurrencyType]; + [testingContext setPersistentStoreCoordinator:coordinator]; + [testingContext setMergePolicy:NSMergeByPropertyObjectTrumpMergePolicy]; + return testingContext; +} + ++ (NSManagedObjectModel *)createModelWithModelName:(NSString *)mName { + NSBundle *bundle = [NSBundle bundleForClass:[self class]]; + NSString *path = [bundle pathForResource:mName ofType:@"momd"]; + NSAssert(path, @"Missing Model for name: %@",mName); + NSURL *modURL = [NSURL fileURLWithPath:path]; + return [[NSManagedObjectModel alloc] initWithContentsOfURL:modURL]; +} + ++ (void)clearContext:(NSManagedObjectContext *)ctx fromEntitiesWithName:(NSString *)entityName { + NSFetchRequest *fetch = [[NSFetchRequest alloc] init]; + [fetch setEntity:[NSEntityDescription entityForName:entityName inManagedObjectContext:ctx]]; + NSError *error = nil; + NSArray *result = [ctx executeFetchRequest:fetch error:&error]; + if (error) { + NSLog(@"Failed clearing context from entities with name [%@]", error); + } + for (id basket in result) { + [ctx deleteObject:basket]; + } +} + +@end diff --git a/samples/client/petstore/objc/SwaggerClientTests/Tests/PetApiTest.m b/samples/client/petstore/objc/default/SwaggerClientTests/Tests/PetApiTest.m similarity index 100% rename from samples/client/petstore/objc/SwaggerClientTests/Tests/PetApiTest.m rename to samples/client/petstore/objc/default/SwaggerClientTests/Tests/PetApiTest.m diff --git a/samples/client/petstore/objc/SwaggerClientTests/Tests/PetTest.m b/samples/client/petstore/objc/default/SwaggerClientTests/Tests/PetTest.m similarity index 100% rename from samples/client/petstore/objc/SwaggerClientTests/Tests/PetTest.m rename to samples/client/petstore/objc/default/SwaggerClientTests/Tests/PetTest.m diff --git a/samples/client/petstore/objc/SwaggerClientTests/Tests/SWGApiClientTest.m b/samples/client/petstore/objc/default/SwaggerClientTests/Tests/SWGApiClientTest.m similarity index 100% rename from samples/client/petstore/objc/SwaggerClientTests/Tests/SWGApiClientTest.m rename to samples/client/petstore/objc/default/SwaggerClientTests/Tests/SWGApiClientTest.m diff --git a/samples/client/petstore/objc/SwaggerClientTests/Tests/StoreApiTest.m b/samples/client/petstore/objc/default/SwaggerClientTests/Tests/StoreApiTest.m similarity index 100% rename from samples/client/petstore/objc/SwaggerClientTests/Tests/StoreApiTest.m rename to samples/client/petstore/objc/default/SwaggerClientTests/Tests/StoreApiTest.m diff --git a/samples/client/petstore/objc/default/SwaggerClientTests/Tests/Tests-Info.plist b/samples/client/petstore/objc/default/SwaggerClientTests/Tests/Tests-Info.plist new file mode 100644 index 00000000000..41520eda89e --- /dev/null +++ b/samples/client/petstore/objc/default/SwaggerClientTests/Tests/Tests-Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + + diff --git a/samples/client/petstore/objc/default/SwaggerClientTests/Tests/Tests-Prefix.pch b/samples/client/petstore/objc/default/SwaggerClientTests/Tests/Tests-Prefix.pch new file mode 100644 index 00000000000..6d08c288215 --- /dev/null +++ b/samples/client/petstore/objc/default/SwaggerClientTests/Tests/Tests-Prefix.pch @@ -0,0 +1,8 @@ +// The contents of this file are implicitly included at the beginning of every test case source file. + +#ifdef __OBJC__ + + //@import Specta; + //@import Expecta; + +#endif diff --git a/samples/client/petstore/objc/SwaggerClientTests/Tests/Tests.m b/samples/client/petstore/objc/default/SwaggerClientTests/Tests/Tests.m similarity index 100% rename from samples/client/petstore/objc/SwaggerClientTests/Tests/Tests.m rename to samples/client/petstore/objc/default/SwaggerClientTests/Tests/Tests.m diff --git a/samples/client/petstore/objc/SwaggerClientTests/Tests/UserApiTest.m b/samples/client/petstore/objc/default/SwaggerClientTests/Tests/UserApiTest.m similarity index 100% rename from samples/client/petstore/objc/SwaggerClientTests/Tests/UserApiTest.m rename to samples/client/petstore/objc/default/SwaggerClientTests/Tests/UserApiTest.m diff --git a/samples/client/petstore/objc/default/SwaggerClientTests/Tests/en.lproj/InfoPlist.strings b/samples/client/petstore/objc/default/SwaggerClientTests/Tests/en.lproj/InfoPlist.strings new file mode 100644 index 00000000000..477b28ff8f8 --- /dev/null +++ b/samples/client/petstore/objc/default/SwaggerClientTests/Tests/en.lproj/InfoPlist.strings @@ -0,0 +1,2 @@ +/* Localized versions of Info.plist keys */ + diff --git a/samples/client/petstore/objc/default/SwaggerClientTests/pom.xml b/samples/client/petstore/objc/default/SwaggerClientTests/pom.xml new file mode 100644 index 00000000000..a480547e0ae --- /dev/null +++ b/samples/client/petstore/objc/default/SwaggerClientTests/pom.xml @@ -0,0 +1,65 @@ + + 4.0.0 + io.swagger + ObjcPetstoreClientTests + pom + 1.0-SNAPSHOT + Objective-C Swagger Petstore Client + + + + maven-dependency-plugin + + + package + + copy-dependencies + + + ${project.build.directory} + + + + + + org.codehaus.mojo + exec-maven-plugin + 1.2.1 + + + install-pods + pre-integration-test + + exec + + + pod + + install + + + + + xcodebuild-test + integration-test + + exec + + + xcodebuild + + -workspace + SwaggerClient.xcworkspace + -scheme + SwaggerClient-Example + test + -destination + platform=iOS Simulator,name=iPhone 5s,OS=9.3 + + + + + + + + diff --git a/samples/client/petstore/objc/docs/SWGCategory.md b/samples/client/petstore/objc/default/docs/SWGCategory.md similarity index 100% rename from samples/client/petstore/objc/docs/SWGCategory.md rename to samples/client/petstore/objc/default/docs/SWGCategory.md diff --git a/samples/client/petstore/objc/docs/SWGOrder.md b/samples/client/petstore/objc/default/docs/SWGOrder.md similarity index 100% rename from samples/client/petstore/objc/docs/SWGOrder.md rename to samples/client/petstore/objc/default/docs/SWGOrder.md diff --git a/samples/client/petstore/objc/docs/SWGPet.md b/samples/client/petstore/objc/default/docs/SWGPet.md similarity index 100% rename from samples/client/petstore/objc/docs/SWGPet.md rename to samples/client/petstore/objc/default/docs/SWGPet.md diff --git a/samples/client/petstore/objc/docs/SWGPetApi.md b/samples/client/petstore/objc/default/docs/SWGPetApi.md similarity index 100% rename from samples/client/petstore/objc/docs/SWGPetApi.md rename to samples/client/petstore/objc/default/docs/SWGPetApi.md diff --git a/samples/client/petstore/objc/docs/SWGStoreApi.md b/samples/client/petstore/objc/default/docs/SWGStoreApi.md similarity index 100% rename from samples/client/petstore/objc/docs/SWGStoreApi.md rename to samples/client/petstore/objc/default/docs/SWGStoreApi.md diff --git a/samples/client/petstore/objc/docs/SWGTag.md b/samples/client/petstore/objc/default/docs/SWGTag.md similarity index 100% rename from samples/client/petstore/objc/docs/SWGTag.md rename to samples/client/petstore/objc/default/docs/SWGTag.md diff --git a/samples/client/petstore/objc/docs/SWGUser.md b/samples/client/petstore/objc/default/docs/SWGUser.md similarity index 100% rename from samples/client/petstore/objc/docs/SWGUser.md rename to samples/client/petstore/objc/default/docs/SWGUser.md diff --git a/samples/client/petstore/objc/docs/SWGUserApi.md b/samples/client/petstore/objc/default/docs/SWGUserApi.md similarity index 100% rename from samples/client/petstore/objc/docs/SWGUserApi.md rename to samples/client/petstore/objc/default/docs/SWGUserApi.md diff --git a/samples/client/petstore/objc/default/git_push.sh b/samples/client/petstore/objc/default/git_push.sh new file mode 100644 index 00000000000..ed374619b13 --- /dev/null +++ b/samples/client/petstore/objc/default/git_push.sh @@ -0,0 +1,52 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=`git remote` +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." + git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' + diff --git a/samples/client/petstore/objc/docs/SWG200Response.md b/samples/client/petstore/objc/docs/SWG200Response.md deleted file mode 100644 index 31392772201..00000000000 --- a/samples/client/petstore/objc/docs/SWG200Response.md +++ /dev/null @@ -1,10 +0,0 @@ -# SWG200Response - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**name** | **NSNumber*** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/client/petstore/objc/docs/SWGAdditionalPropertiesClass.md b/samples/client/petstore/objc/docs/SWGAdditionalPropertiesClass.md deleted file mode 100644 index 930b5b886d9..00000000000 --- a/samples/client/petstore/objc/docs/SWGAdditionalPropertiesClass.md +++ /dev/null @@ -1,11 +0,0 @@ -# SWGAdditionalPropertiesClass - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**mapProperty** | **NSDictionary<NSString*, NSString*>*** | | [optional] -**mapOfMapProperty** | [**NSDictionary<NSString*, NSDictionary<NSString*, NSString*>*>***](NSDictionary.md) | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/client/petstore/objc/docs/SWGAnimal.md b/samples/client/petstore/objc/docs/SWGAnimal.md deleted file mode 100644 index a54bdefe8af..00000000000 --- a/samples/client/petstore/objc/docs/SWGAnimal.md +++ /dev/null @@ -1,11 +0,0 @@ -# SWGAnimal - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**className** | **NSString*** | | -**color** | **NSString*** | | [optional] [default to @"red"] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/client/petstore/objc/docs/SWGAnimalFarm.md b/samples/client/petstore/objc/docs/SWGAnimalFarm.md deleted file mode 100644 index 48b268a95f3..00000000000 --- a/samples/client/petstore/objc/docs/SWGAnimalFarm.md +++ /dev/null @@ -1,9 +0,0 @@ -# SWGAnimalFarm - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/client/petstore/objc/docs/SWGApiResponse.md b/samples/client/petstore/objc/docs/SWGApiResponse.md deleted file mode 100644 index 88ff755faf7..00000000000 --- a/samples/client/petstore/objc/docs/SWGApiResponse.md +++ /dev/null @@ -1,12 +0,0 @@ -# SWGApiResponse - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**code** | **NSNumber*** | | [optional] -**type** | **NSString*** | | [optional] -**message** | **NSString*** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/client/petstore/objc/docs/SWGArrayTest.md b/samples/client/petstore/objc/docs/SWGArrayTest.md deleted file mode 100644 index 089bd48dc16..00000000000 --- a/samples/client/petstore/objc/docs/SWGArrayTest.md +++ /dev/null @@ -1,12 +0,0 @@ -# SWGArrayTest - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**arrayOfString** | **NSArray<NSString*>*** | | [optional] -**arrayArrayOfInteger** | [**NSArray<NSArray<NSNumber*>*>***](NSArray.md) | | [optional] -**arrayArrayOfModel** | [**NSArray<NSArray<SWGReadOnlyFirst>*>***](NSArray.md) | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/client/petstore/objc/docs/SWGCat.md b/samples/client/petstore/objc/docs/SWGCat.md deleted file mode 100644 index 9fd46b05af0..00000000000 --- a/samples/client/petstore/objc/docs/SWGCat.md +++ /dev/null @@ -1,12 +0,0 @@ -# SWGCat - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**className** | **NSString*** | | -**color** | **NSString*** | | [optional] [default to @"red"] -**declawed** | **NSNumber*** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/client/petstore/objc/docs/SWGDog.md b/samples/client/petstore/objc/docs/SWGDog.md deleted file mode 100644 index 1b3deb35c3f..00000000000 --- a/samples/client/petstore/objc/docs/SWGDog.md +++ /dev/null @@ -1,12 +0,0 @@ -# SWGDog - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**className** | **NSString*** | | -**color** | **NSString*** | | [optional] [default to @"red"] -**breed** | **NSString*** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/client/petstore/objc/docs/SWGEnumClass.md b/samples/client/petstore/objc/docs/SWGEnumClass.md deleted file mode 100644 index 6acdf03e456..00000000000 --- a/samples/client/petstore/objc/docs/SWGEnumClass.md +++ /dev/null @@ -1,9 +0,0 @@ -# SWGEnumClass - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/client/petstore/objc/docs/SWGEnumTest.md b/samples/client/petstore/objc/docs/SWGEnumTest.md deleted file mode 100644 index 4f0c5f3285e..00000000000 --- a/samples/client/petstore/objc/docs/SWGEnumTest.md +++ /dev/null @@ -1,12 +0,0 @@ -# SWGEnumTest - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**enumString** | **NSString*** | | [optional] -**enumInteger** | **NSNumber*** | | [optional] -**enumNumber** | **NSNumber*** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/client/petstore/objc/docs/SWGFakeApi.md b/samples/client/petstore/objc/docs/SWGFakeApi.md deleted file mode 100644 index 536f88dee8e..00000000000 --- a/samples/client/petstore/objc/docs/SWGFakeApi.md +++ /dev/null @@ -1,100 +0,0 @@ -# SWGFakeApi - -All URIs are relative to *http://petstore.swagger.io/v2* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**testEndpointParameters**](SWGFakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - - -# **testEndpointParameters** -```objc --(NSNumber*) testEndpointParametersWithNumber: (NSNumber*) number - _double: (NSNumber*) _double - string: (NSString*) string - byte: (NSData*) byte - integer: (NSNumber*) integer - int32: (NSNumber*) int32 - int64: (NSNumber*) int64 - _float: (NSNumber*) _float - binary: (NSData*) binary - date: (NSDate*) date - dateTime: (NSDate*) dateTime - password: (NSString*) password - completionHandler: (void (^)(NSError* error)) handler; -``` - -Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - -Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - -### Example -```objc - -NSNumber* number = @3.4; // None -NSNumber* _double = @1.2; // None -NSString* string = @"string_example"; // None -NSData* byte = [[NSData alloc] init]; // None -NSNumber* integer = @56; // None (optional) -NSNumber* int32 = @56; // None (optional) -NSNumber* int64 = @789; // None (optional) -NSNumber* _float = @3.4; // None (optional) -NSData* binary = [[NSData alloc] init]; // None (optional) -NSDate* date = @"2013-10-20"; // None (optional) -NSDate* dateTime = @"2013-10-20T19:20:30+01:00"; // None (optional) -NSString* password = @"password_example"; // None (optional) - -SWGFakeApi*apiInstance = [[SWGFakeApi alloc] init]; - -// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 -[apiInstance testEndpointParametersWithNumber:number - _double:_double - string:string - byte:byte - integer:integer - int32:int32 - int64:int64 - _float:_float - binary:binary - date:date - dateTime:dateTime - password:password - completionHandler: ^(NSError* error) { - if (error) { - NSLog(@"Error calling SWGFakeApi->testEndpointParameters: %@", error); - } - }]; -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **number** | **NSNumber***| None | - **_double** | **NSNumber***| None | - **string** | **NSString***| None | - **byte** | **NSData***| None | - **integer** | **NSNumber***| None | [optional] - **int32** | **NSNumber***| None | [optional] - **int64** | **NSNumber***| None | [optional] - **_float** | **NSNumber***| None | [optional] - **binary** | **NSData***| None | [optional] - **date** | **NSDate***| None | [optional] - **dateTime** | **NSDate***| None | [optional] - **password** | **NSString***| None | [optional] - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/xml; charset=utf-8, application/json; charset=utf-8 - - **Accept**: application/xml; charset=utf-8, application/json; charset=utf-8 - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/objc/docs/SWGFormatTest.md b/samples/client/petstore/objc/docs/SWGFormatTest.md deleted file mode 100644 index 2682c4a3a78..00000000000 --- a/samples/client/petstore/objc/docs/SWGFormatTest.md +++ /dev/null @@ -1,22 +0,0 @@ -# SWGFormatTest - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**integer** | **NSNumber*** | | [optional] -**int32** | **NSNumber*** | | [optional] -**int64** | **NSNumber*** | | [optional] -**number** | **NSNumber*** | | -**_float** | **NSNumber*** | | [optional] -**_double** | **NSNumber*** | | [optional] -**string** | **NSString*** | | [optional] -**byte** | **NSData*** | | -**binary** | **NSData*** | | [optional] -**date** | **NSDate*** | | -**dateTime** | **NSDate*** | | [optional] -**uuid** | **NSString*** | | [optional] -**password** | **NSString*** | | - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/client/petstore/objc/docs/SWGMixedPropertiesAndAdditionalPropertiesClass.md b/samples/client/petstore/objc/docs/SWGMixedPropertiesAndAdditionalPropertiesClass.md deleted file mode 100644 index 707e45b9840..00000000000 --- a/samples/client/petstore/objc/docs/SWGMixedPropertiesAndAdditionalPropertiesClass.md +++ /dev/null @@ -1,12 +0,0 @@ -# SWGMixedPropertiesAndAdditionalPropertiesClass - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**uuid** | **NSString*** | | [optional] -**dateTime** | **NSDate*** | | [optional] -**map** | [**NSDictionary<NSString*, SWGAnimal>***](SWGAnimal.md) | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/client/petstore/objc/docs/SWGName.md b/samples/client/petstore/objc/docs/SWGName.md deleted file mode 100644 index 89dd0ff47e5..00000000000 --- a/samples/client/petstore/objc/docs/SWGName.md +++ /dev/null @@ -1,13 +0,0 @@ -# SWGName - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**name** | **NSNumber*** | | -**snakeCase** | **NSNumber*** | | [optional] -**_property** | **NSString*** | | [optional] -**_123Number** | **NSNumber*** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/client/petstore/objc/docs/SWGReadOnlyFirst.md b/samples/client/petstore/objc/docs/SWGReadOnlyFirst.md deleted file mode 100644 index d9260a1b83e..00000000000 --- a/samples/client/petstore/objc/docs/SWGReadOnlyFirst.md +++ /dev/null @@ -1,11 +0,0 @@ -# SWGReadOnlyFirst - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**bar** | **NSString*** | | [optional] -**baz** | **NSString*** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/client/petstore/objc/docs/SWGReturn.md b/samples/client/petstore/objc/docs/SWGReturn.md deleted file mode 100644 index 5fd23efdadc..00000000000 --- a/samples/client/petstore/objc/docs/SWGReturn.md +++ /dev/null @@ -1,10 +0,0 @@ -# SWGReturn - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**_return** | **NSNumber*** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/client/petstore/objc/docs/SWGSpecialModelName_.md b/samples/client/petstore/objc/docs/SWGSpecialModelName_.md deleted file mode 100644 index 4e62042d6f6..00000000000 --- a/samples/client/petstore/objc/docs/SWGSpecialModelName_.md +++ /dev/null @@ -1,10 +0,0 @@ -# SWGSpecialModelName_ - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**specialPropertyName** | **NSNumber*** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - From f33b0a2942b7cb2821903edeb6ab205a1678cdf3 Mon Sep 17 00:00:00 2001 From: Mateusz Mackowiak Date: Thu, 16 Jun 2016 13:12:42 +0200 Subject: [PATCH 05/16] [Objc] Moved default petstore demo sample to default folder and created a target with core data sample --- .../src/main/java/io/swagger/codegen/DefaultGenerator.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultGenerator.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultGenerator.java index 67a1a11f32f..6a489e45e52 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultGenerator.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultGenerator.java @@ -82,14 +82,12 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { } if(System.getProperty("modelDocs") != null) { generateModelDocumentation = Boolean.valueOf(System.getProperty("modelDocs")); - LOGGER.error("AAAAAAAAAAAAAAAA generateModelDocumentation "+generateModelDocumentation); } if(System.getProperty("apiTests") != null) { generateApiTests = Boolean.valueOf(System.getProperty("apiTests")); } if(System.getProperty("apiDocs") != null) { generateApiDocumentation = Boolean.valueOf(System.getProperty("apiDocs")); - LOGGER.error("AAAAAAAAAAAAAAAA generateApiDocumentation "+generateApiDocumentation); } if(generateApis == null && generateModels == null && generateSupportingFiles == null) { From 86c8647ace4a0559e281df14ce99665025697558 Mon Sep 17 00:00:00 2001 From: zhenjun115 Date: Sun, 19 Jun 2016 12:31:10 +0800 Subject: [PATCH 06/16] add async method test case for pet api; --- samples/client/petstore/python/.coverage | 1 - .../petstore/python/dev-requirements.txt.log | 16 ---------- .../petstore/python/tests/test_pet_api.py | 30 +++++++++++++++++++ 3 files changed, 30 insertions(+), 17 deletions(-) delete mode 100644 samples/client/petstore/python/.coverage delete mode 100644 samples/client/petstore/python/dev-requirements.txt.log diff --git a/samples/client/petstore/python/.coverage b/samples/client/petstore/python/.coverage deleted file mode 100644 index 6ec2ece7d7a..00000000000 --- a/samples/client/petstore/python/.coverage +++ /dev/null @@ -1 +0,0 @@ -!coverage.py: This is a private format, don't read it directly!{"lines": {"/Users/huangzhenjun/Public/git/PartTime/swagger-codegen/samples/client/petstore/python/swagger_client/apis/user_api.py": [385, 775, 23, 18, 20, 22, 151, 282, 28, 26, 32, 676, 37, 39, 29, 48, 179, 569, 703, 76, 463, 598, 804, 357, 491, 254], "/Users/huangzhenjun/Public/git/PartTime/swagger-codegen/samples/client/petstore/python/swagger_client/models/name.py": [96, 128, 134, 74, 140, 19, 52, 21, 22, 85, 25, 122, 29, 30, 63], "/Users/huangzhenjun/Public/git/PartTime/swagger-codegen/samples/client/petstore/python/swagger_client/models/category.py": [128, 134, 140, 19, 21, 22, 25, 29, 30, 39, 40, 41, 44, 45, 46, 49, 50, 52, 61, 63, 72, 74, 83, 85, 94, 96, 100, 102, 103, 104, 109, 111, 118, 120, 122], "/Users/huangzhenjun/Public/git/PartTime/swagger-codegen/samples/client/petstore/python/swagger_client/models/cat.py": [96, 128, 134, 74, 140, 19, 52, 21, 22, 85, 25, 122, 29, 30, 63], "/Users/huangzhenjun/Public/git/PartTime/swagger-codegen/samples/client/petstore/python/swagger_client/api_client.py": [409, 515, 517, 525, 19, 532, 21, 22, 23, 24, 26, 27, 28, 29, 30, 31, 32, 33, 34, 36, 37, 40, 553, 42, 555, 44, 45, 47, 49, 52, 565, 573, 575, 576, 577, 578, 579, 68, 69, 582, 74, 75, 76, 78, 79, 81, 82, 84, 86, 93, 98, 100, 104, 105, 106, 109, 110, 111, 113, 114, 117, 118, 119, 120, 121, 122, 125, 126, 533, 128, 131, 132, 133, 136, 139, 140, 143, 146, 147, 148, 149, 151, 154, 155, 157, 159, 160, 161, 162, 164, 167, 534, 176, 177, 179, 181, 544, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 209, 210, 217, 218, 219, 221, 222, 224, 236, 240, 241, 245, 247, 127, 554, 256, 257, 259, 260, 261, 262, 263, 265, 266, 267, 268, 272, 273, 274, 277, 279, 280, 281, 283, 284, 285, 286, 288, 291, 292, 293, 322, 323, 324, 325, 326, 328, 329, 330, 331, 332, 333, 334, 335, 336, 338, 339, 343, 344, 345, 346, 347, 351, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 375, 376, 377, 378, 385, 393, 395, 396, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 580, 411, 413, 420, 421, 423, 425, 426, 428, 430, 437, 438, 440, 442, 443, 445, 447, 455, 457, 460, 461, 462, 463, 465, 466, 474, 500, 509, 510], "/Users/huangzhenjun/Public/git/PartTime/swagger-codegen/samples/client/petstore/python/swagger_client/apis/pet_api.py": [18, 20, 22, 23, 26, 28, 29, 32, 37, 39, 40, 41, 42, 44, 45, 46, 48, 49, 69, 70, 73, 74, 76, 97, 98, 99, 101, 102, 103, 108, 109, 112, 113, 115, 117, 119, 120, 122, 123, 124, 127, 128, 129, 133, 134, 137, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 151, 179, 254, 255, 276, 277, 280, 281, 283, 305, 306, 307, 309, 310, 311, 316, 317, 320, 323, 324, 325, 326, 328, 330, 331, 332, 334, 335, 337, 340, 341, 342, 346, 347, 350, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 364, 365, 385, 386, 389, 390, 392, 413, 414, 415, 417, 418, 419, 424, 425, 428, 429, 431, 432, 433, 435, 437, 438, 440, 443, 444, 445, 449, 450, 453, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 467, 468, 488, 489, 492, 493, 495, 516, 517, 518, 520, 521, 522, 527, 528, 531, 532, 534, 535, 536, 538, 540, 541, 543, 546, 547, 548, 552, 553, 556, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 570, 571, 591, 592, 593, 595, 596, 598, 619, 620, 621, 623, 624, 625, 630, 631, 634, 637, 638, 639, 640, 642, 644, 646, 647, 649, 652, 653, 654, 658, 659, 662, 664, 665, 666, 667, 668, 669, 670, 671, 672, 673, 674, 676, 704, 782, 810, 888, 889, 909, 910, 913, 914, 916, 937, 938, 939, 941, 942, 943, 948, 949, 952, 953, 955, 957, 959, 960, 962, 963, 964, 967, 968, 969, 973, 974, 977, 979, 980, 981, 982, 983, 984, 985, 986, 987, 988, 989, 991, 992, 1014, 1015, 1018, 1019, 1021, 1044, 1045, 1046, 1048, 1049, 1050, 1055, 1056, 1059, 1062, 1063, 1064, 1065, 1067, 1069, 1071, 1072, 1073, 1074, 1075, 1076, 1078, 1081, 1082, 1083, 1087, 1088, 1091, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1105, 1106, 1128, 1129, 1132, 1133, 1135, 1158, 1159, 1160, 1162, 1163, 1164, 1169, 1170, 1173, 1176, 1177, 1178, 1179, 1181, 1183, 1185, 1186, 1187, 1188, 1189, 1190, 1192, 1195, 1196, 1197, 1201, 1202, 1205, 1207, 1208, 1209, 1210, 1211, 1212, 1213, 1214, 1215, 1216, 1217], "/Users/huangzhenjun/Public/git/PartTime/swagger-codegen/samples/client/petstore/python/swagger_client/models/model_return.py": [97, 115, 71, 103, 109, 49, 19, 21, 22, 25, 60, 29, 30], "/Users/huangzhenjun/Public/git/PartTime/swagger-codegen/samples/client/petstore/python/swagger_client/rest.py": [20, 21, 23, 24, 25, 26, 27, 28, 31, 33, 35, 36, 40, 42, 43, 45, 48, 51, 53, 54, 55, 56, 57, 59, 63, 65, 72, 74, 82, 83, 88, 92, 95, 98, 101, 102, 103, 104, 105, 106, 109, 110, 121, 122, 124, 129, 130, 132, 135, 137, 138, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 152, 153, 154, 155, 156, 159, 160, 161, 166, 170, 174, 176, 177, 179, 181, 182, 183, 184, 186, 191, 198, 199, 200, 201, 203, 204, 205, 206, 207, 208, 210, 211, 212, 213, 214, 215, 217, 225, 227, 228, 229, 230, 231, 232, 239, 243, 244, 245, 246, 248, 249, 251], "/Users/huangzhenjun/Public/git/PartTime/swagger-codegen/samples/client/petstore/python/swagger_client/models/order.py": [130, 172, 141, 173, 19, 21, 22, 152, 25, 29, 30, 161, 163, 39, 40, 41, 42, 43, 44, 45, 174, 175, 48, 49, 50, 51, 180, 53, 54, 52, 58, 59, 60, 61, 62, 191, 64, 202, 75, 86, 57, 176, 97, 228, 178, 234, 108, 240, 246, 119], "/Users/huangzhenjun/Public/git/PartTime/swagger-codegen/samples/client/petstore/python/swagger_client/apis/__init__.py": [1, 4, 5, 6], "/Users/huangzhenjun/Public/git/PartTime/swagger-codegen/samples/client/petstore/python/swagger_client/models/dog.py": [96, 128, 134, 74, 140, 19, 52, 21, 22, 85, 25, 122, 29, 30, 63], "/Users/huangzhenjun/Public/git/PartTime/swagger-codegen/samples/client/petstore/python/swagger_client/__init__.py": [1, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 19, 20, 21, 24, 26, 28], "/Users/huangzhenjun/Public/git/PartTime/swagger-codegen/samples/client/petstore/python/swagger_client/models/__init__.py": [1, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16], "/Users/huangzhenjun/Public/git/PartTime/swagger-codegen/samples/client/petstore/python/swagger_client/models/special_model_name.py": [97, 115, 71, 103, 109, 49, 19, 21, 22, 25, 60, 29, 30], "/Users/huangzhenjun/Public/git/PartTime/swagger-codegen/samples/client/petstore/python/swagger_client/apis/store_api.py": [257, 258, 282, 278, 305, 18, 20, 277, 22, 23, 281, 154, 284, 26, 32, 304, 37, 39, 40, 28, 327, 44, 46, 29, 48, 561, 306, 308, 309, 182, 315, 316, 319, 320, 322, 324, 310, 326, 455, 329, 76, 589, 334, 333, 338, 339, 342, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 483, 356, 41, 332, 383], "/Users/huangzhenjun/Public/git/PartTime/swagger-codegen/samples/client/petstore/python/swagger_client/models/inline_response_200.py": [130, 141, 19, 21, 22, 25, 29, 158, 169, 180, 30, 191, 64, 202, 75, 86, 97, 228, 234, 108, 240, 246, 119], "/Users/huangzhenjun/Public/git/PartTime/swagger-codegen/samples/client/petstore/python/swagger_client/models/animal.py": [97, 115, 71, 103, 109, 49, 19, 21, 22, 25, 60, 29, 30], "/Users/huangzhenjun/Public/git/PartTime/swagger-codegen/samples/client/petstore/python/swagger_client/configuration.py": [19, 21, 22, 23, 25, 26, 31, 32, 34, 36, 37, 39, 40, 41, 42, 43, 46, 47, 52, 54, 59, 61, 63, 67, 69, 71, 73, 76, 80, 81, 82, 84, 86, 88, 90, 92, 96, 98, 100, 102, 104, 111, 122, 123, 135, 136, 137, 138, 139, 142, 149, 157, 158, 167, 168, 170, 172, 179, 189, 190, 192, 199, 200, 201, 204, 210, 211, 213, 219, 221, 222, 223, 224, 225, 228, 229, 230, 231, 232, 235, 236, 237, 238, 239, 242, 243, 244, 245, 246, 249, 250, 251, 252, 253, 256, 257, 258, 259, 260, 265], "/Users/huangzhenjun/Public/git/PartTime/swagger-codegen/samples/client/petstore/python/swagger_client/models/pet.py": [128, 130, 150, 172, 139, 141, 19, 215, 21, 22, 152, 25, 29, 30, 161, 163, 39, 40, 41, 42, 43, 44, 45, 174, 48, 49, 50, 51, 52, 53, 54, 183, 185, 58, 59, 60, 61, 62, 64, 194, 195, 200, 73, 202, 75, 206, 208, 209, 210, 211, 84, 213, 86, 57, 216, 217, 95, 224, 97, 226, 228, 232, 234, 108, 240, 244, 117, 246, 119, 212, 106], "/Users/huangzhenjun/Public/git/PartTime/swagger-codegen/samples/client/petstore/python/swagger_client/models/tag.py": [128, 134, 138, 140, 19, 21, 22, 25, 29, 30, 39, 40, 41, 44, 45, 46, 49, 50, 52, 61, 63, 72, 74, 83, 85, 94, 96, 100, 102, 103, 104, 109, 111, 118, 120, 122], "/Users/huangzhenjun/Public/git/PartTime/swagger-codegen/samples/client/petstore/python/swagger_client/models/user.py": [278, 136, 272, 147, 21, 22, 25, 284, 29, 158, 290, 169, 180, 30, 191, 70, 202, 81, 213, 92, 224, 103, 235, 114, 19, 246, 125], "/Users/huangzhenjun/Public/git/PartTime/swagger-codegen/samples/client/petstore/python/swagger_client/models/model_200_response.py": [97, 115, 71, 103, 109, 49, 19, 21, 22, 25, 60, 29, 30]}} \ No newline at end of file diff --git a/samples/client/petstore/python/dev-requirements.txt.log b/samples/client/petstore/python/dev-requirements.txt.log deleted file mode 100644 index 23fed21daa7..00000000000 --- a/samples/client/petstore/python/dev-requirements.txt.log +++ /dev/null @@ -1,16 +0,0 @@ -Collecting nose (from -r dev-requirements.txt (line 1)) - Downloading nose-1.3.7-py2-none-any.whl (154kB) -Collecting tox (from -r dev-requirements.txt (line 2)) - Downloading tox-2.3.1-py2.py3-none-any.whl (40kB) -Collecting coverage (from -r dev-requirements.txt (line 3)) - Downloading coverage-4.1-cp27-cp27m-macosx_10_10_x86_64.whl (164kB) -Collecting randomize (from -r dev-requirements.txt (line 4)) - Downloading randomize-0.13-py2.py3-none-any.whl -Collecting virtualenv>=1.11.2 (from tox->-r dev-requirements.txt (line 2)) - Downloading virtualenv-15.0.2-py2.py3-none-any.whl (1.8MB) -Collecting py>=1.4.17 (from tox->-r dev-requirements.txt (line 2)) - Downloading py-1.4.31-py2.py3-none-any.whl (81kB) -Collecting pluggy<0.4.0,>=0.3.0 (from tox->-r dev-requirements.txt (line 2)) - Downloading pluggy-0.3.1-py2.py3-none-any.whl -Installing collected packages: nose, virtualenv, py, pluggy, tox, coverage, randomize -Successfully installed coverage-4.1 nose-1.3.7 pluggy-0.3.1 py-1.4.31 randomize-0.13 tox-2.3.1 virtualenv-15.0.2 diff --git a/samples/client/petstore/python/tests/test_pet_api.py b/samples/client/petstore/python/tests/test_pet_api.py index 14a9895ab97..805086fc680 100644 --- a/samples/client/petstore/python/tests/test_pet_api.py +++ b/samples/client/petstore/python/tests/test_pet_api.py @@ -97,6 +97,21 @@ class PetApiTests(unittest.TestCase): self.assertIsNotNone(fetched.category) self.assertEqual(self.pet.category.name, fetched.category.name) + def test_async_add_pet_and_get_pet_by_id(self): + self.pet_api.add_pet(body=self.pet) + + def callback_function(data): + #fetched = self.pet_api.get_pet_by_id(pet_id=self.pet.id) + self.assertIsNotNone(data) + self.assertEqual(self.pet.id, data.id) + self.assertIsNotNone(data.category) + self.assertEqual(self.pet.category.name, data.category.name) + + thread = self.pet_api.get_pet_by_id(pet_id=self.pet.id, callback=callback_function) + thread.join(10) + if thread.isAlive(): + self.fail("Request timeout") + def test_add_pet_and_get_pet_by_id_with_http_info(self): self.pet_api.add_pet(body=self.pet) @@ -106,6 +121,21 @@ class PetApiTests(unittest.TestCase): self.assertIsNotNone(fetched[0].category) self.assertEqual(self.pet.category.name, fetched[0].category.name) + def test_async_add_pet_and_get_pet_by_id_with_http_info(self): + self.pet_api.add_pet(body=self.pet) + + def callback_function(data): + #fetched = self.pet_api.get_pet_by_id_with_http_info(pet_id=self.pet.id) + self.assertIsNotNone(data) + self.assertEqual(self.pet.id, data.id) + self.assertIsNotNone(data.category) + self.assertEqual(self.pet.category.name, data.category.name) + + thread = self.pet_api.get_pet_by_id(pet_id=self.pet.id, callback=callback_function) + thread.join(10) + if thread.isAlive(): + self.fail("Request timeout") + def test_update_pet(self): self.pet.name = "hello kity with updated" self.pet_api.update_pet(body=self.pet) From 8180a46a35d2992e8ccb0f076c46c8368a1884a0 Mon Sep 17 00:00:00 2001 From: zhenjun115 Date: Sun, 19 Jun 2016 21:44:12 +0800 Subject: [PATCH 07/16] add test case for pet api method with http info returned; --- samples/client/petstore/python/tests/test_pet_api.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/samples/client/petstore/python/tests/test_pet_api.py b/samples/client/petstore/python/tests/test_pet_api.py index 805086fc680..822f35b5ae8 100644 --- a/samples/client/petstore/python/tests/test_pet_api.py +++ b/samples/client/petstore/python/tests/test_pet_api.py @@ -127,11 +127,11 @@ class PetApiTests(unittest.TestCase): def callback_function(data): #fetched = self.pet_api.get_pet_by_id_with_http_info(pet_id=self.pet.id) self.assertIsNotNone(data) - self.assertEqual(self.pet.id, data.id) - self.assertIsNotNone(data.category) - self.assertEqual(self.pet.category.name, data.category.name) + self.assertEqual(self.pet.id, data[0].id) + self.assertIsNotNone(data[0].category) + self.assertEqual(self.pet.category.name, data[0].category.name) - thread = self.pet_api.get_pet_by_id(pet_id=self.pet.id, callback=callback_function) + thread = self.pet_api.get_pet_by_id_with_http_info(pet_id=self.pet.id, callback=callback_function) thread.join(10) if thread.isAlive(): self.fail("Request timeout") From 50ef914db02d8e5adfc5c74a5d5b7d6a30812db5 Mon Sep 17 00:00:00 2001 From: wing328 Date: Mon, 20 Jun 2016 12:24:53 +0800 Subject: [PATCH 08/16] update test script for python --- samples/client/petstore/python/test_python2.sh | 6 +++--- samples/client/petstore/python/test_python2_and_3.sh | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/samples/client/petstore/python/test_python2.sh b/samples/client/petstore/python/test_python2.sh index c6889895950..680d2ce61e0 100755 --- a/samples/client/petstore/python/test_python2.sh +++ b/samples/client/petstore/python/test_python2.sh @@ -21,7 +21,7 @@ python setup.py develop nosetests ### deactivate virtualenv -if [ $DEACTIVE == true ]; then - deactivate -fi +#if [ $DEACTIVE == true ]; then +# deactivate +#fi diff --git a/samples/client/petstore/python/test_python2_and_3.sh b/samples/client/petstore/python/test_python2_and_3.sh index 03c16abd4ae..2e4b4630a33 100755 --- a/samples/client/petstore/python/test_python2_and_3.sh +++ b/samples/client/petstore/python/test_python2_and_3.sh @@ -21,6 +21,6 @@ python setup.py develop tox ### deactivate virtualenv -if [ $DEACTIVE == true ]; then - deactivate -fi +#if [ $DEACTIVE == true ]; then +# deactivate +#fi From 514255c8b7695fbf836033f93c90901daf7063e8 Mon Sep 17 00:00:00 2001 From: wing328 Date: Mon, 20 Jun 2016 14:16:22 +0800 Subject: [PATCH 09/16] clean up toc --- README.md | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/README.md b/README.md index fb1d8501287..6c1648f69f5 100644 --- a/README.md +++ b/README.md @@ -41,19 +41,6 @@ Check out [Swagger-Spec](https://github.com/OAI/OpenAPI-Specification) for addit - [Generating dynamic html api documentation](#generating-dynamic-html-api-documentation) - [Generating static html api documentation](#generating-static-html-api-documentation) - [To build a server stub](#to-build-a-server-stub) - - [Node.js](#nodejs) - - [PHP Slim](#php-slim) - - [PHP Silex](#php-silex) - - [Python Flask (Connexion)](#python-flask-connexion) - - [Ruby Sinatra](#ruby-sinatra) - - [Scala Scalatra](#scala-scalatra) - - [Java JAX-RS (Java JAX-RS (Jersey v1.18)](#java-jax-rs-jersey-v118) - - [Java JAX-RS (Apache CXF 2 / 3)](#java-jax-rs-apache-cxf-2--3) - - [Java JAX-RS (Resteasy)](#java-jax-rs-resteasy) - - [Java Spring MVC](#java-spring-mvc) - - [Java SpringBoot](#java-springboot) - - [Haskell Servant](#haskell-servant) - - [ASP.NET 5 Web API](#aspnet-5-web-api) - [To build the codegen library](#to-build-the-codegen-library) - [Workflow Integration](#workflow-integration) - [Github Integration](#github-integration) From 8283b701e8904adc1b255d55de16dd9dfb5c4c2a Mon Sep 17 00:00:00 2001 From: wing328 Date: Mon, 20 Jun 2016 14:51:17 +0800 Subject: [PATCH 10/16] fix java property with the name "class" --- .../codegen/languages/JavaClientCodegen.java | 4 +++ ...ith-fake-endpoints-models-for-testing.yaml | 2 ++ .../client/petstore/java/default/.gitignore | 6 +++++ .../java/default/.swagger-codegen-ignore | 2 +- .../java/default/docs/Model200Response.md | 1 + .../client/petstore/java/default/hello.txt | 1 - .../client/model/Model200Response.java | 24 +++++++++++++++-- samples/client/petstore/java/feign/.gitignore | 6 +++++ .../java/io/swagger/client/ApiClient.java | 6 ++--- .../java/io/swagger/client/StringUtil.java | 25 +++++++++++++++++ .../java/io/swagger/client/api/FakeApi.java | 2 +- .../java/io/swagger/client/api/PetApi.java | 2 +- .../io/swagger/client/auth/OAuthFlow.java | 27 ++++++++++++++++++- .../client/model/Model200Response.java | 24 +++++++++++++++-- .../client/petstore/java/jersey2/.gitignore | 6 +++++ .../java/jersey2/.swagger-codegen-ignore | 2 +- .../client/petstore/java/jersey2/build.gradle | 1 - .../java/jersey2/docs/Model200Response.md | 1 + samples/client/petstore/java/jersey2/pom.xml | 21 --------------- .../client/model/Model200Response.java | 24 +++++++++++++++-- .../petstore/java/okhttp-gson/.gitignore | 6 +++++ .../java/okhttp-gson/.swagger-codegen-ignore | 2 +- .../java/okhttp-gson/docs/Model200Response.md | 1 + .../java/io/swagger/client/ApiClient.java | 2 +- .../java/io/swagger/client/api/FakeApi.java | 2 +- .../java/io/swagger/client/api/PetApi.java | 2 +- .../client/model/Model200Response.java | 26 ++++++++++++++++-- .../client/petstore/java/retrofit/.gitignore | 6 +++++ .../java/retrofit/.swagger-codegen-ignore | 2 +- .../java/io/swagger/client/ApiClient.java | 6 ++--- .../java/io/swagger/client/api/FakeApi.java | 2 +- .../java/io/swagger/client/api/PetApi.java | 2 +- .../client/model/Model200Response.java | 19 +++++++++++-- .../client/petstore/java/retrofit2/.gitignore | 6 +++++ .../java/retrofit2/docs/Model200Response.md | 1 + .../java/io/swagger/client/ApiClient.java | 6 ++--- .../java/io/swagger/client/api/FakeApi.java | 2 +- .../java/io/swagger/client/api/PetApi.java | 2 +- .../client/model/Model200Response.java | 19 +++++++++++-- .../petstore/java/retrofit2rx/.gitignore | 6 +++++ .../java/retrofit2rx/docs/Model200Response.md | 1 + .../java/io/swagger/client/ApiClient.java | 6 ++--- .../java/io/swagger/client/api/FakeApi.java | 2 +- .../java/io/swagger/client/api/PetApi.java | 2 +- .../client/model/Model200Response.java | 19 +++++++++++-- 45 files changed, 272 insertions(+), 65 deletions(-) delete mode 100644 samples/client/petstore/java/default/hello.txt diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java index ad4750cf8ce..7efdb8c49eb 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java @@ -471,6 +471,10 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig { // sanitize name name = sanitizeName(name); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'. + if ("class".equals(name.toLowerCase())) { + return "PropertyClass"; + } + if("_".equals(name)) { name = "_u"; } diff --git a/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml b/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml index 109feba388e..615cb5a10fe 100644 --- a/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml +++ b/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml @@ -834,6 +834,8 @@ definitions: name: type: integer format: int32 + class: + type: string xml: name: Name Dog: diff --git a/samples/client/petstore/java/default/.gitignore b/samples/client/petstore/java/default/.gitignore index 7cf39af816c..a530464afa1 100644 --- a/samples/client/petstore/java/default/.gitignore +++ b/samples/client/petstore/java/default/.gitignore @@ -13,3 +13,9 @@ # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml hs_err_pid* + +# build files +**/target +target +.gradle +build diff --git a/samples/client/petstore/java/default/.swagger-codegen-ignore b/samples/client/petstore/java/default/.swagger-codegen-ignore index 19d3377182e..c5fa491b4c5 100644 --- a/samples/client/petstore/java/default/.swagger-codegen-ignore +++ b/samples/client/petstore/java/default/.swagger-codegen-ignore @@ -14,7 +14,7 @@ # You can recursively match patterns against a directory, file or extension with a double asterisk (**): #foo/**/qux -# Thsi matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux # You can also negate patterns with an exclamation (!). # For example, you can ignore all files in a docs folder with the file extension .md: diff --git a/samples/client/petstore/java/default/docs/Model200Response.md b/samples/client/petstore/java/default/docs/Model200Response.md index 0819b88c4f4..b47618b28cc 100644 --- a/samples/client/petstore/java/default/docs/Model200Response.md +++ b/samples/client/petstore/java/default/docs/Model200Response.md @@ -5,6 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **name** | **Integer** | | [optional] +**PropertyClass** | **String** | | [optional] diff --git a/samples/client/petstore/java/default/hello.txt b/samples/client/petstore/java/default/hello.txt deleted file mode 100644 index 6769dd60bdf..00000000000 --- a/samples/client/petstore/java/default/hello.txt +++ /dev/null @@ -1 +0,0 @@ -Hello world! \ No newline at end of file diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Model200Response.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Model200Response.java index b2809525c7f..eed3902b922 100644 --- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Model200Response.java +++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/model/Model200Response.java @@ -15,6 +15,7 @@ import io.swagger.annotations.ApiModelProperty; public class Model200Response { private Integer name = null; + private String PropertyClass = null; /** @@ -34,6 +35,23 @@ public class Model200Response { } + /** + **/ + public Model200Response PropertyClass(String PropertyClass) { + this.PropertyClass = PropertyClass; + return this; + } + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("class") + public String getPropertyClass() { + return PropertyClass; + } + public void setPropertyClass(String PropertyClass) { + this.PropertyClass = PropertyClass; + } + + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -43,12 +61,13 @@ public class Model200Response { return false; } Model200Response _200Response = (Model200Response) o; - return Objects.equals(this.name, _200Response.name); + return Objects.equals(this.name, _200Response.name) && + Objects.equals(this.PropertyClass, _200Response.PropertyClass); } @Override public int hashCode() { - return Objects.hash(name); + return Objects.hash(name, PropertyClass); } @Override @@ -57,6 +76,7 @@ public class Model200Response { sb.append("class Model200Response {\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" PropertyClass: ").append(toIndentedString(PropertyClass)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/samples/client/petstore/java/feign/.gitignore b/samples/client/petstore/java/feign/.gitignore index 7cf39af816c..a530464afa1 100644 --- a/samples/client/petstore/java/feign/.gitignore +++ b/samples/client/petstore/java/feign/.gitignore @@ -13,3 +13,9 @@ # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml hs_err_pid* + +# build files +**/target +target +.gradle +build diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/ApiClient.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/ApiClient.java index 75b3a96f2c7..e21bded5212 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/ApiClient.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/ApiClient.java @@ -41,10 +41,10 @@ public class ApiClient { this(); for(String authName : authNames) { RequestInterceptor auth; - if (authName == "petstore_auth") { - auth = new OAuth(OAuthFlow.implicit, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets"); - } else if (authName == "api_key") { + if (authName == "api_key") { auth = new ApiKeyAuth("header", "api_key"); + } else if (authName == "petstore_auth") { + auth = new OAuth(OAuthFlow.implicit, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets"); } else { throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names"); } diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/StringUtil.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/StringUtil.java index 1383dd0decb..03c6c81e434 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/StringUtil.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/StringUtil.java @@ -1,3 +1,28 @@ +/** + * 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 + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package io.swagger.client; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/FakeApi.java index dbabdc64995..8296c7e4d78 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/FakeApi.java @@ -3,8 +3,8 @@ package io.swagger.client.api; import io.swagger.client.ApiClient; import org.joda.time.LocalDate; -import java.math.BigDecimal; import org.joda.time.DateTime; +import java.math.BigDecimal; import java.util.ArrayList; import java.util.HashMap; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/PetApi.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/PetApi.java index e486495c5a9..4d4cc14f625 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/PetApi.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/PetApi.java @@ -3,8 +3,8 @@ package io.swagger.client.api; import io.swagger.client.ApiClient; import io.swagger.client.model.Pet; -import io.swagger.client.model.ModelApiResponse; import java.io.File; +import io.swagger.client.model.ModelApiResponse; import java.util.ArrayList; import java.util.HashMap; diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/auth/OAuthFlow.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/auth/OAuthFlow.java index 597ec99b48b..ec1f942b0f2 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/auth/OAuthFlow.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/auth/OAuthFlow.java @@ -1,5 +1,30 @@ +/** + * 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 + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package io.swagger.client.auth; public enum OAuthFlow { accessCode, implicit, password, application -} \ No newline at end of file +} diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Model200Response.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Model200Response.java index b2809525c7f..eed3902b922 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Model200Response.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Model200Response.java @@ -15,6 +15,7 @@ import io.swagger.annotations.ApiModelProperty; public class Model200Response { private Integer name = null; + private String PropertyClass = null; /** @@ -34,6 +35,23 @@ public class Model200Response { } + /** + **/ + public Model200Response PropertyClass(String PropertyClass) { + this.PropertyClass = PropertyClass; + return this; + } + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("class") + public String getPropertyClass() { + return PropertyClass; + } + public void setPropertyClass(String PropertyClass) { + this.PropertyClass = PropertyClass; + } + + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -43,12 +61,13 @@ public class Model200Response { return false; } Model200Response _200Response = (Model200Response) o; - return Objects.equals(this.name, _200Response.name); + return Objects.equals(this.name, _200Response.name) && + Objects.equals(this.PropertyClass, _200Response.PropertyClass); } @Override public int hashCode() { - return Objects.hash(name); + return Objects.hash(name, PropertyClass); } @Override @@ -57,6 +76,7 @@ public class Model200Response { sb.append("class Model200Response {\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" PropertyClass: ").append(toIndentedString(PropertyClass)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/samples/client/petstore/java/jersey2/.gitignore b/samples/client/petstore/java/jersey2/.gitignore index 7cf39af816c..a530464afa1 100644 --- a/samples/client/petstore/java/jersey2/.gitignore +++ b/samples/client/petstore/java/jersey2/.gitignore @@ -13,3 +13,9 @@ # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml hs_err_pid* + +# build files +**/target +target +.gradle +build diff --git a/samples/client/petstore/java/jersey2/.swagger-codegen-ignore b/samples/client/petstore/java/jersey2/.swagger-codegen-ignore index 19d3377182e..c5fa491b4c5 100644 --- a/samples/client/petstore/java/jersey2/.swagger-codegen-ignore +++ b/samples/client/petstore/java/jersey2/.swagger-codegen-ignore @@ -14,7 +14,7 @@ # You can recursively match patterns against a directory, file or extension with a double asterisk (**): #foo/**/qux -# Thsi matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux # You can also negate patterns with an exclamation (!). # For example, you can ignore all files in a docs folder with the file extension .md: diff --git a/samples/client/petstore/java/jersey2/build.gradle b/samples/client/petstore/java/jersey2/build.gradle index 6574f746d05..33280cd3e67 100644 --- a/samples/client/petstore/java/jersey2/build.gradle +++ b/samples/client/petstore/java/jersey2/build.gradle @@ -77,7 +77,6 @@ if(hasProperty('target') && target == 'android') { apply plugin: 'java' apply plugin: 'maven' - sourceCompatibility = JavaVersion.VERSION_1_7 targetCompatibility = JavaVersion.VERSION_1_7 diff --git a/samples/client/petstore/java/jersey2/docs/Model200Response.md b/samples/client/petstore/java/jersey2/docs/Model200Response.md index 0819b88c4f4..b47618b28cc 100644 --- a/samples/client/petstore/java/jersey2/docs/Model200Response.md +++ b/samples/client/petstore/java/jersey2/docs/Model200Response.md @@ -5,6 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **name** | **Integer** | | [optional] +**PropertyClass** | **String** | | [optional] diff --git a/samples/client/petstore/java/jersey2/pom.xml b/samples/client/petstore/java/jersey2/pom.xml index c07ae01939a..1d15ec27814 100644 --- a/samples/client/petstore/java/jersey2/pom.xml +++ b/samples/client/petstore/java/jersey2/pom.xml @@ -104,27 +104,6 @@ 1.7 - - - org.codehaus.mojo - exec-maven-plugin - 1.2.1 - - - gradle-test - integration-test - - exec - - - gradle - - check - - - - - diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Model200Response.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Model200Response.java index b2809525c7f..eed3902b922 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Model200Response.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/Model200Response.java @@ -15,6 +15,7 @@ import io.swagger.annotations.ApiModelProperty; public class Model200Response { private Integer name = null; + private String PropertyClass = null; /** @@ -34,6 +35,23 @@ public class Model200Response { } + /** + **/ + public Model200Response PropertyClass(String PropertyClass) { + this.PropertyClass = PropertyClass; + return this; + } + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("class") + public String getPropertyClass() { + return PropertyClass; + } + public void setPropertyClass(String PropertyClass) { + this.PropertyClass = PropertyClass; + } + + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -43,12 +61,13 @@ public class Model200Response { return false; } Model200Response _200Response = (Model200Response) o; - return Objects.equals(this.name, _200Response.name); + return Objects.equals(this.name, _200Response.name) && + Objects.equals(this.PropertyClass, _200Response.PropertyClass); } @Override public int hashCode() { - return Objects.hash(name); + return Objects.hash(name, PropertyClass); } @Override @@ -57,6 +76,7 @@ public class Model200Response { sb.append("class Model200Response {\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" PropertyClass: ").append(toIndentedString(PropertyClass)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/samples/client/petstore/java/okhttp-gson/.gitignore b/samples/client/petstore/java/okhttp-gson/.gitignore index 7cf39af816c..a530464afa1 100644 --- a/samples/client/petstore/java/okhttp-gson/.gitignore +++ b/samples/client/petstore/java/okhttp-gson/.gitignore @@ -13,3 +13,9 @@ # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml hs_err_pid* + +# build files +**/target +target +.gradle +build diff --git a/samples/client/petstore/java/okhttp-gson/.swagger-codegen-ignore b/samples/client/petstore/java/okhttp-gson/.swagger-codegen-ignore index 19d3377182e..c5fa491b4c5 100644 --- a/samples/client/petstore/java/okhttp-gson/.swagger-codegen-ignore +++ b/samples/client/petstore/java/okhttp-gson/.swagger-codegen-ignore @@ -14,7 +14,7 @@ # You can recursively match patterns against a directory, file or extension with a double asterisk (**): #foo/**/qux -# Thsi matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux # You can also negate patterns with an exclamation (!). # For example, you can ignore all files in a docs folder with the file extension .md: diff --git a/samples/client/petstore/java/okhttp-gson/docs/Model200Response.md b/samples/client/petstore/java/okhttp-gson/docs/Model200Response.md index 0819b88c4f4..b47618b28cc 100644 --- a/samples/client/petstore/java/okhttp-gson/docs/Model200Response.md +++ b/samples/client/petstore/java/okhttp-gson/docs/Model200Response.md @@ -5,6 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **name** | **Integer** | | [optional] +**PropertyClass** | **String** | | [optional] diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiClient.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiClient.java index 374a185a599..34af59510c2 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiClient.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/ApiClient.java @@ -173,8 +173,8 @@ public class ApiClient { // Setup authentications (key: authentication name, value: authentication). authentications = new HashMap(); - authentications.put("petstore_auth", new OAuth()); authentications.put("api_key", new ApiKeyAuth("header", "api_key")); + authentications.put("petstore_auth", new OAuth()); // Prevent the authentications from being modified. authentications = Collections.unmodifiableMap(authentications); } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/FakeApi.java index e502060d682..c8fdd0942c3 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/FakeApi.java @@ -39,8 +39,8 @@ import com.google.gson.reflect.TypeToken; import java.io.IOException; import org.joda.time.LocalDate; -import java.math.BigDecimal; import org.joda.time.DateTime; +import java.math.BigDecimal; import java.lang.reflect.Type; import java.util.ArrayList; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/PetApi.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/PetApi.java index d453504215c..765754a3b09 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/PetApi.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/PetApi.java @@ -39,8 +39,8 @@ import com.google.gson.reflect.TypeToken; import java.io.IOException; import io.swagger.client.model.Pet; -import io.swagger.client.model.ModelApiResponse; import java.io.File; +import io.swagger.client.model.ModelApiResponse; import java.lang.reflect.Type; import java.util.ArrayList; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Model200Response.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Model200Response.java index 8c7227f3f4e..cb0a88f0861 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Model200Response.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/Model200Response.java @@ -39,6 +39,8 @@ import com.google.gson.annotations.SerializedName; public class Model200Response { @SerializedName("name") private Integer name = null; + @SerializedName("class") + private String PropertyClass = null; /** * Get name @@ -58,6 +60,24 @@ public class Model200Response { this.name = name; } + /** + * Get PropertyClass + * @return PropertyClass + **/ + @ApiModelProperty(value = "") + public String getPropertyClass() { + return PropertyClass; + } + + /** + * Set PropertyClass + * + * @param PropertyClass PropertyClass + */ + public void setPropertyClass(String PropertyClass) { + this.PropertyClass = PropertyClass; + } + @Override public boolean equals(Object o) { @@ -68,12 +88,13 @@ public class Model200Response { return false; } Model200Response _200Response = (Model200Response) o; - return Objects.equals(this.name, _200Response.name); + return Objects.equals(this.name, _200Response.name) && + Objects.equals(this.PropertyClass, _200Response.PropertyClass); } @Override public int hashCode() { - return Objects.hash(name); + return Objects.hash(name, PropertyClass); } @Override @@ -82,6 +103,7 @@ public class Model200Response { sb.append("class Model200Response {\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" PropertyClass: ").append(toIndentedString(PropertyClass)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/samples/client/petstore/java/retrofit/.gitignore b/samples/client/petstore/java/retrofit/.gitignore index 7cf39af816c..a530464afa1 100644 --- a/samples/client/petstore/java/retrofit/.gitignore +++ b/samples/client/petstore/java/retrofit/.gitignore @@ -13,3 +13,9 @@ # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml hs_err_pid* + +# build files +**/target +target +.gradle +build diff --git a/samples/client/petstore/java/retrofit/.swagger-codegen-ignore b/samples/client/petstore/java/retrofit/.swagger-codegen-ignore index 19d3377182e..c5fa491b4c5 100644 --- a/samples/client/petstore/java/retrofit/.swagger-codegen-ignore +++ b/samples/client/petstore/java/retrofit/.swagger-codegen-ignore @@ -14,7 +14,7 @@ # You can recursively match patterns against a directory, file or extension with a double asterisk (**): #foo/**/qux -# Thsi matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux # You can also negate patterns with an exclamation (!). # For example, you can ignore all files in a docs folder with the file extension .md: diff --git a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/ApiClient.java b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/ApiClient.java index fe5ad9b37fe..0453c60ae01 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/ApiClient.java +++ b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/ApiClient.java @@ -54,10 +54,10 @@ public class ApiClient { this(); for(String authName : authNames) { Interceptor auth; - if (authName == "petstore_auth") { - auth = new OAuth(OAuthFlow.implicit, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets"); - } else if (authName == "api_key") { + if (authName == "api_key") { auth = new ApiKeyAuth("header", "api_key"); + } else if (authName == "petstore_auth") { + auth = new OAuth(OAuthFlow.implicit, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets"); } else { throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names"); } diff --git a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/FakeApi.java index 02b97c10bf8..99df18ed71f 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/FakeApi.java @@ -7,8 +7,8 @@ import retrofit.http.*; import retrofit.mime.*; import org.joda.time.LocalDate; -import java.math.BigDecimal; import org.joda.time.DateTime; +import java.math.BigDecimal; import java.util.ArrayList; import java.util.HashMap; diff --git a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/PetApi.java b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/PetApi.java index a019a4bf886..66ed6aea981 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/PetApi.java +++ b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/PetApi.java @@ -7,8 +7,8 @@ import retrofit.http.*; import retrofit.mime.*; import io.swagger.client.model.Pet; -import io.swagger.client.model.ModelApiResponse; import java.io.File; +import io.swagger.client.model.ModelApiResponse; import java.util.ArrayList; import java.util.HashMap; diff --git a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/Model200Response.java b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/Model200Response.java index 3cbb15006fb..22d2bbd763d 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/Model200Response.java +++ b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/Model200Response.java @@ -18,6 +18,9 @@ public class Model200Response { @SerializedName("name") private Integer name = null; + @SerializedName("class") + private String PropertyClass = null; + /** **/ @ApiModelProperty(value = "") @@ -28,6 +31,16 @@ public class Model200Response { this.name = name; } + /** + **/ + @ApiModelProperty(value = "") + public String getPropertyClass() { + return PropertyClass; + } + public void setPropertyClass(String PropertyClass) { + this.PropertyClass = PropertyClass; + } + @Override public boolean equals(Object o) { @@ -38,12 +51,13 @@ public class Model200Response { return false; } Model200Response _200Response = (Model200Response) o; - return Objects.equals(name, _200Response.name); + return Objects.equals(name, _200Response.name) && + Objects.equals(PropertyClass, _200Response.PropertyClass); } @Override public int hashCode() { - return Objects.hash(name); + return Objects.hash(name, PropertyClass); } @Override @@ -52,6 +66,7 @@ public class Model200Response { sb.append("class Model200Response {\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" PropertyClass: ").append(toIndentedString(PropertyClass)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/samples/client/petstore/java/retrofit2/.gitignore b/samples/client/petstore/java/retrofit2/.gitignore index 7cf39af816c..a530464afa1 100644 --- a/samples/client/petstore/java/retrofit2/.gitignore +++ b/samples/client/petstore/java/retrofit2/.gitignore @@ -13,3 +13,9 @@ # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml hs_err_pid* + +# build files +**/target +target +.gradle +build diff --git a/samples/client/petstore/java/retrofit2/docs/Model200Response.md b/samples/client/petstore/java/retrofit2/docs/Model200Response.md index 0819b88c4f4..b47618b28cc 100644 --- a/samples/client/petstore/java/retrofit2/docs/Model200Response.md +++ b/samples/client/petstore/java/retrofit2/docs/Model200Response.md @@ -5,6 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **name** | **Integer** | | [optional] +**PropertyClass** | **String** | | [optional] diff --git a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/ApiClient.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/ApiClient.java index 305b8b783e4..97a6048f95f 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/ApiClient.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/ApiClient.java @@ -54,10 +54,10 @@ public class ApiClient { this(); for(String authName : authNames) { Interceptor auth; - if (authName == "petstore_auth") { - auth = new OAuth(OAuthFlow.implicit, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets"); - } else if (authName == "api_key") { + if (authName == "api_key") { auth = new ApiKeyAuth("header", "api_key"); + } else if (authName == "petstore_auth") { + auth = new OAuth(OAuthFlow.implicit, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets"); } else { throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names"); } diff --git a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/FakeApi.java index 91bd85c1b33..2a9b639511c 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/FakeApi.java @@ -9,8 +9,8 @@ import retrofit2.http.*; import okhttp3.RequestBody; import org.joda.time.LocalDate; -import java.math.BigDecimal; import org.joda.time.DateTime; +import java.math.BigDecimal; import java.util.ArrayList; import java.util.HashMap; diff --git a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/PetApi.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/PetApi.java index ec9d67a7449..dd39a864f06 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/PetApi.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/PetApi.java @@ -9,8 +9,8 @@ import retrofit2.http.*; import okhttp3.RequestBody; import io.swagger.client.model.Pet; -import io.swagger.client.model.ModelApiResponse; import java.io.File; +import io.swagger.client.model.ModelApiResponse; import java.util.ArrayList; import java.util.HashMap; diff --git a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/Model200Response.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/Model200Response.java index 3cbb15006fb..22d2bbd763d 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/Model200Response.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/Model200Response.java @@ -18,6 +18,9 @@ public class Model200Response { @SerializedName("name") private Integer name = null; + @SerializedName("class") + private String PropertyClass = null; + /** **/ @ApiModelProperty(value = "") @@ -28,6 +31,16 @@ public class Model200Response { this.name = name; } + /** + **/ + @ApiModelProperty(value = "") + public String getPropertyClass() { + return PropertyClass; + } + public void setPropertyClass(String PropertyClass) { + this.PropertyClass = PropertyClass; + } + @Override public boolean equals(Object o) { @@ -38,12 +51,13 @@ public class Model200Response { return false; } Model200Response _200Response = (Model200Response) o; - return Objects.equals(name, _200Response.name); + return Objects.equals(name, _200Response.name) && + Objects.equals(PropertyClass, _200Response.PropertyClass); } @Override public int hashCode() { - return Objects.hash(name); + return Objects.hash(name, PropertyClass); } @Override @@ -52,6 +66,7 @@ public class Model200Response { sb.append("class Model200Response {\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" PropertyClass: ").append(toIndentedString(PropertyClass)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/samples/client/petstore/java/retrofit2rx/.gitignore b/samples/client/petstore/java/retrofit2rx/.gitignore index 7cf39af816c..a530464afa1 100644 --- a/samples/client/petstore/java/retrofit2rx/.gitignore +++ b/samples/client/petstore/java/retrofit2rx/.gitignore @@ -13,3 +13,9 @@ # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml hs_err_pid* + +# build files +**/target +target +.gradle +build diff --git a/samples/client/petstore/java/retrofit2rx/docs/Model200Response.md b/samples/client/petstore/java/retrofit2rx/docs/Model200Response.md index 0819b88c4f4..b47618b28cc 100644 --- a/samples/client/petstore/java/retrofit2rx/docs/Model200Response.md +++ b/samples/client/petstore/java/retrofit2rx/docs/Model200Response.md @@ -5,6 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **name** | **Integer** | | [optional] +**PropertyClass** | **String** | | [optional] diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/ApiClient.java b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/ApiClient.java index 9e424881cbd..0315ae62751 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/ApiClient.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/ApiClient.java @@ -54,10 +54,10 @@ public class ApiClient { this(); for(String authName : authNames) { Interceptor auth; - if (authName == "petstore_auth") { - auth = new OAuth(OAuthFlow.implicit, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets"); - } else if (authName == "api_key") { + if (authName == "api_key") { auth = new ApiKeyAuth("header", "api_key"); + } else if (authName == "petstore_auth") { + auth = new OAuth(OAuthFlow.implicit, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets"); } else { throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names"); } diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/api/FakeApi.java index 5e0511922fb..0276255f68b 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/api/FakeApi.java @@ -9,8 +9,8 @@ import retrofit2.http.*; import okhttp3.RequestBody; import org.joda.time.LocalDate; -import java.math.BigDecimal; import org.joda.time.DateTime; +import java.math.BigDecimal; import java.util.ArrayList; import java.util.HashMap; diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/api/PetApi.java b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/api/PetApi.java index 4a2e64b726e..304ea7a29a8 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/api/PetApi.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/api/PetApi.java @@ -9,8 +9,8 @@ import retrofit2.http.*; import okhttp3.RequestBody; import io.swagger.client.model.Pet; -import io.swagger.client.model.ModelApiResponse; import java.io.File; +import io.swagger.client.model.ModelApiResponse; import java.util.ArrayList; import java.util.HashMap; diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/Model200Response.java b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/Model200Response.java index 3cbb15006fb..22d2bbd763d 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/Model200Response.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/Model200Response.java @@ -18,6 +18,9 @@ public class Model200Response { @SerializedName("name") private Integer name = null; + @SerializedName("class") + private String PropertyClass = null; + /** **/ @ApiModelProperty(value = "") @@ -28,6 +31,16 @@ public class Model200Response { this.name = name; } + /** + **/ + @ApiModelProperty(value = "") + public String getPropertyClass() { + return PropertyClass; + } + public void setPropertyClass(String PropertyClass) { + this.PropertyClass = PropertyClass; + } + @Override public boolean equals(Object o) { @@ -38,12 +51,13 @@ public class Model200Response { return false; } Model200Response _200Response = (Model200Response) o; - return Objects.equals(name, _200Response.name); + return Objects.equals(name, _200Response.name) && + Objects.equals(PropertyClass, _200Response.PropertyClass); } @Override public int hashCode() { - return Objects.hash(name); + return Objects.hash(name, PropertyClass); } @Override @@ -52,6 +66,7 @@ public class Model200Response { sb.append("class Model200Response {\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" PropertyClass: ").append(toIndentedString(PropertyClass)).append("\n"); sb.append("}"); return sb.toString(); } From 7aac639aad48fa0cce773486ed9bf651eb3bbdc6 Mon Sep 17 00:00:00 2001 From: cbornet Date: Wed, 15 Jun 2016 18:59:10 +0200 Subject: [PATCH 11/16] refactor java codegen classes --- .../languages/AbstractJavaCodegen.java | 854 ++++++++++++++++ .../AbstractJavaJAXRSServerCodegen.java | 50 +- .../languages/GroovyClientCodegen.java | 29 +- .../languages/JavaCXFServerCodegen.java | 51 +- .../codegen/languages/JavaClientCodegen.java | 929 +----------------- .../languages/JavaInflectorServerCodegen.java | 38 +- .../languages/JavaJerseyServerCodegen.java | 36 +- .../languages/JavaResteasyServerCodegen.java | 150 +-- .../languages/SpringBootServerCodegen.java | 18 +- .../resources/JavaSpringBoot/api.mustache | 2 +- .../JavaSpringBoot/apiController.mustache | 2 +- 11 files changed, 955 insertions(+), 1204 deletions(-) create mode 100644 modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractJavaCodegen.java diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractJavaCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractJavaCodegen.java new file mode 100644 index 00000000000..3157a258ac7 --- /dev/null +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractJavaCodegen.java @@ -0,0 +1,854 @@ +package io.swagger.codegen.languages; + +import com.google.common.base.Strings; +import io.swagger.codegen.*; +import io.swagger.models.Model; +import io.swagger.models.Operation; +import io.swagger.models.Path; +import io.swagger.models.Swagger; +import io.swagger.models.parameters.FormParameter; +import io.swagger.models.parameters.Parameter; +import io.swagger.models.properties.*; +import org.apache.commons.lang3.BooleanUtils; +import org.apache.commons.lang3.StringUtils; + +import java.io.File; +import java.util.*; +import java.util.regex.Pattern; + + +public abstract class AbstractJavaCodegen extends DefaultCodegen implements CodegenConfig { + + public static final String FULL_JAVA_UTIL = "fullJavaUtil"; + public static final String DEFAULT_LIBRARY = ""; + public static final String DATE_LIBRARY = "dateLibrary"; + + protected String dateLibrary = "joda"; + protected String invokerPackage = "io.swagger"; + protected String groupId = "io.swagger"; + protected String artifactId = "swagger-java"; + protected String artifactVersion = "1.0.0"; + protected String projectFolder = "src" + File.separator + "main"; + protected String projectTestFolder = "src" + File.separator + "test"; + protected String sourceFolder = projectFolder + File.separator + "java"; + protected String testFolder = projectTestFolder + File.separator + "java"; + protected String localVariablePrefix = ""; + protected boolean fullJavaUtil; + protected String javaUtilPrefix = ""; + protected Boolean serializableModel = false; + protected boolean serializeBigDecimalAsString = false; + protected boolean hideGenerationTimestamp = false; + protected String apiDocPath = "docs/"; + protected String modelDocPath = "docs/"; + + public AbstractJavaCodegen() { + super(); + modelTemplateFiles.put("model.mustache", ".java"); + apiTemplateFiles.put("api.mustache", ".java"); + apiTestTemplateFiles.put("api_test.mustache", ".java"); + modelDocTemplateFiles.put("model_doc.mustache", ".md"); + apiDocTemplateFiles.put("api_doc.mustache", ".md"); + + setReservedWordsLowerCase( + Arrays.asList( + // used as internal variables, can collide with parameter names + "localVarPath", "localVarQueryParams", "localVarHeaderParams", "localVarFormParams", + "localVarPostBody", "localVarAccepts", "localVarAccept", "localVarContentTypes", + "localVarContentType", "localVarAuthNames", "localReturnType", + "ApiClient", "ApiException", "ApiResponse", "Configuration", "StringUtil", + + // language reserved words + "abstract", "continue", "for", "new", "switch", "assert", + "default", "if", "package", "synchronized", "boolean", "do", "goto", "private", + "this", "break", "double", "implements", "protected", "throw", "byte", "else", + "import", "public", "throws", "case", "enum", "instanceof", "return", "transient", + "catch", "extends", "int", "short", "try", "char", "final", "interface", "static", + "void", "class", "finally", "long", "strictfp", "volatile", "const", "float", + "native", "super", "while") + ); + + languageSpecificPrimitives = new HashSet( + Arrays.asList( + "String", + "boolean", + "Boolean", + "Double", + "Integer", + "Long", + "Float", + "Object", + "byte[]") + ); + instantiationTypes.put("array", "ArrayList"); + instantiationTypes.put("map", "HashMap"); + typeMapping.put("date", "Date"); + typeMapping.put("file", "File"); + typeMapping.put("UUID", "String"); + + cliOptions.add(new CliOption(CodegenConstants.MODEL_PACKAGE, CodegenConstants.MODEL_PACKAGE_DESC)); + cliOptions.add(new CliOption(CodegenConstants.API_PACKAGE, CodegenConstants.API_PACKAGE_DESC)); + cliOptions.add(new CliOption(CodegenConstants.INVOKER_PACKAGE, CodegenConstants.INVOKER_PACKAGE_DESC)); + cliOptions.add(new CliOption(CodegenConstants.GROUP_ID, CodegenConstants.GROUP_ID_DESC)); + cliOptions.add(new CliOption(CodegenConstants.ARTIFACT_ID, CodegenConstants.ARTIFACT_ID_DESC)); + cliOptions.add(new CliOption(CodegenConstants.ARTIFACT_VERSION, CodegenConstants.ARTIFACT_VERSION_DESC)); + cliOptions.add(new CliOption(CodegenConstants.SOURCE_FOLDER, CodegenConstants.SOURCE_FOLDER_DESC)); + cliOptions.add(new CliOption(CodegenConstants.LOCAL_VARIABLE_PREFIX, CodegenConstants.LOCAL_VARIABLE_PREFIX_DESC)); + cliOptions.add(CliOption.newBoolean(CodegenConstants.SERIALIZABLE_MODEL, CodegenConstants.SERIALIZABLE_MODEL_DESC)); + cliOptions.add(CliOption.newBoolean(CodegenConstants.SERIALIZE_BIG_DECIMAL_AS_STRING, CodegenConstants + .SERIALIZE_BIG_DECIMAL_AS_STRING_DESC)); + cliOptions.add(CliOption.newBoolean(FULL_JAVA_UTIL, "whether to use fully qualified name for classes under java.util")); + cliOptions.add(new CliOption("hideGenerationTimestamp", "hides the timestamp when files were generated")); + + CliOption dateLibrary = new CliOption(DATE_LIBRARY, "Option. Date library to use"); + Map dateOptions = new HashMap(); + dateOptions.put("java8", "Java 8 native"); + dateOptions.put("java8-localdatetime", "Java 8 using LocalDateTime (for legacy app only)"); + dateOptions.put("joda", "Joda"); + dateOptions.put("legacy", "Legacy java.util.Date"); + dateLibrary.setEnum(dateOptions); + + cliOptions.add(dateLibrary); + + } + + @Override + public void processOpts() { + super.processOpts(); + + if (additionalProperties.containsKey(CodegenConstants.INVOKER_PACKAGE)) { + this.setInvokerPackage((String) additionalProperties.get(CodegenConstants.INVOKER_PACKAGE)); + } else { + //not set, use default to be passed to template + additionalProperties.put(CodegenConstants.INVOKER_PACKAGE, invokerPackage); + } + + if (additionalProperties.containsKey(CodegenConstants.GROUP_ID)) { + this.setGroupId((String) additionalProperties.get(CodegenConstants.GROUP_ID)); + } else { + //not set, use to be passed to template + additionalProperties.put(CodegenConstants.GROUP_ID, groupId); + } + + if (additionalProperties.containsKey(CodegenConstants.ARTIFACT_ID)) { + this.setArtifactId((String) additionalProperties.get(CodegenConstants.ARTIFACT_ID)); + } else { + //not set, use to be passed to template + additionalProperties.put(CodegenConstants.ARTIFACT_ID, artifactId); + } + + if (additionalProperties.containsKey(CodegenConstants.ARTIFACT_VERSION)) { + this.setArtifactVersion((String) additionalProperties.get(CodegenConstants.ARTIFACT_VERSION)); + } else { + //not set, use to be passed to template + additionalProperties.put(CodegenConstants.ARTIFACT_VERSION, artifactVersion); + } + + if (additionalProperties.containsKey(CodegenConstants.SOURCE_FOLDER)) { + this.setSourceFolder((String) additionalProperties.get(CodegenConstants.SOURCE_FOLDER)); + } + + if (additionalProperties.containsKey(CodegenConstants.LOCAL_VARIABLE_PREFIX)) { + this.setLocalVariablePrefix((String) additionalProperties.get(CodegenConstants.LOCAL_VARIABLE_PREFIX)); + } + + if (additionalProperties.containsKey(CodegenConstants.SERIALIZABLE_MODEL)) { + this.setSerializableModel(Boolean.valueOf(additionalProperties.get(CodegenConstants.SERIALIZABLE_MODEL).toString())); + } + + if (additionalProperties.containsKey(CodegenConstants.LIBRARY)) { + this.setLibrary((String) additionalProperties.get(CodegenConstants.LIBRARY)); + } + + if(additionalProperties.containsKey(CodegenConstants.SERIALIZE_BIG_DECIMAL_AS_STRING)) { + this.setSerializeBigDecimalAsString(Boolean.valueOf(additionalProperties.get(CodegenConstants.SERIALIZE_BIG_DECIMAL_AS_STRING).toString())); + } + + // need to put back serializableModel (boolean) into additionalProperties as value in additionalProperties is string + additionalProperties.put(CodegenConstants.SERIALIZABLE_MODEL, serializableModel); + + if (additionalProperties.containsKey(FULL_JAVA_UTIL)) { + this.setFullJavaUtil(Boolean.valueOf(additionalProperties.get(FULL_JAVA_UTIL).toString())); + } + + if (fullJavaUtil) { + javaUtilPrefix = "java.util."; + } + additionalProperties.put(FULL_JAVA_UTIL, fullJavaUtil); + additionalProperties.put("javaUtilPrefix", javaUtilPrefix); + + // make api and model doc path available in mustache template + additionalProperties.put("apiDocPath", apiDocPath); + additionalProperties.put("modelDocPath", modelDocPath); + + importMapping.put("List", "java.util.List"); + + if (fullJavaUtil) { + typeMapping.put("array", "java.util.List"); + typeMapping.put("map", "java.util.Map"); + typeMapping.put("DateTime", "java.util.Date"); + typeMapping.remove("List"); + importMapping.remove("Date"); + importMapping.remove("Map"); + importMapping.remove("HashMap"); + importMapping.remove("Array"); + importMapping.remove("ArrayList"); + importMapping.remove("List"); + importMapping.remove("Set"); + importMapping.remove("DateTime"); + instantiationTypes.put("array", "java.util.ArrayList"); + instantiationTypes.put("map", "java.util.HashMap"); + } + + this.sanitizeConfig(); + + // optional jackson mappings for BigDecimal support + importMapping.put("ToStringSerializer", "com.fasterxml.jackson.databind.ser.std.ToStringSerializer"); + importMapping.put("JsonSerialize", "com.fasterxml.jackson.databind.annotation.JsonSerialize"); + + // imports for pojos + importMapping.put("ApiModelProperty", "io.swagger.annotations.ApiModelProperty"); + importMapping.put("ApiModel", "io.swagger.annotations.ApiModel"); + importMapping.put("JsonProperty", "com.fasterxml.jackson.annotation.JsonProperty"); + importMapping.put("JsonValue", "com.fasterxml.jackson.annotation.JsonValue"); + importMapping.put("Objects", "java.util.Objects"); + importMapping.put("StringUtil", invokerPackage + ".StringUtil"); + + if(additionalProperties.containsKey(DATE_LIBRARY)) { + setDateLibrary(additionalProperties.get("dateLibrary").toString()); + additionalProperties.put(dateLibrary, "true"); + } + + if("joda".equals(dateLibrary)) { + typeMapping.put("date", "LocalDate"); + typeMapping.put("DateTime", "DateTime"); + + importMapping.put("LocalDate", "org.joda.time.LocalDate"); + importMapping.put("DateTime", "org.joda.time.DateTime"); + } + else if (dateLibrary.startsWith("java8")) { + additionalProperties.put("java8", "true"); + typeMapping.put("date", "LocalDate"); + importMapping.put("LocalDate", "java.time.LocalDate"); + if ("java8-localdatetime".equals(dateLibrary)) { + typeMapping.put("DateTime", "LocalDateTime"); + importMapping.put("LocalDateTime", "java.time.LocalDateTime"); + } else { + typeMapping.put("DateTime", "OffsetDateTime"); + importMapping.put("OffsetDateTime", "java.time.OffsetDateTime"); + } + } + } + + private void sanitizeConfig() { + // Sanitize any config options here. We also have to update the additionalProperties because + // the whole additionalProperties object is injected into the main object passed to the mustache layer + + this.setApiPackage(sanitizePackageName(apiPackage)); + if (additionalProperties.containsKey(CodegenConstants.API_PACKAGE)) { + this.additionalProperties.put(CodegenConstants.API_PACKAGE, apiPackage); + } + + this.setModelPackage(sanitizePackageName(modelPackage)); + if (additionalProperties.containsKey(CodegenConstants.MODEL_PACKAGE)) { + this.additionalProperties.put(CodegenConstants.MODEL_PACKAGE, modelPackage); + } + + this.setInvokerPackage(sanitizePackageName(invokerPackage)); + if (additionalProperties.containsKey(CodegenConstants.INVOKER_PACKAGE)) { + this.additionalProperties.put(CodegenConstants.INVOKER_PACKAGE, invokerPackage); + } + } + + @Override + public String escapeReservedWord(String name) { + return "_" + name; + } + + @Override + public String apiFileFolder() { + return outputFolder + "/" + sourceFolder + "/" + apiPackage().replace('.', '/'); + } + + @Override + public String apiTestFileFolder() { + return outputFolder + "/" + testFolder + "/" + apiPackage().replace('.', '/'); + } + + @Override + public String modelFileFolder() { + return outputFolder + "/" + sourceFolder + "/" + modelPackage().replace('.', '/'); + } + + @Override + public String apiDocFileFolder() { + return (outputFolder + "/" + apiDocPath).replace('/', File.separatorChar); + } + + @Override + public String modelDocFileFolder() { + return (outputFolder + "/" + modelDocPath).replace('/', File.separatorChar); + } + + @Override + public String toApiDocFilename(String name) { + return toApiName(name); + } + + @Override + public String toModelDocFilename(String name) { + return toModelName(name); + } + + @Override + public String toApiTestFilename(String name) { + return toApiName(name) + "Test"; + } + + @Override + public String toVarName(String name) { + // sanitize name + name = sanitizeName(name); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'. + + if ("class".equals(name.toLowerCase())) { + return "PropertyClass"; + } + + if("_".equals(name)) { + name = "_u"; + } + + // if it's all uppper case, do nothing + if (name.matches("^[A-Z_]*$")) { + return name; + } + + // camelize (lower first character) the variable name + // pet_id => petId + name = camelize(name, true); + + // for reserved word or word starting with number, append _ + if (isReservedWord(name) || name.matches("^\\d.*")) { + name = escapeReservedWord(name); + } + + return name; + } + + @Override + public String toParamName(String name) { + // should be the same as variable name + return toVarName(name); + } + + @Override + public String toModelName(final String name) { + final String sanitizedName = sanitizeName(modelNamePrefix + name + modelNameSuffix); + + // camelize the model name + // phone_number => PhoneNumber + final String camelizedName = camelize(sanitizedName); + + // model name cannot use reserved keyword, e.g. return + if (isReservedWord(camelizedName)) { + final String modelName = "Model" + camelizedName; + LOGGER.warn(camelizedName + " (reserved word) cannot be used as model name. Renamed to " + modelName); + return modelName; + } + + // model name starts with number + if (name.matches("^\\d.*")) { + final String modelName = "Model" + camelizedName; // e.g. 200Response => Model200Response (after camelize) + LOGGER.warn(name + " (model name starts with number) cannot be used as model name. Renamed to " + modelName); + return modelName; + } + + return camelizedName; + } + + @Override + public String toModelFilename(String name) { + // should be the same as the model name + return toModelName(name); + } + + @Override + public String getTypeDeclaration(Property p) { + if (p instanceof ArrayProperty) { + ArrayProperty ap = (ArrayProperty) p; + Property inner = ap.getItems(); + return getSwaggerType(p) + "<" + getTypeDeclaration(inner) + ">"; + } else if (p instanceof MapProperty) { + MapProperty mp = (MapProperty) p; + Property inner = mp.getAdditionalProperties(); + + return getSwaggerType(p) + ""; + } + return super.getTypeDeclaration(p); + } + + @Override + public String toDefaultValue(Property p) { + if (p instanceof ArrayProperty) { + final ArrayProperty ap = (ArrayProperty) p; + final String pattern; + if (fullJavaUtil) { + pattern = "new java.util.ArrayList<%s>()"; + } else { + pattern = "new ArrayList<%s>()"; + } + return String.format(pattern, getTypeDeclaration(ap.getItems())); + } else if (p instanceof MapProperty) { + final MapProperty ap = (MapProperty) p; + final String pattern; + if (fullJavaUtil) { + pattern = "new java.util.HashMap()"; + } else { + pattern = "new HashMap()"; + } + return String.format(pattern, getTypeDeclaration(ap.getAdditionalProperties())); + } else if (p instanceof IntegerProperty) { + IntegerProperty dp = (IntegerProperty) p; + if (dp.getDefault() != null) { + return dp.getDefault().toString(); + } + return "null"; + } else if (p instanceof LongProperty) { + LongProperty dp = (LongProperty) p; + if (dp.getDefault() != null) { + return dp.getDefault().toString()+"l"; + } + return "null"; + } else if (p instanceof DoubleProperty) { + DoubleProperty dp = (DoubleProperty) p; + if (dp.getDefault() != null) { + return dp.getDefault().toString() + "d"; + } + return "null"; + } else if (p instanceof FloatProperty) { + FloatProperty dp = (FloatProperty) p; + if (dp.getDefault() != null) { + return dp.getDefault().toString() + "f"; + } + return "null"; + } else if (p instanceof BooleanProperty) { + BooleanProperty bp = (BooleanProperty) p; + if (bp.getDefault() != null) { + return bp.getDefault().toString(); + } + return "null"; + } else if (p instanceof StringProperty) { + StringProperty sp = (StringProperty) p; + if (sp.getDefault() != null) { + String _default = sp.getDefault(); + if (sp.getEnum() == null) { + return "\"" + escapeText(_default) + "\""; + } else { + // convert to enum var name later in postProcessModels + return _default; + } + } + return "null"; + } + return super.toDefaultValue(p); + } + + @Override + public void setParameterExampleValue(CodegenParameter p) { + String example; + + if (p.defaultValue == null) { + example = p.example; + } else { + example = p.defaultValue; + } + + String type = p.baseType; + if (type == null) { + type = p.dataType; + } + + if ("String".equals(type)) { + if (example == null) { + example = p.paramName + "_example"; + } + example = "\"" + escapeText(example) + "\""; + } else if ("Integer".equals(type) || "Short".equals(type)) { + if (example == null) { + example = "56"; + } + } else if ("Long".equals(type)) { + if (example == null) { + example = "56"; + } + example = example + "L"; + } else if ("Float".equals(type)) { + if (example == null) { + example = "3.4"; + } + example = example + "F"; + } else if ("Double".equals(type)) { + example = "3.4"; + example = example + "D"; + } else if ("Boolean".equals(type)) { + if (example == null) { + example = "true"; + } + } else if ("File".equals(type)) { + if (example == null) { + example = "/path/to/file"; + } + example = "new File(\"" + escapeText(example) + "\")"; + } else if ("Date".equals(type)) { + example = "new Date()"; + } else if (!languageSpecificPrimitives.contains(type)) { + // type is a model class, e.g. User + example = "new " + type + "()"; + } + + if (example == null) { + example = "null"; + } else if (Boolean.TRUE.equals(p.isListContainer)) { + example = "Arrays.asList(" + example + ")"; + } else if (Boolean.TRUE.equals(p.isMapContainer)) { + example = "new HashMap()"; + } + + p.example = example; + } + + @Override + public String getSwaggerType(Property p) { + String swaggerType = super.getSwaggerType(p); + String type; + if (typeMapping.containsKey(swaggerType)) { + type = typeMapping.get(swaggerType); + if (languageSpecificPrimitives.contains(type) || type.indexOf(".") >= 0 || + type.equals("Map") || type.equals("List") || + type.equals("File") || type.equals("Date")) { + return type; + } + } else { + type = swaggerType; + } + if (null == type) { + LOGGER.error("No Type defined for Property " + p); + } + return toModelName(type); + } + + @Override + public String toOperationId(String operationId) { + // throw exception if method name is empty + if (StringUtils.isEmpty(operationId)) { + throw new RuntimeException("Empty method/operation name (operationId) not allowed"); + } + + operationId = camelize(sanitizeName(operationId), true); + + // method name cannot use reserved keyword, e.g. return + if (isReservedWord(operationId)) { + String newOperationId = camelize("call_" + operationId, true); + LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + newOperationId); + return newOperationId; + } + + return operationId; + } + + @Override + public CodegenModel fromModel(String name, Model model, Map allDefinitions) { + CodegenModel codegenModel = super.fromModel(name, model, allDefinitions); + if(codegenModel.description != null) { + codegenModel.imports.add("ApiModel"); + } + if (allDefinitions != null && codegenModel != null && codegenModel.parentSchema != null && codegenModel.hasEnums) { + final Model parentModel = allDefinitions.get(codegenModel.parentSchema); + final CodegenModel parentCodegenModel = super.fromModel(codegenModel.parent, parentModel); + codegenModel = AbstractJavaCodegen.reconcileInlineEnums(codegenModel, parentCodegenModel); + } + + return codegenModel; + } + + @Override + public Map postProcessModelsEnum(Map objs) { + objs = super.postProcessModelsEnum(objs); + String lib = getLibrary(); + if (StringUtils.isEmpty(lib) || "feign".equals(lib) || "jersey2".equals(lib)) { + List> imports = (List>)objs.get("imports"); + List models = (List) objs.get("models"); + for (Object _mo : models) { + Map mo = (Map) _mo; + CodegenModel cm = (CodegenModel) mo.get("model"); + // for enum model + if (Boolean.TRUE.equals(cm.isEnum) && cm.allowableValues != null) { + cm.imports.add(importMapping.get("JsonValue")); + Map item = new HashMap(); + item.put("import", importMapping.get("JsonValue")); + imports.add(item); + } + } + } + return objs; + } + + @Override + public void postProcessModelProperty(CodegenModel model, CodegenProperty property) { + if(serializeBigDecimalAsString) { + if (property.baseType.equals("BigDecimal")) { + // we serialize BigDecimal as `string` to avoid precision loss + property.vendorExtensions.put("extraAnnotation", "@JsonSerialize(using = ToStringSerializer.class)"); + + // this requires some more imports to be added for this model... + model.imports.add("ToStringSerializer"); + model.imports.add("JsonSerialize"); + } + } + + if ("array".equals(property.containerType)) { + model.imports.add("ArrayList"); + } else if ("map".equals(property.containerType)) { + model.imports.add("HashMap"); + } + + if(!BooleanUtils.toBoolean(model.isEnum)) { + // needed by all pojos, but not enums + model.imports.add("ApiModelProperty"); + model.imports.add("ApiModel"); + // comment out below as it's in the model template + //model.imports.add("Objects"); + + final String lib = getLibrary(); + if(StringUtils.isEmpty(lib) || "feign".equals(lib) || "jersey2".equals(lib)) { + model.imports.add("JsonProperty"); + + if(BooleanUtils.toBoolean(model.hasEnums)) { + model.imports.add("JsonValue"); + } + } + } + return; + } + + @Override + public void postProcessParameter(CodegenParameter parameter) { } + + @Override + public Map postProcessModels(Map objs) { + return postProcessModelsEnum(objs); + } + + @Override + public Map postProcessOperations(Map objs) { + // Remove imports of List, ArrayList, Map and HashMap as they are + // imported in the template already. + List> imports = (List>) objs.get("imports"); + Pattern pattern = Pattern.compile("java\\.util\\.(List|ArrayList|Map|HashMap)"); + for (Iterator> itr = imports.iterator(); itr.hasNext();) { + String _import = itr.next().get("import"); + if (pattern.matcher(_import).matches()) { + itr.remove(); + } + } + return objs; + } + + @Override + public void preprocessSwagger(Swagger swagger) { + if (swagger != null && swagger.getPaths() != null) { + for (String pathname : swagger.getPaths().keySet()) { + Path path = swagger.getPath(pathname); + if (path.getOperations() != null) { + for (Operation operation : path.getOperations()) { + boolean hasFormParameters = false; + for (Parameter parameter : operation.getParameters()) { + if (parameter instanceof FormParameter) { + hasFormParameters = true; + } + } + + String defaultContentType = hasFormParameters ? "application/x-www-form-urlencoded" : "application/json"; + String contentType = operation.getConsumes() == null || operation.getConsumes().isEmpty() + ? defaultContentType : operation.getConsumes().get(0); + String accepts = getAccept(operation); + operation.setVendorExtension("x-contentType", contentType); + operation.setVendorExtension("x-accepts", accepts); + } + } + } + } + } + + private static String getAccept(Operation operation) { + String accepts = null; + String defaultContentType = "application/json"; + if (operation.getProduces() != null && !operation.getProduces().isEmpty()) { + StringBuilder sb = new StringBuilder(); + for (String produces : operation.getProduces()) { + if (defaultContentType.equalsIgnoreCase(produces)) { + accepts = defaultContentType; + break; + } else { + if (sb.length() > 0) { + sb.append(","); + } + sb.append(produces); + } + } + if (accepts == null) { + accepts = sb.toString(); + } + } else { + accepts = defaultContentType; + } + + return accepts; + } + + @Override + protected boolean needToImport(String type) { + return super.needToImport(type) && type.indexOf(".") < 0; + } +/* + @Override + public String findCommonPrefixOfVars(List vars) { + String prefix = StringUtils.getCommonPrefix(vars.toArray(new String[vars.size()])); + // exclude trailing characters that should be part of a valid variable + // e.g. ["status-on", "status-off"] => "status-" (not "status-o") + return prefix.replaceAll("[a-zA-Z0-9]+\\z", ""); + } +*/ + + @Override + public String toEnumName(CodegenProperty property) { + return sanitizeName(camelize(property.name)) + "Enum"; + } + + @Override + public String toEnumVarName(String value, String datatype) { + // number + if ("Integer".equals(datatype) || "Long".equals(datatype) || + "Float".equals(datatype) || "Double".equals(datatype)) { + String varName = "NUMBER_" + value; + varName = varName.replaceAll("-", "MINUS_"); + varName = varName.replaceAll("\\+", "PLUS_"); + varName = varName.replaceAll("\\.", "_DOT_"); + return varName; + } + + // string + String var = value.replaceAll("\\W+", "_").replaceAll("_+", "_").toUpperCase(); + if (var.matches("\\d.*")) { + return "_" + var; + } else { + return var; + } + } + + @Override + public String toEnumValue(String value, String datatype) { + if ("Integer".equals(datatype) || "Long".equals(datatype) || + "Float".equals(datatype) || "Double".equals(datatype)) { + return value; + } else { + return "\"" + escapeText(value) + "\""; + } + } + + private static CodegenModel reconcileInlineEnums(CodegenModel codegenModel, CodegenModel parentCodegenModel) { + // This generator uses inline classes to define enums, which breaks when + // dealing with models that have subTypes. To clean this up, we will analyze + // the parent and child models, look for enums that match, and remove + // them from the child models and leave them in the parent. + // Because the child models extend the parents, the enums will be available via the parent. + + // Only bother with reconciliation if the parent model has enums. + if (parentCodegenModel.hasEnums) { + + // Get the properties for the parent and child models + final List parentModelCodegenProperties = parentCodegenModel.vars; + List codegenProperties = codegenModel.vars; + + // Iterate over all of the parent model properties + boolean removedChildEnum = false; + for (CodegenProperty parentModelCodegenPropery : parentModelCodegenProperties) { + // Look for enums + if (parentModelCodegenPropery.isEnum) { + // Now that we have found an enum in the parent class, + // and search the child class for the same enum. + Iterator iterator = codegenProperties.iterator(); + while (iterator.hasNext()) { + CodegenProperty codegenProperty = iterator.next(); + if (codegenProperty.isEnum && codegenProperty.equals(parentModelCodegenPropery)) { + // We found an enum in the child class that is + // a duplicate of the one in the parent, so remove it. + iterator.remove(); + removedChildEnum = true; + } + } + } + } + + if(removedChildEnum) { + // If we removed an entry from this model's vars, we need to ensure hasMore is updated + int count = 0, numVars = codegenProperties.size(); + for(CodegenProperty codegenProperty : codegenProperties) { + count += 1; + codegenProperty.hasMore = (count < numVars) ? true : null; + } + codegenModel.vars = codegenProperties; + } + } + + return codegenModel; + } + + private static String sanitizePackageName(String packageName) { + packageName = packageName.trim(); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'. + packageName = packageName.replaceAll("[^a-zA-Z0-9_\\.]", "_"); + if(Strings.isNullOrEmpty(packageName)) { + return "invalidPackageName"; + } + return packageName; + } + + public void setInvokerPackage(String invokerPackage) { + this.invokerPackage = invokerPackage; + } + + public void setGroupId(String groupId) { + this.groupId = groupId; + } + + public void setArtifactId(String artifactId) { + this.artifactId = artifactId; + } + + public void setArtifactVersion(String artifactVersion) { + this.artifactVersion = artifactVersion; + } + + public void setSourceFolder(String sourceFolder) { + this.sourceFolder = sourceFolder; + } + + public void setLocalVariablePrefix(String localVariablePrefix) { + this.localVariablePrefix = localVariablePrefix; + } + + public void setSerializeBigDecimalAsString(boolean s) { + this.serializeBigDecimalAsString = s; + } + + public void setSerializableModel(Boolean serializableModel) { + this.serializableModel = serializableModel; + } + + public void setFullJavaUtil(boolean fullJavaUtil) { + this.fullJavaUtil = fullJavaUtil; + } + + public void setDateLibrary(String library) { + this.dateLibrary = library; + } +} diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractJavaJAXRSServerCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractJavaJAXRSServerCodegen.java index fbb2831ab8b..d1458514256 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractJavaJAXRSServerCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractJavaJAXRSServerCodegen.java @@ -1,9 +1,6 @@ package io.swagger.codegen.languages; -import io.swagger.codegen.CodegenOperation; -import io.swagger.codegen.CodegenParameter; -import io.swagger.codegen.CodegenResponse; -import io.swagger.codegen.CodegenType; +import io.swagger.codegen.*; import io.swagger.models.Operation; import io.swagger.models.Path; import io.swagger.models.Swagger; @@ -13,7 +10,7 @@ import org.slf4j.LoggerFactory; import java.util.*; -public abstract class AbstractJavaJAXRSServerCodegen extends JavaClientCodegen { +public abstract class AbstractJavaJAXRSServerCodegen extends AbstractJavaCodegen { /** * Name of the sub-directory in "src/main/resource" where to find the * Mustache template for the JAX-RS Codegen. @@ -26,28 +23,22 @@ public abstract class AbstractJavaJAXRSServerCodegen extends JavaClientCodegen { public AbstractJavaJAXRSServerCodegen() { super(); - dateLibrary = "legacy"; - apiTestTemplateFiles.clear(); // TODO: add test template + + sourceFolder = "src/gen/java"; + invokerPackage = "io.swagger.api"; + artifactId = "swagger-jaxrs-server"; + dateLibrary = "legacy"; //TODO: add joda support to all jax-rs + + apiPackage = "io.swagger.api"; + modelPackage = "io.swagger.model"; + + additionalProperties.put("title", title); + + cliOptions.add(new CliOption(CodegenConstants.IMPL_FOLDER, CodegenConstants.IMPL_FOLDER_DESC)); + cliOptions.add(new CliOption("title", "a title describing the application")); + } - @Override - public void processOpts() { - super.processOpts(); - // clear model and api doc template as AbstractJavaJAXRSServerCodegen - // does not support auto-generated markdown doc at the moment - modelDocTemplateFiles.remove("model_doc.mustache"); - apiDocTemplateFiles.remove("api_doc.mustache"); - } - - // ================ - // ABSTRACT METHODS - // ================ - - @Override - public abstract String getHelp(); - - @Override - public abstract String getName(); // =============== // COMMONS METHODS @@ -59,6 +50,15 @@ public abstract class AbstractJavaJAXRSServerCodegen extends JavaClientCodegen { return CodegenType.SERVER; } + @Override + public void processOpts() { + super.processOpts(); + + if (additionalProperties.containsKey(CodegenConstants.IMPL_FOLDER)) { + implFolder = (String) additionalProperties.get(CodegenConstants.IMPL_FOLDER); + } + } + @Override public void preprocessSwagger(Swagger swagger) { if ( "/".equals(swagger.getBasePath()) ) { diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/GroovyClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/GroovyClientCodegen.java index 5b26662531f..3f9bfbfc6b3 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/GroovyClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/GroovyClientCodegen.java @@ -1,16 +1,13 @@ package io.swagger.codegen.languages; import io.swagger.codegen.*; -import io.swagger.models.Operation; import java.io.File; -import java.util.*; -public class GroovyClientCodegen extends JavaClientCodegen { +public class GroovyClientCodegen extends AbstractJavaCodegen { public static final String CONFIG_PACKAGE = "configPackage"; protected String title = "Petstore Server"; protected String configPackage = ""; - protected String templateFileName = "api.mustache"; public GroovyClientCodegen() { super(); @@ -18,28 +15,28 @@ public class GroovyClientCodegen extends JavaClientCodegen { sourceFolder = projectFolder + File.separator + "groovy"; outputFolder = "generated-code/groovy"; modelTemplateFiles.put("model.mustache", ".groovy"); - apiTemplateFiles.put(templateFileName, ".groovy"); + apiTemplateFiles.put("api.mustache", ".groovy"); apiTestTemplateFiles.clear(); // TODO: add test template embeddedTemplateDir = templateDir = "Groovy"; + + // clear model and api doc template as this codegen + // does not support auto-generated markdown doc at the moment + //TODO: add doc templates + modelDocTemplateFiles.remove("model_doc.mustache"); + apiDocTemplateFiles.remove("api_doc.mustache"); apiPackage = "io.swagger.api"; modelPackage = "io.swagger.model"; configPackage = "io.swagger.configuration"; invokerPackage = "io.swagger.api"; - artifactId = "swagger-spring-mvc-server"; - dateLibrary = "legacy"; + artifactId = "swagger-groovy"; + dateLibrary = "legacy"; //TODO: add joda support to groovy - additionalProperties.put(CodegenConstants.INVOKER_PACKAGE, invokerPackage); - additionalProperties.put(CodegenConstants.GROUP_ID, groupId); - additionalProperties.put(CodegenConstants.ARTIFACT_ID, artifactId); - additionalProperties.put(CodegenConstants.ARTIFACT_VERSION, artifactVersion); additionalProperties.put("title", title); - additionalProperties.put(CodegenConstants.API_PACKAGE, apiPackage); additionalProperties.put(CONFIG_PACKAGE, configPackage); cliOptions.add(new CliOption(CONFIG_PACKAGE, "configuration package for generated code")); - supportedLibraries.clear(); } @Override @@ -61,16 +58,10 @@ public class GroovyClientCodegen extends JavaClientCodegen { public void processOpts() { super.processOpts(); - // clear model and api doc template as this codegen - // does not support auto-generated markdown doc at the moment - modelDocTemplateFiles.remove("model_doc.mustache"); - apiDocTemplateFiles.remove("api_doc.mustache"); - if (additionalProperties.containsKey(CONFIG_PACKAGE)) { this.setConfigPackage((String) additionalProperties.get(CONFIG_PACKAGE)); } - supportingFiles.clear(); supportingFiles.add(new SupportingFile("build.gradle.mustache", "", "build.gradle")); // TODO readme to be added later //supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")); diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaCXFServerCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaCXFServerCodegen.java index 5321e3a59db..f637a80567c 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaCXFServerCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaCXFServerCodegen.java @@ -2,12 +2,9 @@ package io.swagger.codegen.languages; import java.io.File; -import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -import io.swagger.codegen.CliOption; -import io.swagger.codegen.CodegenConstants; import io.swagger.codegen.CodegenModel; import io.swagger.codegen.CodegenOperation; import io.swagger.codegen.CodegenProperty; @@ -19,56 +16,26 @@ public class JavaCXFServerCodegen extends AbstractJavaJAXRSServerCodegen { super(); supportsInheritance = true; - sourceFolder = "src/gen/java"; - invokerPackage = "io.swagger.api"; - artifactId = "swagger-jaxrs-server"; + sourceFolder = "gen" + File.separator + "java"; outputFolder = "generated-code/JavaJaxRS-CXF"; + apiTestTemplateFiles.clear(); // TODO: add test template - modelTemplateFiles.put("model.mustache", ".java"); - apiTemplateFiles.put("api.mustache", ".java"); - apiPackage = "io.swagger.api"; - modelPackage = "io.swagger.model"; + // clear model and api doc template as this codegen + // does not support auto-generated markdown doc at the moment + //TODO: add doc templates + modelDocTemplateFiles.remove("model_doc.mustache"); + apiDocTemplateFiles.remove("api_doc.mustache"); - additionalProperties.put("title", title); typeMapping.put("date", "LocalDate"); typeMapping.put("DateTime", "javax.xml.datatype.XMLGregorianCalendar"); // Map DateTime fields to Java standart class 'XMLGregorianCalendar' importMapping.put("LocalDate", "org.joda.time.LocalDate"); - super.embeddedTemplateDir = templateDir = JAXRS_TEMPLATE_DIRECTORY_NAME + File.separator + "cxf"; + embeddedTemplateDir = templateDir = JAXRS_TEMPLATE_DIRECTORY_NAME + File.separator + "cxf"; - for ( int i = 0; i < cliOptions.size(); i++ ) { - if ( CodegenConstants.LIBRARY.equals(cliOptions.get(i).getOpt()) ) { - cliOptions.remove(i); - break; - } - } - - CliOption library = new CliOption(CodegenConstants.LIBRARY, "library template (sub-template) to use"); - library.setDefault(DEFAULT_LIBRARY); - - Map supportedLibraries = new LinkedHashMap(); - - supportedLibraries.put(DEFAULT_LIBRARY, "CXF"); - library.setEnum(supportedLibraries); - - cliOptions.add(library); - cliOptions.add(new CliOption(CodegenConstants.IMPL_FOLDER, CodegenConstants.IMPL_FOLDER_DESC)); - cliOptions.add(new CliOption("title", "a title describing the application")); } - - @Override - public void processOpts() - { - super.processOpts(); - sourceFolder = "gen" + File.separator + "java"; - supportingFiles.clear(); // Don't need extra files provided by AbstractJAX-RS & Java Codegen - - //TODO - //final String invokerFolder = (sourceFolder + '/' + invokerPackage).replace(".", "/"); - //supportingFiles.add(new SupportingFile("CXF2InterfaceComparator.mustache", invokerFolder, "CXF2InterfaceComparator.java")); - } + @Override public String getName() diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java index 7efdb8c49eb..f9321f83d26 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java @@ -1,115 +1,35 @@ package io.swagger.codegen.languages; -import com.google.common.base.Strings; import io.swagger.codegen.*; -import io.swagger.models.Model; -import io.swagger.models.Operation; -import io.swagger.models.Path; -import io.swagger.models.Swagger; -import io.swagger.models.parameters.FormParameter; -import io.swagger.models.parameters.Parameter; -import io.swagger.models.properties.*; -import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.StringUtils; -//import org.apache.commons.lang3.WordUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.File; import java.util.*; -import java.util.regex.Pattern; -public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig { +public class JavaClientCodegen extends AbstractJavaCodegen { @SuppressWarnings("hiding") private static final Logger LOGGER = LoggerFactory.getLogger(JavaClientCodegen.class); - public static final String FULL_JAVA_UTIL = "fullJavaUtil"; - public static final String DEFAULT_LIBRARY = ""; - public static final String DATE_LIBRARY = "dateLibrary"; + public static final String USE_RX_JAVA = "useRxJava"; public static final String RETROFIT_1 = "retrofit"; public static final String RETROFIT_2 = "retrofit2"; - protected String dateLibrary = "joda"; - protected String invokerPackage = "io.swagger.client"; - protected String groupId = "io.swagger"; - protected String artifactId = "swagger-java-client"; - protected String artifactVersion = "1.0.0"; - protected String projectFolder = "src" + File.separator + "main"; - protected String projectTestFolder = "src" + File.separator + "test"; - protected String sourceFolder = projectFolder + File.separator + "java"; - protected String testFolder = projectTestFolder + File.separator + "java"; protected String gradleWrapperPackage = "gradle.wrapper"; - protected String localVariablePrefix = ""; - protected boolean fullJavaUtil; - protected String javaUtilPrefix = ""; - protected Boolean serializableModel = false; - protected boolean serializeBigDecimalAsString = false; protected boolean useRxJava = false; - protected boolean hideGenerationTimestamp = false; - protected String apiDocPath = "docs/"; - protected String modelDocPath = "docs/"; public JavaClientCodegen() { super(); outputFolder = "generated-code" + File.separator + "java"; - modelTemplateFiles.put("model.mustache", ".java"); - apiTemplateFiles.put("api.mustache", ".java"); - apiTestTemplateFiles.put("api_test.mustache", ".java"); embeddedTemplateDir = templateDir = "Java"; + invokerPackage = "io.swagger.client"; + artifactId = "swagger-java-client"; apiPackage = "io.swagger.client.api"; modelPackage = "io.swagger.client.model"; - setReservedWordsLowerCase( - Arrays.asList( - // used as internal variables, can collide with parameter names - "localVarPath", "localVarQueryParams", "localVarHeaderParams", "localVarFormParams", - "localVarPostBody", "localVarAccepts", "localVarAccept", "localVarContentTypes", - "localVarContentType", "localVarAuthNames", "localReturnType", - "ApiClient", "ApiException", "ApiResponse", "Configuration", "StringUtil", - - // language reserved words - "abstract", "continue", "for", "new", "switch", "assert", - "default", "if", "package", "synchronized", "boolean", "do", "goto", "private", - "this", "break", "double", "implements", "protected", "throw", "byte", "else", - "import", "public", "throws", "case", "enum", "instanceof", "return", "transient", - "catch", "extends", "int", "short", "try", "char", "final", "interface", "static", - "void", "class", "finally", "long", "strictfp", "volatile", "const", "float", - "native", "super", "while") - ); - - languageSpecificPrimitives = new HashSet( - Arrays.asList( - "String", - "boolean", - "Boolean", - "Double", - "Integer", - "Long", - "Float", - "Object", - "byte[]") - ); - instantiationTypes.put("array", "ArrayList"); - instantiationTypes.put("map", "HashMap"); - typeMapping.put("date", "Date"); - typeMapping.put("file", "File"); - typeMapping.put("UUID", "String"); - - cliOptions.add(new CliOption(CodegenConstants.MODEL_PACKAGE, CodegenConstants.MODEL_PACKAGE_DESC)); - cliOptions.add(new CliOption(CodegenConstants.API_PACKAGE, CodegenConstants.API_PACKAGE_DESC)); - cliOptions.add(new CliOption(CodegenConstants.INVOKER_PACKAGE, CodegenConstants.INVOKER_PACKAGE_DESC)); - cliOptions.add(new CliOption(CodegenConstants.GROUP_ID, CodegenConstants.GROUP_ID_DESC)); - cliOptions.add(new CliOption(CodegenConstants.ARTIFACT_ID, CodegenConstants.ARTIFACT_ID_DESC)); - cliOptions.add(new CliOption(CodegenConstants.ARTIFACT_VERSION, CodegenConstants.ARTIFACT_VERSION_DESC)); - cliOptions.add(new CliOption(CodegenConstants.SOURCE_FOLDER, CodegenConstants.SOURCE_FOLDER_DESC)); - cliOptions.add(new CliOption(CodegenConstants.LOCAL_VARIABLE_PREFIX, CodegenConstants.LOCAL_VARIABLE_PREFIX_DESC)); - cliOptions.add(CliOption.newBoolean(CodegenConstants.SERIALIZABLE_MODEL, CodegenConstants.SERIALIZABLE_MODEL_DESC)); - cliOptions.add(CliOption.newBoolean(CodegenConstants.SERIALIZE_BIG_DECIMAL_AS_STRING, CodegenConstants - .SERIALIZE_BIG_DECIMAL_AS_STRING_DESC)); - cliOptions.add(CliOption.newBoolean(FULL_JAVA_UTIL, "whether to use fully qualified name for classes under java.util")); cliOptions.add(CliOption.newBoolean(USE_RX_JAVA, "Whether to use the RxJava adapter with the retrofit2 library.")); - cliOptions.add(new CliOption("hideGenerationTimestamp", "hides the timestamp when files were generated")); supportedLibraries.put(DEFAULT_LIBRARY, "HTTP client: Jersey client 1.19.1. JSON processing: Jackson 2.7.0"); supportedLibraries.put("feign", "HTTP client: Netflix Feign 8.16.0. JSON processing: Jackson 2.7.0"); @@ -124,15 +44,6 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig { library.setDefault(DEFAULT_LIBRARY); cliOptions.add(library); - CliOption dateLibrary = new CliOption(DATE_LIBRARY, "Option. Date library to use"); - Map dateOptions = new HashMap(); - dateOptions.put("java8", "Java 8 native"); - dateOptions.put("java8-localdatetime", "Java 8 using LocalDateTime (for legacy app only)"); - dateOptions.put("joda", "Joda"); - dateOptions.put("legacy", "Legacy java.util.Date"); - dateLibrary.setEnum(dateOptions); - - cliOptions.add(dateLibrary); } @Override @@ -154,109 +65,14 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig { public void processOpts() { super.processOpts(); - if (additionalProperties.containsKey(CodegenConstants.INVOKER_PACKAGE)) { - this.setInvokerPackage((String) additionalProperties.get(CodegenConstants.INVOKER_PACKAGE)); - } else { - //not set, use default to be passed to template - additionalProperties.put(CodegenConstants.INVOKER_PACKAGE, invokerPackage); - } - - if (additionalProperties.containsKey(CodegenConstants.GROUP_ID)) { - this.setGroupId((String) additionalProperties.get(CodegenConstants.GROUP_ID)); - } else { - //not set, use to be passed to template - additionalProperties.put(CodegenConstants.GROUP_ID, groupId); - } - - if (additionalProperties.containsKey(CodegenConstants.ARTIFACT_ID)) { - this.setArtifactId((String) additionalProperties.get(CodegenConstants.ARTIFACT_ID)); - } else { - //not set, use to be passed to template - additionalProperties.put(CodegenConstants.ARTIFACT_ID, artifactId); - } - - if (additionalProperties.containsKey(CodegenConstants.ARTIFACT_VERSION)) { - this.setArtifactVersion((String) additionalProperties.get(CodegenConstants.ARTIFACT_VERSION)); - } else { - //not set, use to be passed to template - additionalProperties.put(CodegenConstants.ARTIFACT_VERSION, artifactVersion); - } - - if (additionalProperties.containsKey(CodegenConstants.SOURCE_FOLDER)) { - this.setSourceFolder((String) additionalProperties.get(CodegenConstants.SOURCE_FOLDER)); - } - - if (additionalProperties.containsKey(CodegenConstants.LOCAL_VARIABLE_PREFIX)) { - this.setLocalVariablePrefix((String) additionalProperties.get(CodegenConstants.LOCAL_VARIABLE_PREFIX)); - } - - if (additionalProperties.containsKey(CodegenConstants.SERIALIZABLE_MODEL)) { - this.setSerializableModel(Boolean.valueOf(additionalProperties.get(CodegenConstants.SERIALIZABLE_MODEL).toString())); - } - - if (additionalProperties.containsKey(CodegenConstants.LIBRARY)) { - this.setLibrary((String) additionalProperties.get(CodegenConstants.LIBRARY)); - } - - if(additionalProperties.containsKey(CodegenConstants.SERIALIZE_BIG_DECIMAL_AS_STRING)) { - this.setSerializeBigDecimalAsString(Boolean.valueOf(additionalProperties.get(CodegenConstants.SERIALIZE_BIG_DECIMAL_AS_STRING).toString())); - } - - // need to put back serializableModel (boolean) into additionalProperties as value in additionalProperties is string - additionalProperties.put(CodegenConstants.SERIALIZABLE_MODEL, serializableModel); - - if (additionalProperties.containsKey(FULL_JAVA_UTIL)) { - this.setFullJavaUtil(Boolean.valueOf(additionalProperties.get(FULL_JAVA_UTIL).toString())); - } - if (additionalProperties.containsKey(USE_RX_JAVA)) { this.setUseRxJava(Boolean.valueOf(additionalProperties.get(USE_RX_JAVA).toString())); } - if (fullJavaUtil) { - javaUtilPrefix = "java.util."; - } - additionalProperties.put(FULL_JAVA_UTIL, fullJavaUtil); - additionalProperties.put("javaUtilPrefix", javaUtilPrefix); - - // make api and model doc path available in mustache template - additionalProperties.put("apiDocPath", apiDocPath); - additionalProperties.put("modelDocPath", modelDocPath); - - importMapping.put("List", "java.util.List"); - - if (fullJavaUtil) { - typeMapping.put("array", "java.util.List"); - typeMapping.put("map", "java.util.Map"); - typeMapping.put("DateTime", "java.util.Date"); - typeMapping.remove("List"); - importMapping.remove("Date"); - importMapping.remove("Map"); - importMapping.remove("HashMap"); - importMapping.remove("Array"); - importMapping.remove("ArrayList"); - importMapping.remove("List"); - importMapping.remove("Set"); - importMapping.remove("DateTime"); - instantiationTypes.put("array", "java.util.ArrayList"); - instantiationTypes.put("map", "java.util.HashMap"); - } - - this.sanitizeConfig(); - - - // optional jackson mappings for BigDecimal support - importMapping.put("ToStringSerializer", "com.fasterxml.jackson.databind.ser.std.ToStringSerializer"); - importMapping.put("JsonSerialize", "com.fasterxml.jackson.databind.annotation.JsonSerialize"); - - // imports for pojos - importMapping.put("ApiModelProperty", "io.swagger.annotations.ApiModelProperty"); - importMapping.put("ApiModel", "io.swagger.annotations.ApiModel"); - importMapping.put("JsonProperty", "com.fasterxml.jackson.annotation.JsonProperty"); - importMapping.put("JsonValue", "com.fasterxml.jackson.annotation.JsonValue"); - importMapping.put("Objects", "java.util.Objects"); - importMapping.put("StringUtil", invokerPackage + ".StringUtil"); final String invokerFolder = (sourceFolder + '/' + invokerPackage).replace(".", "/"); + final String authFolder = (sourceFolder + '/' + invokerPackage + ".auth").replace(".", "/"); + + //Common files writeOptional(outputFolder, new SupportingFile("pom.mustache", "", "pom.xml")); writeOptional(outputFolder, new SupportingFile("README.mustache", "", "README.md")); writeOptional(outputFolder, new SupportingFile("build.gradle.mustache", "", "build.gradle")); @@ -266,25 +82,24 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig { supportingFiles.add(new SupportingFile("travis.mustache", "", ".travis.yml")); supportingFiles.add(new SupportingFile("ApiClient.mustache", invokerFolder, "ApiClient.java")); supportingFiles.add(new SupportingFile("StringUtil.mustache", invokerFolder, "StringUtil.java")); - - final String authFolder = (sourceFolder + '/' + invokerPackage + ".auth").replace(".", "/"); - if ("feign".equals(getLibrary())) { - supportingFiles.add(new SupportingFile("FormAwareEncoder.mustache", invokerFolder, "FormAwareEncoder.java")); - - //gradleWrapper files - supportingFiles.add( new SupportingFile( "gradlew.mustache", "", "gradlew") ); - supportingFiles.add( new SupportingFile( "gradlew.bat.mustache", "", "gradlew.bat") ); - supportingFiles.add( new SupportingFile( "gradle-wrapper.properties.mustache", - gradleWrapperPackage.replace( ".", File.separator ), "gradle-wrapper.properties") ); - supportingFiles.add( new SupportingFile( "gradle-wrapper.jar", - gradleWrapperPackage.replace( ".", File.separator ), "gradle-wrapper.jar") ); - // "build.sbt" is for development with SBT - supportingFiles.add(new SupportingFile("build.sbt.mustache", "", "build.sbt")); - } supportingFiles.add(new SupportingFile("auth/HttpBasicAuth.mustache", authFolder, "HttpBasicAuth.java")); supportingFiles.add(new SupportingFile("auth/ApiKeyAuth.mustache", authFolder, "ApiKeyAuth.java")); supportingFiles.add(new SupportingFile("auth/OAuth.mustache", authFolder, "OAuth.java")); supportingFiles.add(new SupportingFile("auth/OAuthFlow.mustache", authFolder, "OAuthFlow.java")); + supportingFiles.add( new SupportingFile( "gradlew.mustache", "", "gradlew") ); + supportingFiles.add( new SupportingFile( "gradlew.bat.mustache", "", "gradlew.bat") ); + supportingFiles.add( new SupportingFile( "gradle-wrapper.properties.mustache", + gradleWrapperPackage.replace( ".", File.separator ), "gradle-wrapper.properties") ); + supportingFiles.add( new SupportingFile( "gradle-wrapper.jar", + gradleWrapperPackage.replace( ".", File.separator ), "gradle-wrapper.jar") ); + supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh")); + supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore")); + + //TODO: add doc to retrofit1 and feign + if ( "feign".equals(getLibrary()) || "retrofit".equals(getLibrary()) ){ + modelDocTemplateFiles.remove("model_doc.mustache"); + apiDocTemplateFiles.remove("api_doc.mustache"); + } if (!("feign".equals(getLibrary()) || usesAnyRetrofitLibrary())) { supportingFiles.add(new SupportingFile("apiException.mustache", invokerFolder, "ApiException.java")); @@ -294,103 +109,25 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig { } // library-specific files - if (StringUtils.isEmpty(getLibrary())) { - // generate markdown docs - modelDocTemplateFiles.put("model_doc.mustache", ".md"); - apiDocTemplateFiles.put("api_doc.mustache", ".md"); + if (!StringUtils.isEmpty(getLibrary())) { + //TODO: add sbt support to default client + supportingFiles.add(new SupportingFile("build.sbt.mustache", "", "build.sbt")); - //gradleWrapper files - supportingFiles.add( new SupportingFile( "gradlew.mustache", "", "gradlew") ); - supportingFiles.add( new SupportingFile( "gradlew.bat.mustache", "", "gradlew.bat") ); - supportingFiles.add( new SupportingFile( "gradle-wrapper.properties.mustache", - gradleWrapperPackage.replace( ".", File.separator ), "gradle-wrapper.properties") ); - supportingFiles.add( new SupportingFile( "gradle-wrapper.jar", - gradleWrapperPackage.replace( ".", File.separator ), "gradle-wrapper.jar") ); + } else if ("feign".equals(getLibrary())) { + supportingFiles.add(new SupportingFile("FormAwareEncoder.mustache", invokerFolder, "FormAwareEncoder.java")); } else if ("okhttp-gson".equals(getLibrary())) { - // generate markdown docs - modelDocTemplateFiles.put("model_doc.mustache", ".md"); - apiDocTemplateFiles.put("api_doc.mustache", ".md"); // the "okhttp-gson" library template requires "ApiCallback.mustache" for async call supportingFiles.add(new SupportingFile("ApiCallback.mustache", invokerFolder, "ApiCallback.java")); supportingFiles.add(new SupportingFile("ApiResponse.mustache", invokerFolder, "ApiResponse.java")); supportingFiles.add(new SupportingFile("JSON.mustache", invokerFolder, "JSON.java")); supportingFiles.add(new SupportingFile("ProgressRequestBody.mustache", invokerFolder, "ProgressRequestBody.java")); supportingFiles.add(new SupportingFile("ProgressResponseBody.mustache", invokerFolder, "ProgressResponseBody.java")); - // "build.sbt" is for development with SBT - supportingFiles.add(new SupportingFile("build.sbt.mustache", "", "build.sbt")); - - //gradleWrapper files - supportingFiles.add( new SupportingFile( "gradlew.mustache", "", "gradlew") ); - supportingFiles.add( new SupportingFile( "gradlew.bat.mustache", "", "gradlew.bat") ); - supportingFiles.add( new SupportingFile( "gradle-wrapper.properties.mustache", - gradleWrapperPackage.replace( ".", File.separator ), "gradle-wrapper.properties") ); - supportingFiles.add( new SupportingFile( "gradle-wrapper.jar", - gradleWrapperPackage.replace( ".", File.separator ), "gradle-wrapper.jar") ); } else if (usesAnyRetrofitLibrary()) { supportingFiles.add(new SupportingFile("auth/OAuthOkHttpClient.mustache", authFolder, "OAuthOkHttpClient.java")); supportingFiles.add(new SupportingFile("CollectionFormats.mustache", invokerFolder, "CollectionFormats.java")); - - //gradleWrapper files - supportingFiles.add( new SupportingFile( "gradlew.mustache", "", "gradlew") ); - supportingFiles.add( new SupportingFile( "gradlew.bat.mustache", "", "gradlew.bat") ); - supportingFiles.add( new SupportingFile( "gradle-wrapper.properties.mustache", - gradleWrapperPackage.replace( ".", File.separator ), "gradle-wrapper.properties") ); - supportingFiles.add( new SupportingFile( "gradle-wrapper.jar", - gradleWrapperPackage.replace( ".", File.separator ), "gradle-wrapper.jar") ); - // "build.sbt" is for development with SBT - supportingFiles.add(new SupportingFile("build.sbt.mustache", "", "build.sbt")); - - //generate markdown docs for retrofit2 - if ( usesRetrofit2Library() ){ - modelDocTemplateFiles.put("model_doc.mustache", ".md"); - apiDocTemplateFiles.put("api_doc.mustache", ".md"); - } - } else if("jersey2".equals(getLibrary())) { - // generate markdown docs - modelDocTemplateFiles.put("model_doc.mustache", ".md"); - apiDocTemplateFiles.put("api_doc.mustache", ".md"); supportingFiles.add(new SupportingFile("JSON.mustache", invokerFolder, "JSON.java")); - - //gradleWrapper files - supportingFiles.add( new SupportingFile( "gradlew.mustache", "", "gradlew") ); - supportingFiles.add( new SupportingFile( "gradlew.bat.mustache", "", "gradlew.bat") ); - supportingFiles.add( new SupportingFile( "gradle-wrapper.properties.mustache", - gradleWrapperPackage.replace( ".", File.separator ), "gradle-wrapper.properties") ); - supportingFiles.add( new SupportingFile( "gradle-wrapper.jar", - gradleWrapperPackage.replace( ".", File.separator ), "gradle-wrapper.jar") ); - // "build.sbt" is for development with SBT - supportingFiles.add(new SupportingFile("build.sbt.mustache", "", "build.sbt")); } - - if(additionalProperties.containsKey(DATE_LIBRARY)) { - setDateLibrary(additionalProperties.get(DATE_LIBRARY).toString()); - additionalProperties.put(dateLibrary, "true"); - } - - if("joda".equals(dateLibrary)) { - typeMapping.put("date", "LocalDate"); - typeMapping.put("DateTime", "DateTime"); - - importMapping.put("LocalDate", "org.joda.time.LocalDate"); - importMapping.put("DateTime", "org.joda.time.DateTime"); - } - else if (dateLibrary.startsWith("java8")) { - additionalProperties.put("java8", "true"); - typeMapping.put("date", "LocalDate"); - importMapping.put("LocalDate", "java.time.LocalDate"); - if ("java8-localdatetime".equals(dateLibrary)) { - typeMapping.put("DateTime", "LocalDateTime"); - importMapping.put("LocalDateTime", "java.time.LocalDateTime"); - } else { - typeMapping.put("DateTime", "OffsetDateTime"); - importMapping.put("OffsetDateTime", "java.time.OffsetDateTime"); - } - } - - supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh")); - supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore")); - } private boolean usesAnyRetrofitLibrary() { @@ -401,420 +138,9 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig { return getLibrary() != null && getLibrary().contains(RETROFIT_2); } - private void sanitizeConfig() { - // Sanitize any config options here. We also have to update the additionalProperties because - // the whole additionalProperties object is injected into the main object passed to the mustache layer - - this.setApiPackage(sanitizePackageName(apiPackage)); - if (additionalProperties.containsKey(CodegenConstants.API_PACKAGE)) { - this.additionalProperties.put(CodegenConstants.API_PACKAGE, apiPackage); - } - - this.setModelPackage(sanitizePackageName(modelPackage)); - if (additionalProperties.containsKey(CodegenConstants.MODEL_PACKAGE)) { - this.additionalProperties.put(CodegenConstants.MODEL_PACKAGE, modelPackage); - } - - this.setInvokerPackage(sanitizePackageName(invokerPackage)); - if (additionalProperties.containsKey(CodegenConstants.INVOKER_PACKAGE)) { - this.additionalProperties.put(CodegenConstants.INVOKER_PACKAGE, invokerPackage); - } - } - - @Override - public String escapeReservedWord(String name) { - return "_" + name; - } - - @Override - public String apiFileFolder() { - return outputFolder + "/" + sourceFolder + "/" + apiPackage().replace('.', '/'); - } - - @Override - public String apiTestFileFolder() { - return outputFolder + "/" + testFolder + "/" + apiPackage().replace('.', '/'); - } - - @Override - public String modelFileFolder() { - return outputFolder + "/" + sourceFolder + "/" + modelPackage().replace('.', '/'); - } - - @Override - public String apiDocFileFolder() { - return (outputFolder + "/" + apiDocPath).replace('/', File.separatorChar); - } - - @Override - public String modelDocFileFolder() { - return (outputFolder + "/" + modelDocPath).replace('/', File.separatorChar); - } - - @Override - public String toApiDocFilename(String name) { - return toApiName(name); - } - - @Override - public String toModelDocFilename(String name) { - return toModelName(name); - } - - @Override - public String toApiTestFilename(String name) { - return toApiName(name) + "Test"; - } - - @Override - public String toVarName(String name) { - // sanitize name - name = sanitizeName(name); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'. - - if ("class".equals(name.toLowerCase())) { - return "PropertyClass"; - } - - if("_".equals(name)) { - name = "_u"; - } - - // if it's all uppper case, do nothing - if (name.matches("^[A-Z_]*$")) { - return name; - } - - // camelize (lower first character) the variable name - // pet_id => petId - name = camelize(name, true); - - // for reserved word or word starting with number, append _ - if (isReservedWord(name) || name.matches("^\\d.*")) { - name = escapeReservedWord(name); - } - - return name; - } - - @Override - public String toParamName(String name) { - // should be the same as variable name - return toVarName(name); - } - - @Override - public String toModelName(final String name) { - final String sanitizedName = sanitizeName(modelNamePrefix + name + modelNameSuffix); - - // camelize the model name - // phone_number => PhoneNumber - final String camelizedName = camelize(sanitizedName); - - // model name cannot use reserved keyword, e.g. return - if (isReservedWord(camelizedName)) { - final String modelName = "Model" + camelizedName; - LOGGER.warn(camelizedName + " (reserved word) cannot be used as model name. Renamed to " + modelName); - return modelName; - } - - // model name starts with number - if (name.matches("^\\d.*")) { - final String modelName = "Model" + camelizedName; // e.g. 200Response => Model200Response (after camelize) - LOGGER.warn(name + " (model name starts with number) cannot be used as model name. Renamed to " + modelName); - return modelName; - } - - return camelizedName; - } - - @Override - public String toModelFilename(String name) { - // should be the same as the model name - return toModelName(name); - } - - @Override - public String getTypeDeclaration(Property p) { - if (p instanceof ArrayProperty) { - ArrayProperty ap = (ArrayProperty) p; - Property inner = ap.getItems(); - return getSwaggerType(p) + "<" + getTypeDeclaration(inner) + ">"; - } else if (p instanceof MapProperty) { - MapProperty mp = (MapProperty) p; - Property inner = mp.getAdditionalProperties(); - - return getSwaggerType(p) + ""; - } - return super.getTypeDeclaration(p); - } - - @Override - public String toDefaultValue(Property p) { - if (p instanceof ArrayProperty) { - final ArrayProperty ap = (ArrayProperty) p; - final String pattern; - if (fullJavaUtil) { - pattern = "new java.util.ArrayList<%s>()"; - } else { - pattern = "new ArrayList<%s>()"; - } - return String.format(pattern, getTypeDeclaration(ap.getItems())); - } else if (p instanceof MapProperty) { - final MapProperty ap = (MapProperty) p; - final String pattern; - if (fullJavaUtil) { - pattern = "new java.util.HashMap()"; - } else { - pattern = "new HashMap()"; - } - return String.format(pattern, getTypeDeclaration(ap.getAdditionalProperties())); - } else if (p instanceof IntegerProperty) { - IntegerProperty dp = (IntegerProperty) p; - if (dp.getDefault() != null) { - return dp.getDefault().toString(); - } - return "null"; - } else if (p instanceof LongProperty) { - LongProperty dp = (LongProperty) p; - if (dp.getDefault() != null) { - return dp.getDefault().toString()+"l"; - } - return "null"; - } else if (p instanceof DoubleProperty) { - DoubleProperty dp = (DoubleProperty) p; - if (dp.getDefault() != null) { - return dp.getDefault().toString() + "d"; - } - return "null"; - } else if (p instanceof FloatProperty) { - FloatProperty dp = (FloatProperty) p; - if (dp.getDefault() != null) { - return dp.getDefault().toString() + "f"; - } - return "null"; - } else if (p instanceof BooleanProperty) { - BooleanProperty bp = (BooleanProperty) p; - if (bp.getDefault() != null) { - return bp.getDefault().toString(); - } - return "null"; - } else if (p instanceof StringProperty) { - StringProperty sp = (StringProperty) p; - if (sp.getDefault() != null) { - String _default = sp.getDefault(); - if (sp.getEnum() == null) { - return "\"" + escapeText(_default) + "\""; - } else { - // convert to enum var name later in postProcessModels - return _default; - } - } - return "null"; - } - return super.toDefaultValue(p); - } - - @Override - public void setParameterExampleValue(CodegenParameter p) { - String example; - - if (p.defaultValue == null) { - example = p.example; - } else { - example = p.defaultValue; - } - - String type = p.baseType; - if (type == null) { - type = p.dataType; - } - - if ("String".equals(type)) { - if (example == null) { - example = p.paramName + "_example"; - } - example = "\"" + escapeText(example) + "\""; - } else if ("Integer".equals(type) || "Short".equals(type)) { - if (example == null) { - example = "56"; - } - } else if ("Long".equals(type)) { - if (example == null) { - example = "56"; - } - example = example + "L"; - } else if ("Float".equals(type)) { - if (example == null) { - example = "3.4"; - } - example = example + "F"; - } else if ("Double".equals(type)) { - example = "3.4"; - example = example + "D"; - } else if ("Boolean".equals(type)) { - if (example == null) { - example = "true"; - } - } else if ("File".equals(type)) { - if (example == null) { - example = "/path/to/file"; - } - example = "new File(\"" + escapeText(example) + "\")"; - } else if ("Date".equals(type)) { - example = "new Date()"; - } else if (!languageSpecificPrimitives.contains(type)) { - // type is a model class, e.g. User - example = "new " + type + "()"; - } - - if (example == null) { - example = "null"; - } else if (Boolean.TRUE.equals(p.isListContainer)) { - example = "Arrays.asList(" + example + ")"; - } else if (Boolean.TRUE.equals(p.isMapContainer)) { - example = "new HashMap()"; - } - - p.example = example; - } - - @Override - public String getSwaggerType(Property p) { - String swaggerType = super.getSwaggerType(p); - String type = null; - if (typeMapping.containsKey(swaggerType)) { - type = typeMapping.get(swaggerType); - if (languageSpecificPrimitives.contains(type) || type.indexOf(".") >= 0 || - type.equals("Map") || type.equals("List") || - type.equals("File") || type.equals("Date")) { - return type; - } - } else { - type = swaggerType; - } - if (null == type) { - LOGGER.error("No Type defined for Property " + p); - } - return toModelName(type); - } - - @Override - public String toOperationId(String operationId) { - // throw exception if method name is empty - if (StringUtils.isEmpty(operationId)) { - throw new RuntimeException("Empty method/operation name (operationId) not allowed"); - } - - operationId = camelize(sanitizeName(operationId), true); - - // method name cannot use reserved keyword, e.g. return - if (isReservedWord(operationId)) { - String newOperationId = camelize("call_" + operationId, true); - LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + newOperationId); - return newOperationId; - } - - return operationId; - } - - @Override - public CodegenModel fromModel(String name, Model model, Map allDefinitions) { - CodegenModel codegenModel = super.fromModel(name, model, allDefinitions); - if(codegenModel.description != null) { - codegenModel.imports.add("ApiModel"); - } - if (allDefinitions != null && codegenModel != null && codegenModel.parentSchema != null && codegenModel.hasEnums) { - final Model parentModel = allDefinitions.get(codegenModel.parentSchema); - final CodegenModel parentCodegenModel = super.fromModel(codegenModel.parent, parentModel); - codegenModel = JavaClientCodegen.reconcileInlineEnums(codegenModel, parentCodegenModel); - } - - return codegenModel; - } - - @Override - public Map postProcessModelsEnum(Map objs) { - objs = super.postProcessModelsEnum(objs); - String lib = getLibrary(); - if (StringUtils.isEmpty(lib) || "feign".equals(lib) || "jersey2".equals(lib)) { - List> imports = (List>)objs.get("imports"); - List models = (List) objs.get("models"); - for (Object _mo : models) { - Map mo = (Map) _mo; - CodegenModel cm = (CodegenModel) mo.get("model"); - // for enum model - if (Boolean.TRUE.equals(cm.isEnum) && cm.allowableValues != null) { - cm.imports.add(importMapping.get("JsonValue")); - Map item = new HashMap(); - item.put("import", importMapping.get("JsonValue")); - imports.add(item); - } - } - } - return objs; - } - - @Override - public void postProcessModelProperty(CodegenModel model, CodegenProperty property) { - if(serializeBigDecimalAsString) { - if (property.baseType.equals("BigDecimal")) { - // we serialize BigDecimal as `string` to avoid precision loss - property.vendorExtensions.put("extraAnnotation", "@JsonSerialize(using = ToStringSerializer.class)"); - - // this requires some more imports to be added for this model... - model.imports.add("ToStringSerializer"); - model.imports.add("JsonSerialize"); - } - } - - if ("array".equals(property.containerType)) { - model.imports.add("ArrayList"); - } else if ("map".equals(property.containerType)) { - model.imports.add("HashMap"); - } - - if(!BooleanUtils.toBoolean(model.isEnum)) { - // needed by all pojos, but not enums - model.imports.add("ApiModelProperty"); - model.imports.add("ApiModel"); - // comment out below as it's in the model template - //model.imports.add("Objects"); - - final String lib = getLibrary(); - if(StringUtils.isEmpty(lib) || "feign".equals(lib) || "jersey2".equals(lib)) { - model.imports.add("JsonProperty"); - - if(BooleanUtils.toBoolean(model.hasEnums)) { - model.imports.add("JsonValue"); - } - } - } - return; - } - - @Override - public void postProcessParameter(CodegenParameter parameter) { - return; - } - - @Override - public Map postProcessModels(Map objs) { - return postProcessModelsEnum(objs); - } - @Override public Map postProcessOperations(Map objs) { - // Remove imports of List, ArrayList, Map and HashMap as they are - // imported in the template already. - List> imports = (List>) objs.get("imports"); - Pattern pattern = Pattern.compile("java\\.util\\.(List|ArrayList|Map|HashMap)"); - for (Iterator> itr = imports.iterator(); itr.hasNext();) { - String _import = itr.next().get("import"); - if (pattern.matcher(_import).matches()) { - itr.remove(); - } - } - + super.postProcessOperations(objs); if(usesAnyRetrofitLibrary()) { Map operations = (Map) objs.get("operations"); if (operations != null) { @@ -839,208 +165,7 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig { return objs; } - @Override - public void preprocessSwagger(Swagger swagger) { - if (swagger != null && swagger.getPaths() != null) { - for (String pathname : swagger.getPaths().keySet()) { - Path path = swagger.getPath(pathname); - if (path.getOperations() != null) { - for (Operation operation : path.getOperations()) { - boolean hasFormParameters = false; - for (Parameter parameter : operation.getParameters()) { - if (parameter instanceof FormParameter) { - hasFormParameters = true; - } - } - - String defaultContentType = hasFormParameters ? "application/x-www-form-urlencoded" : "application/json"; - String contentType = operation.getConsumes() == null || operation.getConsumes().isEmpty() - ? defaultContentType : operation.getConsumes().get(0); - String accepts = getAccept(operation); - operation.setVendorExtension("x-contentType", contentType); - operation.setVendorExtension("x-accepts", accepts); - } - } - } - } - } - - private static String getAccept(Operation operation) { - String accepts = null; - String defaultContentType = "application/json"; - if (operation.getProduces() != null && !operation.getProduces().isEmpty()) { - StringBuilder sb = new StringBuilder(); - for (String produces : operation.getProduces()) { - if (defaultContentType.equalsIgnoreCase(produces)) { - accepts = defaultContentType; - break; - } else { - if (sb.length() > 0) { - sb.append(","); - } - sb.append(produces); - } - } - if (accepts == null) { - accepts = sb.toString(); - } - } else { - accepts = defaultContentType; - } - - return accepts; - } - - @Override - protected boolean needToImport(String type) { - return super.needToImport(type) && type.indexOf(".") < 0; - } -/* - @Override - public String findCommonPrefixOfVars(List vars) { - String prefix = StringUtils.getCommonPrefix(vars.toArray(new String[vars.size()])); - // exclude trailing characters that should be part of a valid variable - // e.g. ["status-on", "status-off"] => "status-" (not "status-o") - return prefix.replaceAll("[a-zA-Z0-9]+\\z", ""); - } -*/ - - @Override - public String toEnumName(CodegenProperty property) { - return sanitizeName(camelize(property.name)) + "Enum"; - } - - @Override - public String toEnumVarName(String value, String datatype) { - // number - if ("Integer".equals(datatype) || "Long".equals(datatype) || - "Float".equals(datatype) || "Double".equals(datatype)) { - String varName = "NUMBER_" + value; - varName = varName.replaceAll("-", "MINUS_"); - varName = varName.replaceAll("\\+", "PLUS_"); - varName = varName.replaceAll("\\.", "_DOT_"); - return varName; - } - - // string - String var = value.replaceAll("\\W+", "_").replaceAll("_+", "_").toUpperCase(); - if (var.matches("\\d.*")) { - return "_" + var; - } else { - return var; - } - } - - @Override - public String toEnumValue(String value, String datatype) { - if ("Integer".equals(datatype) || "Long".equals(datatype) || - "Float".equals(datatype) || "Double".equals(datatype)) { - return value; - } else { - return "\"" + escapeText(value) + "\""; - } - } - - private static CodegenModel reconcileInlineEnums(CodegenModel codegenModel, CodegenModel parentCodegenModel) { - // This generator uses inline classes to define enums, which breaks when - // dealing with models that have subTypes. To clean this up, we will analyze - // the parent and child models, look for enums that match, and remove - // them from the child models and leave them in the parent. - // Because the child models extend the parents, the enums will be available via the parent. - - // Only bother with reconciliation if the parent model has enums. - if (parentCodegenModel.hasEnums) { - - // Get the properties for the parent and child models - final List parentModelCodegenProperties = parentCodegenModel.vars; - List codegenProperties = codegenModel.vars; - - // Iterate over all of the parent model properties - boolean removedChildEnum = false; - for (CodegenProperty parentModelCodegenPropery : parentModelCodegenProperties) { - // Look for enums - if (parentModelCodegenPropery.isEnum) { - // Now that we have found an enum in the parent class, - // and search the child class for the same enum. - Iterator iterator = codegenProperties.iterator(); - while (iterator.hasNext()) { - CodegenProperty codegenProperty = iterator.next(); - if (codegenProperty.isEnum && codegenProperty.equals(parentModelCodegenPropery)) { - // We found an enum in the child class that is - // a duplicate of the one in the parent, so remove it. - iterator.remove(); - removedChildEnum = true; - } - } - } - } - - if(removedChildEnum) { - // If we removed an entry from this model's vars, we need to ensure hasMore is updated - int count = 0, numVars = codegenProperties.size(); - for(CodegenProperty codegenProperty : codegenProperties) { - count += 1; - codegenProperty.hasMore = (count < numVars) ? true : null; - } - codegenModel.vars = codegenProperties; - } - } - - return codegenModel; - } - - public void setInvokerPackage(String invokerPackage) { - this.invokerPackage = invokerPackage; - } - - public void setGroupId(String groupId) { - this.groupId = groupId; - } - - public void setArtifactId(String artifactId) { - this.artifactId = artifactId; - } - - public void setArtifactVersion(String artifactVersion) { - this.artifactVersion = artifactVersion; - } - - public void setSourceFolder(String sourceFolder) { - this.sourceFolder = sourceFolder; - } - - public void setLocalVariablePrefix(String localVariablePrefix) { - this.localVariablePrefix = localVariablePrefix; - } - - public void setSerializeBigDecimalAsString(boolean s) { - this.serializeBigDecimalAsString = s; - } - - public Boolean getSerializableModel() { - return serializableModel; - } - - public void setSerializableModel(Boolean serializableModel) { - this.serializableModel = serializableModel; - } - - private static String sanitizePackageName(String packageName) { - packageName = packageName.trim(); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'. - packageName = packageName.replaceAll("[^a-zA-Z0-9_\\.]", "_"); - if(Strings.isNullOrEmpty(packageName)) { - return "invalidPackageName"; - } - return packageName; - } - - public void setFullJavaUtil(boolean fullJavaUtil) { - this.fullJavaUtil = fullJavaUtil; - } - public void setUseRxJava(boolean useRxJava) { this.useRxJava = useRxJava; } - - public void setDateLibrary(String library) { this.dateLibrary = library; } } diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaInflectorServerCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaInflectorServerCodegen.java index 8a08bf758a3..f586a11baf0 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaInflectorServerCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaInflectorServerCodegen.java @@ -4,16 +4,13 @@ import com.fasterxml.jackson.core.JsonProcessingException; import io.swagger.codegen.*; import io.swagger.models.Operation; import io.swagger.models.Swagger; -import io.swagger.models.properties.ArrayProperty; -import io.swagger.models.properties.MapProperty; -import io.swagger.models.properties.Property; import io.swagger.util.Yaml; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.*; -public class JavaInflectorServerCodegen extends JavaClientCodegen { +public class JavaInflectorServerCodegen extends AbstractJavaCodegen { private static final Logger LOGGER = LoggerFactory.getLogger(JavaInflectorServerCodegen.class); @@ -23,34 +20,23 @@ public class JavaInflectorServerCodegen extends JavaClientCodegen { super(); sourceFolder = "src/gen/java"; - modelTemplateFiles.put("model.mustache", ".java"); - apiTemplateFiles.put("api.mustache", ".java"); apiTestTemplateFiles.clear(); // TODO: add test template embeddedTemplateDir = templateDir = "JavaInflector"; invokerPackage = "io.swagger.handler"; artifactId = "swagger-inflector-server"; - dateLibrary = "legacy"; + dateLibrary = "legacy"; //TODO: add joda support + + // clear model and api doc template as this codegen + // does not support auto-generated markdown doc at the moment + //TODO: add doc templates + modelDocTemplateFiles.remove("model_doc.mustache"); + apiDocTemplateFiles.remove("api_doc.mustache"); + apiPackage = System.getProperty("swagger.codegen.inflector.apipackage", "io.swagger.handler"); modelPackage = System.getProperty("swagger.codegen.inflector.modelpackage", "io.swagger.model"); - additionalProperties.put(CodegenConstants.INVOKER_PACKAGE, invokerPackage); - additionalProperties.put(CodegenConstants.GROUP_ID, groupId); - additionalProperties.put(CodegenConstants.ARTIFACT_ID, artifactId); - additionalProperties.put(CodegenConstants.ARTIFACT_VERSION, artifactVersion); additionalProperties.put("title", title); - - languageSpecificPrimitives = new HashSet( - Arrays.asList( - "byte[]", - "String", - "boolean", - "Boolean", - "Double", - "Integer", - "Long", - "Float") - ); } @Override @@ -72,12 +58,6 @@ public class JavaInflectorServerCodegen extends JavaClientCodegen { public void processOpts() { super.processOpts(); - // clear model and api doc template as this codegen - // does not support auto-generated markdown doc at the moment - modelDocTemplateFiles.remove("model_doc.mustache"); - apiDocTemplateFiles.remove("api_doc.mustache"); - - supportingFiles.clear(); writeOptional(outputFolder, new SupportingFile("pom.mustache", "", "pom.xml")); writeOptional(outputFolder, new SupportingFile("README.mustache", "", "README.md")); writeOptional(outputFolder, new SupportingFile("web.mustache", "src/main/webapp/WEB-INF", "web.xml")); diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaJerseyServerCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaJerseyServerCodegen.java index f6c3f861e49..f543b29903b 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaJerseyServerCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaJerseyServerCodegen.java @@ -3,7 +3,6 @@ package io.swagger.codegen.languages; import io.swagger.codegen.*; import io.swagger.models.Operation; -import java.io.File; import java.util.*; import org.apache.commons.lang3.StringUtils; @@ -12,31 +11,21 @@ public class JavaJerseyServerCodegen extends AbstractJavaJAXRSServerCodegen { public JavaJerseyServerCodegen() { super(); - sourceFolder = "src/gen/java"; - invokerPackage = "io.swagger.api"; - artifactId = "swagger-jaxrs-server"; outputFolder = "generated-code/JavaJaxRS-Jersey"; - modelTemplateFiles.put("model.mustache", ".java"); - apiTemplateFiles.put("api.mustache", ".java"); apiTemplateFiles.put("apiService.mustache", ".java"); apiTemplateFiles.put("apiServiceImpl.mustache", ".java"); apiTemplateFiles.put("apiServiceFactory.mustache", ".java"); + apiTestTemplateFiles.clear(); // TODO: add test template - apiPackage = "io.swagger.api"; - modelPackage = "io.swagger.model"; - - additionalProperties.put("title", title); + // clear model and api doc template as this codegen + // does not support auto-generated markdown doc at the moment + //TODO: add doc templates + modelDocTemplateFiles.remove("model_doc.mustache"); + apiDocTemplateFiles.remove("api_doc.mustache"); embeddedTemplateDir = templateDir = JAXRS_TEMPLATE_DIRECTORY_NAME; - for ( int i = 0; i < cliOptions.size(); i++ ) { - if ( CodegenConstants.LIBRARY.equals(cliOptions.get(i).getOpt()) ) { - cliOptions.remove(i); - break; - } - } - CliOption library = new CliOption(CodegenConstants.LIBRARY, "library template (sub-template) to use"); supportedLibraries.put("jersey1", "Jersey core 1.x"); @@ -45,8 +34,7 @@ public class JavaJerseyServerCodegen extends AbstractJavaJAXRSServerCodegen { library.setDefault("jersey1"); cliOptions.add(library); - cliOptions.add(new CliOption(CodegenConstants.IMPL_FOLDER, CodegenConstants.IMPL_FOLDER_DESC)); - cliOptions.add(new CliOption("title", "a title describing the application")); + } @Override @@ -78,13 +66,6 @@ public class JavaJerseyServerCodegen extends AbstractJavaJAXRSServerCodegen { setLibrary("jersey2"); } - supportingFiles.clear(); - - // clear model and api doc template as this codegen - // does not support auto-generated markdown doc at the moment - modelDocTemplateFiles.remove("model_doc.mustache"); - apiDocTemplateFiles.remove("api_doc.mustache"); - if ( additionalProperties.containsKey(CodegenConstants.IMPL_FOLDER)) { implFolder = (String) additionalProperties.get(CodegenConstants.IMPL_FOLDER); } @@ -137,7 +118,4 @@ public class JavaJerseyServerCodegen extends AbstractJavaJAXRSServerCodegen { co.baseName = basePath; } - public void hideGenerationTimestamp(boolean hideGenerationTimestamp) { - this.hideGenerationTimestamp = hideGenerationTimestamp; - } } diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaResteasyServerCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaResteasyServerCodegen.java index 33803b087b8..d77a4f32067 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaResteasyServerCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaResteasyServerCodegen.java @@ -2,66 +2,34 @@ package io.swagger.codegen.languages; import io.swagger.codegen.*; import io.swagger.models.Operation; -import io.swagger.models.Path; -import io.swagger.models.Swagger; import org.apache.commons.lang3.StringUtils; import java.io.File; import java.util.*; -public class JavaResteasyServerCodegen extends JavaClientCodegen implements CodegenConfig { - - protected String dateLibrary = "default"; - protected String title = "Swagger Server"; - protected String implFolder = "src/main/java"; - - public static final String DATE_LIBRARY = "dateLibrary"; +public class JavaResteasyServerCodegen extends AbstractJavaJAXRSServerCodegen { public JavaResteasyServerCodegen() { super(); - sourceFolder = "src/gen/java"; - invokerPackage = "io.swagger.api"; artifactId = "swagger-jaxrs-resteasy-server"; outputFolder = "generated-code/javaJaxRS"; - modelTemplateFiles.put("model.mustache", ".java"); - apiTemplateFiles.put("api.mustache", ".java"); apiTemplateFiles.put("apiService.mustache", ".java"); apiTemplateFiles.put("apiServiceImpl.mustache", ".java"); apiTemplateFiles.put("apiServiceFactory.mustache", ".java"); apiTestTemplateFiles.clear(); // TODO: add test template - apiPackage = "io.swagger.api"; - modelPackage = "io.swagger.model"; - dateLibrary = "legacy"; - additionalProperties.put("title", title); + // clear model and api doc template as AbstractJavaJAXRSServerCodegen + // does not support auto-generated markdown doc at the moment + //TODO: add doc templates + modelDocTemplateFiles.remove("model_doc.mustache"); + apiDocTemplateFiles.remove("api_doc.mustache"); + + dateLibrary = "legacy";// TODO: change to joda embeddedTemplateDir = templateDir = "JavaJaxRS" + File.separator + "resteasy"; - - for (int i = 0; i < cliOptions.size(); i++) { - if (CodegenConstants.LIBRARY.equals(cliOptions.get(i).getOpt())) { - cliOptions.remove(i); - break; - } - } - - CliOption library = new CliOption(CodegenConstants.LIBRARY, "library template (sub-template) to use"); - library.setDefault(DEFAULT_LIBRARY); - - Map supportedLibraries = new LinkedHashMap(); - - supportedLibraries.put(DEFAULT_LIBRARY, "Resteasy core 3.0.11"); - library.setEnum(supportedLibraries); - - cliOptions.add(library); - cliOptions.add(new CliOption(CodegenConstants.IMPL_FOLDER, CodegenConstants.IMPL_FOLDER_DESC)); - } - - @Override - public CodegenType getTag() { - return CodegenType.SERVER; } @Override @@ -78,16 +46,6 @@ public class JavaResteasyServerCodegen extends JavaClientCodegen implements Code public void processOpts() { super.processOpts(); - // clear model and api doc template as AbstractJavaJAXRSServerCodegen - // does not support auto-generated markdown doc at the moment - modelDocTemplateFiles.remove("model_doc.mustache"); - apiDocTemplateFiles.remove("api_doc.mustache"); - - if (additionalProperties.containsKey(CodegenConstants.IMPL_FOLDER)) { - implFolder = (String) additionalProperties.get(CodegenConstants.IMPL_FOLDER); - } - - supportingFiles.clear(); writeOptional(outputFolder, new SupportingFile("pom.mustache", "", "pom.xml")); writeOptional(outputFolder, new SupportingFile("gradle.mustache", "", "build.gradle")); writeOptional(outputFolder, new SupportingFile("settingsGradle.mustache", "", "settings.gradle")); @@ -152,51 +110,6 @@ public class JavaResteasyServerCodegen extends JavaClientCodegen implements Code co.baseName = basePath; } - - @Override - public void preprocessSwagger(Swagger swagger) { - if ("/".equals(swagger.getBasePath())) { - swagger.setBasePath(""); - } - - String host = swagger.getHost(); - String port = "8080"; - if (host != null) { - String[] parts = host.split(":"); - if (parts.length > 1) { - port = parts[1]; - } - } - this.additionalProperties.put("serverPort", port); - if (swagger != null && swagger.getPaths() != null) { - for (String pathname : swagger.getPaths().keySet()) { - Path path = swagger.getPath(pathname); - if (path.getOperations() != null) { - for (Operation operation : path.getOperations()) { - if (operation.getTags() != null) { - List> tags = new ArrayList>(); - for (String tag : operation.getTags()) { - Map value = new HashMap(); - value.put("tag", tag); - value.put("hasMore", "true"); - tags.add(value); - } - if (tags.size() > 0) { - tags.get(tags.size() - 1).remove("hasMore"); - } - if (operation.getTags().size() > 0) { - String tag = operation.getTags().get(0); - operation.setTags(Arrays.asList(tag)); - } - operation.setVendorExtension("x-tags", tags); - } - } - } - } - } - } - - @Override public Map postProcessOperations(Map objs) { @@ -249,53 +162,6 @@ public class JavaResteasyServerCodegen extends JavaClientCodegen implements Code return objs; } - @Override - public String toApiName(String name) { - if (name.length() == 0) { - return "DefaultApi"; - } - name = sanitizeName(name); - return camelize(name) + "Api"; - } - - - @Override - public String apiFilename(String templateName, String tag) { - - String result = super.apiFilename(templateName, tag); - - if (templateName.endsWith("Impl.mustache")) { - int ix = result.lastIndexOf('/'); - result = result.substring(0, ix) + "/impl" + result.substring(ix, result.length() - 5) + "ServiceImpl.java"; - - result = result.replace(apiFileFolder(), implFileFolder(implFolder)); - } else if (templateName.endsWith("Factory.mustache")) { - int ix = result.lastIndexOf('/'); - result = result.substring(0, ix) + "/factories" + result.substring(ix, result.length() - 5) + "ServiceFactory.java"; - - result = result.replace(apiFileFolder(), implFileFolder(implFolder)); - } else if (templateName.endsWith("Service.mustache")) { - int ix = result.lastIndexOf('.'); - result = result.substring(0, ix) + "Service.java"; - } - - return result; - } - - - private String implFileFolder(String output) { - return outputFolder + "/" + output + "/" + apiPackage().replace('.', '/'); - } - - @Override - public boolean shouldOverwrite(String filename) { - return super.shouldOverwrite(filename) && !filename.endsWith("ServiceImpl.java") && !filename.endsWith("ServiceFactory.java"); - } - - public void setDateLibrary(String library) { - this.dateLibrary = library; - } - @Override public void postProcessModelProperty(CodegenModel model, CodegenProperty property) { if(serializeBigDecimalAsString) { diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SpringBootServerCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SpringBootServerCodegen.java index 4b30062d799..577b1bc3b93 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SpringBootServerCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SpringBootServerCodegen.java @@ -7,7 +7,7 @@ import io.swagger.models.Swagger; import java.io.File; import java.util.*; -public class SpringBootServerCodegen extends JavaClientCodegen implements CodegenConfig{ +public class SpringBootServerCodegen extends AbstractJavaCodegen { public static final String CONFIG_PACKAGE = "configPackage"; public static final String BASE_PACKAGE = "basePackage"; public static final String INTERFACE_ONLY = "interfaceOnly"; @@ -15,33 +15,24 @@ public class SpringBootServerCodegen extends JavaClientCodegen implements Codege public static final String JAVA_8 = "java8"; public static final String ASYNC = "async"; protected String title = "Petstore Server"; - protected String configPackage = ""; - protected String basePackage = ""; + protected String configPackage = "io.swagger.configuration"; + protected String basePackage = "io.swagger"; protected boolean interfaceOnly = false; protected boolean singleContentTypes = false; protected boolean java8 = false; protected boolean async = false; - protected String templateFileName = "api.mustache"; public SpringBootServerCodegen() { super(); outputFolder = "generated-code/javaSpringBoot"; - apiTemplateFiles.put(templateFileName, ".java"); apiTestTemplateFiles.clear(); // TODO: add test template embeddedTemplateDir = templateDir = "JavaSpringBoot"; apiPackage = "io.swagger.api"; modelPackage = "io.swagger.model"; - configPackage = "io.swagger.configuration"; invokerPackage = "io.swagger.api"; - basePackage = "io.swagger"; artifactId = "swagger-springboot-server"; - additionalProperties.put(CodegenConstants.INVOKER_PACKAGE, invokerPackage); - additionalProperties.put(CodegenConstants.GROUP_ID, groupId); - additionalProperties.put(CodegenConstants.ARTIFACT_ID, artifactId); - additionalProperties.put(CodegenConstants.ARTIFACT_VERSION, artifactVersion); additionalProperties.put("title", title); - additionalProperties.put(CodegenConstants.API_PACKAGE, apiPackage); additionalProperties.put(CONFIG_PACKAGE, configPackage); additionalProperties.put(BASE_PACKAGE, basePackage); @@ -52,7 +43,6 @@ public class SpringBootServerCodegen extends JavaClientCodegen implements Codege cliOptions.add(CliOption.newBoolean(JAVA_8, "use java8 default interface")); cliOptions.add(CliOption.newBoolean(ASYNC, "use async Callable controllers")); - supportedLibraries.clear(); supportedLibraries.put(DEFAULT_LIBRARY, "Default Spring Boot server stub."); supportedLibraries.put("j8-async", "Use async servlet feature and Java 8's default interface. Generating interface with service " + "declaration is useful when using Maven plugin. Just provide a implementation with @Controller to instantiate service." + @@ -80,6 +70,7 @@ public class SpringBootServerCodegen extends JavaClientCodegen implements Codege // clear model and api doc template as this codegen // does not support auto-generated markdown doc at the moment + //TODO: add doc templates modelDocTemplateFiles.remove("model_doc.mustache"); apiDocTemplateFiles.remove("api_doc.mustache"); @@ -107,7 +98,6 @@ public class SpringBootServerCodegen extends JavaClientCodegen implements Codege this.setAsync(Boolean.valueOf(additionalProperties.get(ASYNC).toString())); } - supportingFiles.clear(); supportingFiles.add(new SupportingFile("pom.mustache", "", "pom.xml")); supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")); diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/api.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/api.mustache index c3b3bb66908..48ac02fed77 100644 --- a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/api.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/api.mustache @@ -1,4 +1,4 @@ -package {{apiPackage}}; +package {{package}}; {{#imports}}import {{import}}; {{/imports}} diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/apiController.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/apiController.mustache index f9c03faafc1..2540bb75d79 100644 --- a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/apiController.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaSpringBoot/apiController.mustache @@ -1,4 +1,4 @@ -package {{apiPackage}}; +package {{package}}; {{^java8}} {{#imports}}import {{import}}; From d4c961798ec822cdf0f0b338cb8863561e6d29ed Mon Sep 17 00:00:00 2001 From: cbornet Date: Wed, 15 Jun 2016 23:20:37 +0200 Subject: [PATCH 12/16] fix tests --- .../languages/SpringBootServerCodegen.java | 7 ++++++ .../JavaInflectorServerOptionsTest.java | 5 ++-- .../codegen/java/JavaClientOptionsTest.java | 5 ++-- .../codegen/jaxrs/JaxRSServerOptionsTest.java | 3 ++- .../options/JavaClientOptionsProvider.java | 23 +++++++++++++++++++ .../codegen/options/JavaOptionsProvider.java | 3 --- .../options/JaxRSServerOptionsProvider.java | 1 - .../SpringMVCServerOptionsProvider.java | 2 ++ .../SpringBootServerOptionsTest.java | 4 ++-- .../springmvc/SpringMVCServerOptionsTest.java | 3 ++- 10 files changed, 43 insertions(+), 13 deletions(-) create mode 100644 modules/swagger-codegen/src/test/java/io/swagger/codegen/options/JavaClientOptionsProvider.java diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SpringBootServerCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SpringBootServerCodegen.java index 577b1bc3b93..3cdefc4e437 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SpringBootServerCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SpringBootServerCodegen.java @@ -47,6 +47,13 @@ public class SpringBootServerCodegen extends AbstractJavaCodegen { supportedLibraries.put("j8-async", "Use async servlet feature and Java 8's default interface. Generating interface with service " + "declaration is useful when using Maven plugin. Just provide a implementation with @Controller to instantiate service." + "(DEPRECATED: use -Djava8=true,async=true instead)"); + + CliOption library = new CliOption(CodegenConstants.LIBRARY, "library template (sub-template) to use"); + library.setDefault(DEFAULT_LIBRARY); + library.setEnum(supportedLibraries); + library.setDefault(DEFAULT_LIBRARY); + cliOptions.add(library); + } @Override diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/inflector/JavaInflectorServerOptionsTest.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/inflector/JavaInflectorServerOptionsTest.java index 0987a0d236e..4d020f0591b 100644 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/inflector/JavaInflectorServerOptionsTest.java +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/inflector/JavaInflectorServerOptionsTest.java @@ -1,5 +1,6 @@ package io.swagger.codegen.inflector; +import io.swagger.codegen.AbstractOptionsTest; import io.swagger.codegen.CodegenConfig; import io.swagger.codegen.java.JavaClientOptionsTest; import io.swagger.codegen.languages.JavaInflectorServerCodegen; @@ -7,7 +8,7 @@ import io.swagger.codegen.options.JavaInflectorServerOptionsProvider; import mockit.Expectations; import mockit.Tested; -public class JavaInflectorServerOptionsTest extends JavaClientOptionsTest { +public class JavaInflectorServerOptionsTest extends AbstractOptionsTest { @Tested private JavaInflectorServerCodegen clientCodegen; @@ -45,8 +46,6 @@ public class JavaInflectorServerOptionsTest extends JavaClientOptionsTest { times = 1; clientCodegen.setSerializableModel(Boolean.valueOf(JavaInflectorServerOptionsProvider.SERIALIZABLE_MODEL_VALUE)); times = 1; - clientCodegen.setLibrary(JavaInflectorServerOptionsProvider.DEFAULT_LIBRARY_VALUE); - times = 1; clientCodegen.setFullJavaUtil(Boolean.valueOf(JavaInflectorServerOptionsProvider.FULL_JAVA_UTIL_VALUE)); times = 1; clientCodegen.setSerializeBigDecimalAsString(true); diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/java/JavaClientOptionsTest.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/java/JavaClientOptionsTest.java index 701f9586eec..aea42d72401 100644 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/java/JavaClientOptionsTest.java +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/java/JavaClientOptionsTest.java @@ -2,6 +2,7 @@ package io.swagger.codegen.java; import io.swagger.codegen.AbstractOptionsTest; import io.swagger.codegen.CodegenConfig; +import io.swagger.codegen.options.JavaClientOptionsProvider; import io.swagger.codegen.options.JavaOptionsProvider; import io.swagger.codegen.languages.JavaClientCodegen; import io.swagger.codegen.options.OptionsProvider; @@ -15,7 +16,7 @@ public class JavaClientOptionsTest extends AbstractOptionsTest { private JavaClientCodegen clientCodegen; public JavaClientOptionsTest() { - super(new JavaOptionsProvider()); + super(new JavaClientOptionsProvider()); } protected JavaClientOptionsTest(OptionsProvider optionsProvider) { @@ -51,7 +52,7 @@ public class JavaClientOptionsTest extends AbstractOptionsTest { times = 1; clientCodegen.setSerializableModel(Boolean.valueOf(JavaOptionsProvider.SERIALIZABLE_MODEL_VALUE)); times = 1; - clientCodegen.setLibrary(JavaOptionsProvider.DEFAULT_LIBRARY_VALUE); + clientCodegen.setLibrary(JavaClientOptionsProvider.DEFAULT_LIBRARY_VALUE); times = 1; clientCodegen.setFullJavaUtil(Boolean.valueOf(JavaOptionsProvider.FULL_JAVA_UTIL_VALUE)); times = 1; diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/jaxrs/JaxRSServerOptionsTest.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/jaxrs/JaxRSServerOptionsTest.java index 51dcd5fc90d..7753c8e45da 100644 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/jaxrs/JaxRSServerOptionsTest.java +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/jaxrs/JaxRSServerOptionsTest.java @@ -1,5 +1,6 @@ package io.swagger.codegen.jaxrs; +import io.swagger.codegen.AbstractOptionsTest; import io.swagger.codegen.CodegenConfig; import io.swagger.codegen.java.JavaClientOptionsTest; import io.swagger.codegen.languages.JavaJerseyServerCodegen; @@ -8,7 +9,7 @@ import io.swagger.codegen.options.JaxRSServerOptionsProvider; import mockit.Expectations; import mockit.Tested; -public class JaxRSServerOptionsTest extends JavaClientOptionsTest { +public class JaxRSServerOptionsTest extends AbstractOptionsTest { @Tested private JavaJerseyServerCodegen clientCodegen; diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/JavaClientOptionsProvider.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/JavaClientOptionsProvider.java new file mode 100644 index 00000000000..53cfe826d36 --- /dev/null +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/JavaClientOptionsProvider.java @@ -0,0 +1,23 @@ +package io.swagger.codegen.options; + +import com.google.common.collect.ImmutableMap; +import io.swagger.codegen.CodegenConstants; +import io.swagger.codegen.languages.JavaClientCodegen; + +import java.util.HashMap; +import java.util.Map; + +public class JavaClientOptionsProvider extends JavaOptionsProvider { + + public static final String DEFAULT_LIBRARY_VALUE = "jersey2"; + + @Override + public Map createOptions() { + Map options = new HashMap(super.createOptions()); + options.put(CodegenConstants.LIBRARY, DEFAULT_LIBRARY_VALUE); + options.put(JavaClientCodegen.USE_RX_JAVA, "false"); + + return options; + } + +} diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/JavaOptionsProvider.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/JavaOptionsProvider.java index d2b51b06fe4..468eb5c972f 100644 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/JavaOptionsProvider.java +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/JavaOptionsProvider.java @@ -16,7 +16,6 @@ public class JavaOptionsProvider implements OptionsProvider { public static final String ARTIFACT_VERSION_VALUE = "1.0.0-SNAPSHOT"; public static final String SOURCE_FOLDER_VALUE = "src/main/java/test"; public static final String LOCAL_PREFIX_VALUE = "tst"; - public static final String DEFAULT_LIBRARY_VALUE = "jersey2"; public static final String SERIALIZABLE_MODEL_VALUE = "false"; public static final String FULL_JAVA_UTIL_VALUE = "true"; public static final String ENSURE_UNIQUE_PARAMS_VALUE = "true"; @@ -40,9 +39,7 @@ public class JavaOptionsProvider implements OptionsProvider { .put(CodegenConstants.LOCAL_VARIABLE_PREFIX, LOCAL_PREFIX_VALUE) .put(CodegenConstants.SERIALIZABLE_MODEL, SERIALIZABLE_MODEL_VALUE) .put(JavaClientCodegen.FULL_JAVA_UTIL, FULL_JAVA_UTIL_VALUE) - .put(CodegenConstants.LIBRARY, DEFAULT_LIBRARY_VALUE) .put(CodegenConstants.SERIALIZE_BIG_DECIMAL_AS_STRING, "true") - .put(JavaClientCodegen.USE_RX_JAVA, "false") .put(JavaClientCodegen.DATE_LIBRARY, "joda") .put("hideGenerationTimestamp", "true") .build(); diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/JaxRSServerOptionsProvider.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/JaxRSServerOptionsProvider.java index 3006ed396c9..230084c2ec9 100644 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/JaxRSServerOptionsProvider.java +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/JaxRSServerOptionsProvider.java @@ -54,7 +54,6 @@ public class JaxRSServerOptionsProvider implements OptionsProvider { .put(JavaClientCodegen.FULL_JAVA_UTIL, FULL_JAVA_UTIL_VALUE) .put(CodegenConstants.LIBRARY, JAXRS_DEFAULT_LIBRARY_VALUE) .put(CodegenConstants.SERIALIZE_BIG_DECIMAL_AS_STRING, "true") - .put(JavaClientCodegen.USE_RX_JAVA, "false") //.put(JavaClientCodegen.DATE_LIBRARY, "joda") .put("hideGenerationTimestamp", "true"); diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/SpringMVCServerOptionsProvider.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/SpringMVCServerOptionsProvider.java index a9d77c40393..0755b4380f6 100644 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/SpringMVCServerOptionsProvider.java +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/SpringMVCServerOptionsProvider.java @@ -20,6 +20,8 @@ public class SpringMVCServerOptionsProvider extends JavaOptionsProvider { Map options = new HashMap(super.createOptions()); options.put(SpringMVCServerCodegen.CONFIG_PACKAGE, CONFIG_PACKAGE_VALUE); options.put(CodegenConstants.LIBRARY, LIBRARY_VALUE); + options.put(SpringMVCServerCodegen.USE_RX_JAVA, "false"); + return options; } diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/springboot/SpringBootServerOptionsTest.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/springboot/SpringBootServerOptionsTest.java index 376a44a60b8..90610924bfa 100644 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/springboot/SpringBootServerOptionsTest.java +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/springboot/SpringBootServerOptionsTest.java @@ -1,14 +1,14 @@ package io.swagger.codegen.springboot; +import io.swagger.codegen.AbstractOptionsTest; import io.swagger.codegen.CodegenConfig; -import io.swagger.codegen.java.JavaClientOptionsTest; import io.swagger.codegen.languages.SpringBootServerCodegen; import io.swagger.codegen.options.SpringBootServerOptionsProvider; import mockit.Expectations; import mockit.Tested; -public class SpringBootServerOptionsTest extends JavaClientOptionsTest { +public class SpringBootServerOptionsTest extends AbstractOptionsTest { @Tested private SpringBootServerCodegen clientCodegen; diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/springmvc/SpringMVCServerOptionsTest.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/springmvc/SpringMVCServerOptionsTest.java index c24162c1a3c..c53a4e4941c 100644 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/springmvc/SpringMVCServerOptionsTest.java +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/springmvc/SpringMVCServerOptionsTest.java @@ -1,5 +1,6 @@ package io.swagger.codegen.springmvc; +import io.swagger.codegen.AbstractOptionsTest; import io.swagger.codegen.CodegenConfig; import io.swagger.codegen.java.JavaClientOptionsTest; import io.swagger.codegen.languages.SpringMVCServerCodegen; @@ -8,7 +9,7 @@ import io.swagger.codegen.options.SpringMVCServerOptionsProvider; import mockit.Expectations; import mockit.Tested; -public class SpringMVCServerOptionsTest extends JavaClientOptionsTest { +public class SpringMVCServerOptionsTest extends AbstractOptionsTest { @Tested private SpringMVCServerCodegen clientCodegen; From 6c5def69364051000a7463473f4c3d1b09ac6ed2 Mon Sep 17 00:00:00 2001 From: cbornet Date: Thu, 16 Jun 2016 10:43:50 +0200 Subject: [PATCH 13/16] fix missing java client library files --- .../languages/AbstractJavaCodegen.java | 33 --- .../languages/JavaCXFServerCodegen.java | 2 - .../codegen/languages/JavaClientCodegen.java | 52 ++++- .../languages/JavaInflectorServerCodegen.java | 38 ++++ .../languages/JavaJerseyServerCodegen.java | 32 +++ .../languages/JavaResteasyServerCodegen.java | 46 ++-- .../languages/SpringBootServerCodegen.java | 38 ++++ .../libraries/jersey1/model.mustache | 2 - .../petstore/groovy/.swagger-codegen-ignore | 23 ++ samples/client/petstore/groovy/LICENSE | 201 ++++++++++++++++++ .../main/groovy/io/swagger/api/PetApi.groovy | 2 +- .../groovy/io/swagger/model/Category.groovy | 1 - .../io/swagger/model/ModelApiResponse.groovy | 1 - .../main/groovy/io/swagger/model/Order.groovy | 2 - .../main/groovy/io/swagger/model/Pet.groovy | 2 - .../main/groovy/io/swagger/model/Tag.groovy | 1 - .../main/groovy/io/swagger/model/User.groovy | 1 - .../gen/java/io/swagger/model/Category.java | 3 +- .../io/swagger/model/ModelApiResponse.java | 3 +- .../src/gen/java/io/swagger/model/Order.java | 2 +- .../src/gen/java/io/swagger/model/Pet.java | 2 +- .../src/gen/java/io/swagger/model/Tag.java | 3 +- .../src/gen/java/io/swagger/model/User.java | 3 +- .../gen/java/io/swagger/model/Category.java | 1 - .../io/swagger/model/ModelApiResponse.java | 1 - .../src/gen/java/io/swagger/model/Tag.java | 1 - .../src/gen/java/io/swagger/model/User.java | 1 - 27 files changed, 412 insertions(+), 85 deletions(-) create mode 100644 samples/client/petstore/groovy/.swagger-codegen-ignore create mode 100644 samples/client/petstore/groovy/LICENSE diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractJavaCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractJavaCodegen.java index 3157a258ac7..d8ac36e78bd 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractJavaCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractJavaCodegen.java @@ -570,28 +570,6 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code return codegenModel; } - @Override - public Map postProcessModelsEnum(Map objs) { - objs = super.postProcessModelsEnum(objs); - String lib = getLibrary(); - if (StringUtils.isEmpty(lib) || "feign".equals(lib) || "jersey2".equals(lib)) { - List> imports = (List>)objs.get("imports"); - List models = (List) objs.get("models"); - for (Object _mo : models) { - Map mo = (Map) _mo; - CodegenModel cm = (CodegenModel) mo.get("model"); - // for enum model - if (Boolean.TRUE.equals(cm.isEnum) && cm.allowableValues != null) { - cm.imports.add(importMapping.get("JsonValue")); - Map item = new HashMap(); - item.put("import", importMapping.get("JsonValue")); - imports.add(item); - } - } - } - return objs; - } - @Override public void postProcessModelProperty(CodegenModel model, CodegenProperty property) { if(serializeBigDecimalAsString) { @@ -615,17 +593,6 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code // needed by all pojos, but not enums model.imports.add("ApiModelProperty"); model.imports.add("ApiModel"); - // comment out below as it's in the model template - //model.imports.add("Objects"); - - final String lib = getLibrary(); - if(StringUtils.isEmpty(lib) || "feign".equals(lib) || "jersey2".equals(lib)) { - model.imports.add("JsonProperty"); - - if(BooleanUtils.toBoolean(model.hasEnums)) { - model.imports.add("JsonValue"); - } - } } return; } diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaCXFServerCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaCXFServerCodegen.java index f637a80567c..c9d558d51ab 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaCXFServerCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaCXFServerCodegen.java @@ -56,8 +56,6 @@ public class JavaCXFServerCodegen extends AbstractJavaJAXRSServerCodegen model.imports.remove("ApiModel"); model.imports.remove("JsonSerialize"); model.imports.remove("ToStringSerializer"); - model.imports.remove("JsonValue"); - model.imports.remove("JsonProperty"); } @Override diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java index f9321f83d26..be80900505b 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java @@ -1,6 +1,7 @@ package io.swagger.codegen.languages; import io.swagger.codegen.*; +import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -95,6 +96,11 @@ public class JavaClientCodegen extends AbstractJavaCodegen { supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh")); supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore")); + if (!StringUtils.isEmpty(getLibrary())) { + //TODO: add sbt support to default client + supportingFiles.add(new SupportingFile("build.sbt.mustache", "", "build.sbt")); + } + //TODO: add doc to retrofit1 and feign if ( "feign".equals(getLibrary()) || "retrofit".equals(getLibrary()) ){ modelDocTemplateFiles.remove("model_doc.mustache"); @@ -108,12 +114,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen { supportingFiles.add(new SupportingFile("auth/Authentication.mustache", authFolder, "Authentication.java")); } - // library-specific files - if (!StringUtils.isEmpty(getLibrary())) { - //TODO: add sbt support to default client - supportingFiles.add(new SupportingFile("build.sbt.mustache", "", "build.sbt")); - - } else if ("feign".equals(getLibrary())) { + if ("feign".equals(getLibrary())) { supportingFiles.add(new SupportingFile("FormAwareEncoder.mustache", invokerFolder, "FormAwareEncoder.java")); } else if ("okhttp-gson".equals(getLibrary())) { // the "okhttp-gson" library template requires "ApiCallback.mustache" for async call @@ -165,6 +166,45 @@ public class JavaClientCodegen extends AbstractJavaCodegen { return objs; } + @Override + public void postProcessModelProperty(CodegenModel model, CodegenProperty property) { + super.postProcessModelProperty(model, property); + if(!BooleanUtils.toBoolean(model.isEnum)) { + final String lib = getLibrary(); + //Needed imports for Jackson based libraries + if(StringUtils.isEmpty(lib) || "feign".equals(lib) || "jersey2".equals(lib)) { + model.imports.add("JsonProperty"); + + if(BooleanUtils.toBoolean(model.hasEnums)) { + model.imports.add("JsonValue"); + } + } + } + } + + @Override + public Map postProcessModelsEnum(Map objs) { + objs = super.postProcessModelsEnum(objs); + String lib = getLibrary(); + //Needed imports for Jackson based libraries + if (StringUtils.isEmpty(lib) || "feign".equals(lib) || "jersey2".equals(lib)) { + List> imports = (List>)objs.get("imports"); + List models = (List) objs.get("models"); + for (Object _mo : models) { + Map mo = (Map) _mo; + CodegenModel cm = (CodegenModel) mo.get("model"); + // for enum model + if (Boolean.TRUE.equals(cm.isEnum) && cm.allowableValues != null) { + cm.imports.add(importMapping.get("JsonValue")); + Map item = new HashMap(); + item.put("import", importMapping.get("JsonValue")); + imports.add(item); + } + } + } + return objs; + } + public void setUseRxJava(boolean useRxJava) { this.useRxJava = useRxJava; } diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaInflectorServerCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaInflectorServerCodegen.java index f586a11baf0..e82c2893d59 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaInflectorServerCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaInflectorServerCodegen.java @@ -5,6 +5,8 @@ import io.swagger.codegen.*; import io.swagger.models.Operation; import io.swagger.models.Swagger; import io.swagger.util.Yaml; +import org.apache.commons.lang3.BooleanUtils; +import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -133,6 +135,42 @@ public class JavaInflectorServerCodegen extends AbstractJavaCodegen { return objs; } + @Override + public void postProcessModelProperty(CodegenModel model, CodegenProperty property) { + super.postProcessModelProperty(model, property); + + //Add imports for Jackson + if(!BooleanUtils.toBoolean(model.isEnum)) { + model.imports.add("JsonProperty"); + + if(BooleanUtils.toBoolean(model.hasEnums)) { + model.imports.add("JsonValue"); + } + } + } + + @Override + public Map postProcessModelsEnum(Map objs) { + objs = super.postProcessModelsEnum(objs); + + //Add imports for Jackson + List> imports = (List>)objs.get("imports"); + List models = (List) objs.get("models"); + for (Object _mo : models) { + Map mo = (Map) _mo; + CodegenModel cm = (CodegenModel) mo.get("model"); + // for enum model + if (Boolean.TRUE.equals(cm.isEnum) && cm.allowableValues != null) { + cm.imports.add(importMapping.get("JsonValue")); + Map item = new HashMap(); + item.put("import", importMapping.get("JsonValue")); + imports.add(item); + } + } + + return objs; + } + public String apiFilename(String templateName, String tag) { String result = super.apiFilename(templateName, tag); diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaJerseyServerCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaJerseyServerCodegen.java index f543b29903b..df43ab822d7 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaJerseyServerCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaJerseyServerCodegen.java @@ -5,6 +5,7 @@ import io.swagger.models.Operation; import java.util.*; +import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.StringUtils; public class JavaJerseyServerCodegen extends AbstractJavaJAXRSServerCodegen { @@ -55,6 +56,15 @@ public class JavaJerseyServerCodegen extends AbstractJavaJAXRSServerCodegen { if("null".equals(property.example)) { property.example = null; } + + //Add imports for Jackson + if(!BooleanUtils.toBoolean(model.isEnum)) { + model.imports.add("JsonProperty"); + + if(BooleanUtils.toBoolean(model.hasEnums)) { + model.imports.add("JsonValue"); + } + } } @Override @@ -90,6 +100,28 @@ public class JavaJerseyServerCodegen extends AbstractJavaJAXRSServerCodegen { supportingFiles.add(new SupportingFile("StringUtil.mustache", (sourceFolder + '/' + apiPackage).replace(".", "/"), "StringUtil.java")); } + @Override + public Map postProcessModelsEnum(Map objs) { + objs = super.postProcessModelsEnum(objs); + + //Add imports for Jackson + List> imports = (List>)objs.get("imports"); + List models = (List) objs.get("models"); + for (Object _mo : models) { + Map mo = (Map) _mo; + CodegenModel cm = (CodegenModel) mo.get("model"); + // for enum model + if (Boolean.TRUE.equals(cm.isEnum) && cm.allowableValues != null) { + cm.imports.add(importMapping.get("JsonValue")); + Map item = new HashMap(); + item.put("import", importMapping.get("JsonValue")); + imports.add(item); + } + } + + return objs; + } + @Override public void addOperationToGroup(String tag, String resourcePath, Operation operation, CodegenOperation co, Map> operations) { String basePath = resourcePath; diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaResteasyServerCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaResteasyServerCodegen.java index d77a4f32067..2aff70422da 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaResteasyServerCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaResteasyServerCodegen.java @@ -2,6 +2,7 @@ package io.swagger.codegen.languages; import io.swagger.codegen.*; import io.swagger.models.Operation; +import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.StringUtils; import java.io.File; @@ -164,28 +165,35 @@ public class JavaResteasyServerCodegen extends AbstractJavaJAXRSServerCodegen { @Override public void postProcessModelProperty(CodegenModel model, CodegenProperty property) { - if(serializeBigDecimalAsString) { - if (property.baseType.equals("BigDecimal")) { - // we serialize BigDecimal as `string` to avoid precision loss - property.vendorExtensions.put("extraAnnotation", "@JsonSerialize(using = ToStringSerializer.class)"); + //Add imports for Jackson + if(!BooleanUtils.toBoolean(model.isEnum)) { + model.imports.add("JsonProperty"); - // this requires some more imports to be added for this model... - model.imports.add("ToStringSerializer"); - model.imports.add("JsonSerialize"); + if(BooleanUtils.toBoolean(model.hasEnums)) { + model.imports.add("JsonValue"); + } + } + } + + @Override + public Map postProcessModelsEnum(Map objs) { + objs = super.postProcessModelsEnum(objs); + + //Add imports for Jackson + List> imports = (List>)objs.get("imports"); + List models = (List) objs.get("models"); + for (Object _mo : models) { + Map mo = (Map) _mo; + CodegenModel cm = (CodegenModel) mo.get("model"); + // for enum model + if (Boolean.TRUE.equals(cm.isEnum) && cm.allowableValues != null) { + cm.imports.add(importMapping.get("JsonValue")); + Map item = new HashMap(); + item.put("import", importMapping.get("JsonValue")); + imports.add(item); } } - if(model.isEnum == null || model.isEnum) { - - final String lib = getLibrary(); - if(StringUtils.isEmpty(lib)) { - model.imports.add("JsonProperty"); - - if(model.hasEnums != null || model.hasEnums == true) { - model.imports.add("JsonValue"); - } - } - } - return; + return objs; } } diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SpringBootServerCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SpringBootServerCodegen.java index 3cdefc4e437..fb54e1bc779 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SpringBootServerCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SpringBootServerCodegen.java @@ -4,6 +4,8 @@ import io.swagger.codegen.*; import io.swagger.models.Operation; import io.swagger.models.Path; import io.swagger.models.Swagger; +import org.apache.commons.lang3.BooleanUtils; + import java.io.File; import java.util.*; @@ -306,4 +308,40 @@ public class SpringBootServerCodegen extends AbstractJavaCodegen { } return objs; } + + @Override + public void postProcessModelProperty(CodegenModel model, CodegenProperty property) { + super.postProcessModelProperty(model, property); + + //Add imports for Jackson + if(!BooleanUtils.toBoolean(model.isEnum)) { + model.imports.add("JsonProperty"); + + if(BooleanUtils.toBoolean(model.hasEnums)) { + model.imports.add("JsonValue"); + } + } + } + + @Override + public Map postProcessModelsEnum(Map objs) { + objs = super.postProcessModelsEnum(objs); + + //Add imports for Jackson + List> imports = (List>)objs.get("imports"); + List models = (List) objs.get("models"); + for (Object _mo : models) { + Map mo = (Map) _mo; + CodegenModel cm = (CodegenModel) mo.get("model"); + // for enum model + if (Boolean.TRUE.equals(cm.isEnum) && cm.allowableValues != null) { + cm.imports.add(importMapping.get("JsonValue")); + Map item = new HashMap(); + item.put("import", importMapping.get("JsonValue")); + imports.add(item); + } + } + + return objs; + } } diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/model.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/model.mustache index 738fe1c1440..b9512d2b83c 100644 --- a/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/model.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/libraries/jersey1/model.mustache @@ -1,8 +1,6 @@ package {{package}}; import java.util.Objects; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonValue; {{#imports}}import {{import}}; {{/imports}} diff --git a/samples/client/petstore/groovy/.swagger-codegen-ignore b/samples/client/petstore/groovy/.swagger-codegen-ignore new file mode 100644 index 00000000000..19d3377182e --- /dev/null +++ b/samples/client/petstore/groovy/.swagger-codegen-ignore @@ -0,0 +1,23 @@ +# Swagger Codegen Ignore +# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# Thsi matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/petstore/groovy/LICENSE b/samples/client/petstore/groovy/LICENSE new file mode 100644 index 00000000000..8dada3edaf5 --- /dev/null +++ b/samples/client/petstore/groovy/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/samples/client/petstore/groovy/src/main/groovy/io/swagger/api/PetApi.groovy b/samples/client/petstore/groovy/src/main/groovy/io/swagger/api/PetApi.groovy index 5aae4924239..d0779e65c25 100644 --- a/samples/client/petstore/groovy/src/main/groovy/io/swagger/api/PetApi.groovy +++ b/samples/client/petstore/groovy/src/main/groovy/io/swagger/api/PetApi.groovy @@ -6,8 +6,8 @@ import static groovyx.net.http.Method.* import io.swagger.api.ApiUtils import io.swagger.model.Pet -import java.io.File import io.swagger.model.ModelApiResponse +import java.io.File import java.util.*; diff --git a/samples/client/petstore/groovy/src/main/groovy/io/swagger/model/Category.groovy b/samples/client/petstore/groovy/src/main/groovy/io/swagger/model/Category.groovy index 29509e64e54..752328f71ea 100644 --- a/samples/client/petstore/groovy/src/main/groovy/io/swagger/model/Category.groovy +++ b/samples/client/petstore/groovy/src/main/groovy/io/swagger/model/Category.groovy @@ -1,7 +1,6 @@ package io.swagger.model; import groovy.transform.Canonical -import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @Canonical diff --git a/samples/client/petstore/groovy/src/main/groovy/io/swagger/model/ModelApiResponse.groovy b/samples/client/petstore/groovy/src/main/groovy/io/swagger/model/ModelApiResponse.groovy index 505752a6dc3..21b0185787b 100644 --- a/samples/client/petstore/groovy/src/main/groovy/io/swagger/model/ModelApiResponse.groovy +++ b/samples/client/petstore/groovy/src/main/groovy/io/swagger/model/ModelApiResponse.groovy @@ -1,7 +1,6 @@ package io.swagger.model; import groovy.transform.Canonical -import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @Canonical diff --git a/samples/client/petstore/groovy/src/main/groovy/io/swagger/model/Order.groovy b/samples/client/petstore/groovy/src/main/groovy/io/swagger/model/Order.groovy index 815c72846d9..afc35651173 100644 --- a/samples/client/petstore/groovy/src/main/groovy/io/swagger/model/Order.groovy +++ b/samples/client/petstore/groovy/src/main/groovy/io/swagger/model/Order.groovy @@ -1,8 +1,6 @@ package io.swagger.model; import groovy.transform.Canonical -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.Date; diff --git a/samples/client/petstore/groovy/src/main/groovy/io/swagger/model/Pet.groovy b/samples/client/petstore/groovy/src/main/groovy/io/swagger/model/Pet.groovy index 667ce9430f4..53f113424cd 100644 --- a/samples/client/petstore/groovy/src/main/groovy/io/swagger/model/Pet.groovy +++ b/samples/client/petstore/groovy/src/main/groovy/io/swagger/model/Pet.groovy @@ -1,8 +1,6 @@ package io.swagger.model; import groovy.transform.Canonical -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import io.swagger.model.Category; diff --git a/samples/client/petstore/groovy/src/main/groovy/io/swagger/model/Tag.groovy b/samples/client/petstore/groovy/src/main/groovy/io/swagger/model/Tag.groovy index 5c30c04a5ff..4160f03a718 100644 --- a/samples/client/petstore/groovy/src/main/groovy/io/swagger/model/Tag.groovy +++ b/samples/client/petstore/groovy/src/main/groovy/io/swagger/model/Tag.groovy @@ -1,7 +1,6 @@ package io.swagger.model; import groovy.transform.Canonical -import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @Canonical diff --git a/samples/client/petstore/groovy/src/main/groovy/io/swagger/model/User.groovy b/samples/client/petstore/groovy/src/main/groovy/io/swagger/model/User.groovy index 6889661e9e5..142a4afd0da 100644 --- a/samples/client/petstore/groovy/src/main/groovy/io/swagger/model/User.groovy +++ b/samples/client/petstore/groovy/src/main/groovy/io/swagger/model/User.groovy @@ -1,7 +1,6 @@ package io.swagger.model; import groovy.transform.Canonical -import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @Canonical diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Category.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Category.java index 165fce2a49d..fca6b39bfa8 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Category.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Category.java @@ -3,12 +3,11 @@ package io.swagger.model; import java.util.Objects; import java.util.ArrayList; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonValue; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-29T00:20:47.240+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-06-16T10:34:51.577+02:00") public class Category { private Long id = null; diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/ModelApiResponse.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/ModelApiResponse.java index 8c1bdbf106e..8229b459bd0 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/ModelApiResponse.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/ModelApiResponse.java @@ -3,12 +3,11 @@ package io.swagger.model; import java.util.Objects; import java.util.ArrayList; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonValue; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-29T00:20:47.240+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-06-16T10:34:51.577+02:00") public class ModelApiResponse { private Integer code = null; diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Order.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Order.java index f33876b9c65..fe59a870a06 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Order.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Order.java @@ -9,7 +9,7 @@ import java.util.Date; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-29T00:20:47.240+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-06-16T10:34:51.577+02:00") public class Order { private Long id = null; diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Pet.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Pet.java index a14c7269931..c56d0930366 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Pet.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Pet.java @@ -11,7 +11,7 @@ import java.util.List; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-29T00:20:47.240+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-06-16T10:34:51.577+02:00") public class Pet { private Long id = null; diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Tag.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Tag.java index 74ec375d7e2..952f4e39d24 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Tag.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/Tag.java @@ -3,12 +3,11 @@ package io.swagger.model; import java.util.Objects; import java.util.ArrayList; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonValue; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-29T00:20:47.240+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-06-16T10:34:51.577+02:00") public class Tag { private Long id = null; diff --git a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/User.java b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/User.java index f01215a829e..a3e69975601 100644 --- a/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/User.java +++ b/samples/server/petstore/jaxrs-resteasy/src/gen/java/io/swagger/model/User.java @@ -3,12 +3,11 @@ package io.swagger.model; import java.util.Objects; import java.util.ArrayList; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonValue; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-04-29T00:20:47.240+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2016-06-16T10:34:51.577+02:00") public class User { private Long id = null; diff --git a/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/model/Category.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/model/Category.java index f76411d073a..67bc75b3b10 100644 --- a/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/model/Category.java +++ b/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/model/Category.java @@ -2,7 +2,6 @@ package io.swagger.model; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; diff --git a/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/model/ModelApiResponse.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/model/ModelApiResponse.java index 9c61a7434e7..5e3aa82bbee 100644 --- a/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/model/ModelApiResponse.java +++ b/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/model/ModelApiResponse.java @@ -2,7 +2,6 @@ package io.swagger.model; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; diff --git a/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/model/Tag.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/model/Tag.java index f203b01f55b..f26d84e74b2 100644 --- a/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/model/Tag.java +++ b/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/model/Tag.java @@ -2,7 +2,6 @@ package io.swagger.model; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; diff --git a/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/model/User.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/model/User.java index f239bb3febc..5dc291a7889 100644 --- a/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/model/User.java +++ b/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/model/User.java @@ -2,7 +2,6 @@ package io.swagger.model; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; From dee8a7b9249e21ced80336e3ebc34c3ec506cd13 Mon Sep 17 00:00:00 2001 From: Andreas Reiter Date: Mon, 20 Jun 2016 11:16:51 +0200 Subject: [PATCH 14/16] Add dartson-@Property to enable out of the box compatibility with code generated for e.g. Java --- modules/swagger-codegen/src/main/resources/dart/model.mustache | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/swagger-codegen/src/main/resources/dart/model.mustache b/modules/swagger-codegen/src/main/resources/dart/model.mustache index c0c4789c00b..afd72265646 100644 --- a/modules/swagger-codegen/src/main/resources/dart/model.mustache +++ b/modules/swagger-codegen/src/main/resources/dart/model.mustache @@ -4,6 +4,7 @@ part of api; @Entity() class {{classname}} { {{#vars}}{{#description}}/* {{{description}}} */{{/description}} + @Property(name: '{{baseName}}') {{{datatype}}} {{name}} = {{{defaultValue}}}; {{#allowableValues}}{{#min}} // range from {{min}} to {{max}}{{/min}}//{{^min}}enum {{name}}Enum { {{#values}} {{.}}, {{/values}} };{{/min}}{{/allowableValues}} {{/vars}} From 9ec0e545c8b649339419c5e911b0b27f84957d86 Mon Sep 17 00:00:00 2001 From: Andreas Reiter Date: Mon, 20 Jun 2016 13:25:54 +0200 Subject: [PATCH 15/16] Updated dart petstore --- samples/client/petstore/dart/LICENSE | 201 ++++++++++++++++++ samples/client/petstore/dart/git_push.sh | 4 +- .../client/petstore/dart/lib/api_client.dart | 2 +- .../petstore/dart/lib/model/api_response.dart | 3 + .../petstore/dart/lib/model/category.dart | 2 + .../client/petstore/dart/lib/model/order.dart | 6 + .../client/petstore/dart/lib/model/pet.dart | 6 + .../client/petstore/dart/lib/model/tag.dart | 2 + .../client/petstore/dart/lib/model/user.dart | 8 + 9 files changed, 231 insertions(+), 3 deletions(-) create mode 100644 samples/client/petstore/dart/LICENSE diff --git a/samples/client/petstore/dart/LICENSE b/samples/client/petstore/dart/LICENSE new file mode 100644 index 00000000000..8dada3edaf5 --- /dev/null +++ b/samples/client/petstore/dart/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/samples/client/petstore/dart/git_push.sh b/samples/client/petstore/dart/git_push.sh index 1a36388db02..ed374619b13 100644 --- a/samples/client/petstore/dart/git_push.sh +++ b/samples/client/petstore/dart/git_push.sh @@ -8,12 +8,12 @@ git_repo_id=$2 release_note=$3 if [ "$git_user_id" = "" ]; then - git_user_id="YOUR_GIT_USR_ID" + git_user_id="GIT_USER_ID" echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" fi if [ "$git_repo_id" = "" ]; then - git_repo_id="YOUR_GIT_REPO_ID" + git_repo_id="GIT_REPO_ID" echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" fi diff --git a/samples/client/petstore/dart/lib/api_client.dart b/samples/client/petstore/dart/lib/api_client.dart index 7cd93d13e61..c4e9a5b1d46 100644 --- a/samples/client/petstore/dart/lib/api_client.dart +++ b/samples/client/petstore/dart/lib/api_client.dart @@ -10,8 +10,8 @@ class ApiClient { ApiClient() { // Setup authentications (key: authentication name, value: authentication). - _authentications['api_key'] = new ApiKeyAuth("header", "api_key"); _authentications['petstore_auth'] = new OAuth(); + _authentications['api_key'] = new ApiKeyAuth("header", "api_key"); } void addDefaultHeader(String key, String value) { diff --git a/samples/client/petstore/dart/lib/model/api_response.dart b/samples/client/petstore/dart/lib/model/api_response.dart index e9746c587b0..e8ffe737861 100644 --- a/samples/client/petstore/dart/lib/model/api_response.dart +++ b/samples/client/petstore/dart/lib/model/api_response.dart @@ -4,12 +4,15 @@ part of api; @Entity() class ApiResponse { + @Property(name: 'code') int code = null; + @Property(name: 'type') String type = null; + @Property(name: 'message') String message = null; ApiResponse(); diff --git a/samples/client/petstore/dart/lib/model/category.dart b/samples/client/petstore/dart/lib/model/category.dart index 8b4c9b47f8b..e39966555fb 100644 --- a/samples/client/petstore/dart/lib/model/category.dart +++ b/samples/client/petstore/dart/lib/model/category.dart @@ -4,9 +4,11 @@ part of api; @Entity() class Category { + @Property(name: 'id') int id = null; + @Property(name: 'name') String name = null; Category(); diff --git a/samples/client/petstore/dart/lib/model/order.dart b/samples/client/petstore/dart/lib/model/order.dart index a3c37e839d6..1d908629b06 100644 --- a/samples/client/petstore/dart/lib/model/order.dart +++ b/samples/client/petstore/dart/lib/model/order.dart @@ -4,21 +4,27 @@ part of api; @Entity() class Order { + @Property(name: 'id') int id = null; + @Property(name: 'petId') int petId = null; + @Property(name: 'quantity') int quantity = null; + @Property(name: 'shipDate') DateTime shipDate = null; /* Order Status */ + @Property(name: 'status') String status = null; //enum statusEnum { placed, approved, delivered, }; + @Property(name: 'complete') bool complete = null; Order(); diff --git a/samples/client/petstore/dart/lib/model/pet.dart b/samples/client/petstore/dart/lib/model/pet.dart index 649e99527dd..8ad328b78be 100644 --- a/samples/client/petstore/dart/lib/model/pet.dart +++ b/samples/client/petstore/dart/lib/model/pet.dart @@ -4,21 +4,27 @@ part of api; @Entity() class Pet { + @Property(name: 'id') int id = null; + @Property(name: 'category') Category category = null; + @Property(name: 'name') String name = null; + @Property(name: 'photoUrls') List photoUrls = []; + @Property(name: 'tags') List tags = []; /* pet status in the store */ + @Property(name: 'status') String status = null; //enum statusEnum { available, pending, sold, }; Pet(); diff --git a/samples/client/petstore/dart/lib/model/tag.dart b/samples/client/petstore/dart/lib/model/tag.dart index 68214cd49f5..0541e12fb6f 100644 --- a/samples/client/petstore/dart/lib/model/tag.dart +++ b/samples/client/petstore/dart/lib/model/tag.dart @@ -4,9 +4,11 @@ part of api; @Entity() class Tag { + @Property(name: 'id') int id = null; + @Property(name: 'name') String name = null; Tag(); diff --git a/samples/client/petstore/dart/lib/model/user.dart b/samples/client/petstore/dart/lib/model/user.dart index 7cd314f7b25..fd99a51ee58 100644 --- a/samples/client/petstore/dart/lib/model/user.dart +++ b/samples/client/petstore/dart/lib/model/user.dart @@ -4,27 +4,35 @@ part of api; @Entity() class User { + @Property(name: 'id') int id = null; + @Property(name: 'username') String username = null; + @Property(name: 'firstName') String firstName = null; + @Property(name: 'lastName') String lastName = null; + @Property(name: 'email') String email = null; + @Property(name: 'password') String password = null; + @Property(name: 'phone') String phone = null; /* User Status */ + @Property(name: 'userStatus') int userStatus = null; User(); From 450eb844e9a49a92e9d36367175580dd9bfa3611 Mon Sep 17 00:00:00 2001 From: wing328 Date: Mon, 20 Jun 2016 22:42:24 +0800 Subject: [PATCH 16/16] add guohuang as go server owner --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 6c1648f69f5..6d6c83e7679 100644 --- a/README.md +++ b/README.md @@ -759,6 +759,7 @@ Swaagger Codegen core team members are contributors who have been making signfic | Langauges | Core Team (date joined) | |:------------- |:-------------| | C# ASP.NET5 | @jimschubert (2016/05/01) | +| Go Server | @guohuang (2016/06/13) | | Haskell Servant | | | Java Spring Boot | | | Java SpringMVC | @kolyjjj (2016/05/01) | @@ -795,6 +796,7 @@ Here is a list of template creators: * TypeScript (Angular2): @roni-frantchi * Server Stubs * C# ASP.NET5: @jimschubert + * Go Server: @guohuang * Haskell Servant: @algas * Java Spring Boot: @diyfr * JAX-RS RestEasy: @chameleon82