From 38b4d17ad538d53b7a023c504f7f7eb6417e8dcd Mon Sep 17 00:00:00 2001 From: Tomasz Prus Date: Sun, 8 Jul 2018 09:29:55 +0200 Subject: [PATCH] update and fix python samples (#489) * fix: update petstore samples for python, fix broken tests * chore: entries for python-asyncio/tornado in gitignore --- .gitignore | 3 + .../python-asyncio/.openapi-generator/VERSION | 2 +- .../client/petstore/python-asyncio/README.md | 5 + .../petstore/python-asyncio/docs/FakeApi.md | 47 ++++++ .../petstore/python-asyncio/docs/File.md | 10 ++ .../docs/FileSchemaTestClass.md | 11 ++ .../petstore/python-asyncio/docs/MapTest.md | 2 + .../petstore/python-asyncio/docs/PetApi.md | 55 +++++++ .../python-asyncio/docs/StringBooleanMap.md | 9 ++ .../python-asyncio/petstore_api/__init__.py | 3 + .../petstore_api/api/fake_api.py | 95 ++++++++++++ .../petstore_api/api/pet_api.py | 109 ++++++++++++++ .../python-asyncio/petstore_api/api_client.py | 2 +- .../petstore_api/models/__init__.py | 3 + .../petstore_api/models/file.py | 114 +++++++++++++++ .../models/file_schema_test_class.py | 138 ++++++++++++++++++ .../petstore_api/models/map_test.py | 58 +++++++- .../petstore_api/models/string_boolean_map.py | 84 +++++++++++ .../petstore/python-asyncio/test/test_file.py | 39 +++++ .../test/test_file_schema_test_class.py | 39 +++++ .../test/test_string_boolean_map.py | 39 +++++ .../python-tornado/.openapi-generator/VERSION | 2 +- .../client/petstore/python-tornado/README.md | 5 + .../petstore/python-tornado/docs/FakeApi.md | 47 ++++++ .../petstore/python-tornado/docs/File.md | 10 ++ .../docs/FileSchemaTestClass.md | 11 ++ .../petstore/python-tornado/docs/MapTest.md | 2 + .../petstore/python-tornado/docs/PetApi.md | 55 +++++++ .../python-tornado/docs/StringBooleanMap.md | 9 ++ .../python-tornado/petstore_api/__init__.py | 3 + .../petstore_api/api/fake_api.py | 95 ++++++++++++ .../petstore_api/api/pet_api.py | 109 ++++++++++++++ .../python-tornado/petstore_api/api_client.py | 2 +- .../petstore_api/models/__init__.py | 3 + .../petstore_api/models/file.py | 114 +++++++++++++++ .../models/file_schema_test_class.py | 138 ++++++++++++++++++ .../petstore_api/models/map_test.py | 58 +++++++- .../petstore_api/models/string_boolean_map.py | 84 +++++++++++ .../petstore/python-tornado/test/test_file.py | 39 +++++ .../test/test_file_schema_test_class.py | 39 +++++ .../test/test_string_boolean_map.py | 39 +++++ .../python/.openapi-generator/VERSION | 2 +- samples/client/petstore/python/README.md | 5 + .../client/petstore/python/docs/FakeApi.md | 47 ++++++ samples/client/petstore/python/docs/File.md | 10 ++ .../python/docs/FileSchemaTestClass.md | 11 ++ .../client/petstore/python/docs/MapTest.md | 2 + samples/client/petstore/python/docs/PetApi.md | 55 +++++++ .../petstore/python/docs/StringBooleanMap.md | 9 ++ .../petstore/python/petstore_api/__init__.py | 3 + .../python/petstore_api/api/fake_api.py | 95 ++++++++++++ .../python/petstore_api/api/pet_api.py | 109 ++++++++++++++ .../python/petstore_api/api_client.py | 2 +- .../python/petstore_api/models/__init__.py | 3 + .../python/petstore_api/models/file.py | 114 +++++++++++++++ .../models/file_schema_test_class.py | 138 ++++++++++++++++++ .../python/petstore_api/models/map_test.py | 58 +++++++- .../petstore_api/models/string_boolean_map.py | 84 +++++++++++ .../client/petstore/python/test/test_file.py | 39 +++++ .../test/test_file_schema_test_class.py | 39 +++++ .../python/test/test_string_boolean_map.py | 39 +++++ .../petstore/python/tests/test_map_test.py | 19 ++- 62 files changed, 2594 insertions(+), 20 deletions(-) create mode 100644 samples/client/petstore/python-asyncio/docs/File.md create mode 100644 samples/client/petstore/python-asyncio/docs/FileSchemaTestClass.md create mode 100644 samples/client/petstore/python-asyncio/docs/StringBooleanMap.md create mode 100644 samples/client/petstore/python-asyncio/petstore_api/models/file.py create mode 100644 samples/client/petstore/python-asyncio/petstore_api/models/file_schema_test_class.py create mode 100644 samples/client/petstore/python-asyncio/petstore_api/models/string_boolean_map.py create mode 100644 samples/client/petstore/python-asyncio/test/test_file.py create mode 100644 samples/client/petstore/python-asyncio/test/test_file_schema_test_class.py create mode 100644 samples/client/petstore/python-asyncio/test/test_string_boolean_map.py create mode 100644 samples/client/petstore/python-tornado/docs/File.md create mode 100644 samples/client/petstore/python-tornado/docs/FileSchemaTestClass.md create mode 100644 samples/client/petstore/python-tornado/docs/StringBooleanMap.md create mode 100644 samples/client/petstore/python-tornado/petstore_api/models/file.py create mode 100644 samples/client/petstore/python-tornado/petstore_api/models/file_schema_test_class.py create mode 100644 samples/client/petstore/python-tornado/petstore_api/models/string_boolean_map.py create mode 100644 samples/client/petstore/python-tornado/test/test_file.py create mode 100644 samples/client/petstore/python-tornado/test/test_file_schema_test_class.py create mode 100644 samples/client/petstore/python-tornado/test/test_string_boolean_map.py create mode 100644 samples/client/petstore/python/docs/File.md create mode 100644 samples/client/petstore/python/docs/FileSchemaTestClass.md create mode 100644 samples/client/petstore/python/docs/StringBooleanMap.md create mode 100644 samples/client/petstore/python/petstore_api/models/file.py create mode 100644 samples/client/petstore/python/petstore_api/models/file_schema_test_class.py create mode 100644 samples/client/petstore/python/petstore_api/models/string_boolean_map.py create mode 100644 samples/client/petstore/python/test/test_file.py create mode 100644 samples/client/petstore/python/test/test_file_schema_test_class.py create mode 100644 samples/client/petstore/python/test/test_string_boolean_map.py diff --git a/.gitignore b/.gitignore index c33eae088e13..d7be0385c827 100644 --- a/.gitignore +++ b/.gitignore @@ -158,6 +158,9 @@ samples/client/petstore/python/swagger_client.egg-info/SOURCES.txt samples/client/petstore/python/.coverage samples/client/petstore/python/.projectile samples/client/petstore/python/.venv/ +samples/client/petstore/python-asyncio/.venv/ +samples/client/petstore/python-asyncio/.pytest_cache/ +samples/client/petstore/python-tornado/.venv/ # ts samples/client/petstore/typescript-node/npm/node_modules diff --git a/samples/client/petstore/python-asyncio/.openapi-generator/VERSION b/samples/client/petstore/python-asyncio/.openapi-generator/VERSION index 096bf47efe31..a0cd9f0ccb01 100644 --- a/samples/client/petstore/python-asyncio/.openapi-generator/VERSION +++ b/samples/client/petstore/python-asyncio/.openapi-generator/VERSION @@ -1 +1 @@ -3.0.0-SNAPSHOT \ No newline at end of file +3.1.0 \ No newline at end of file diff --git a/samples/client/petstore/python-asyncio/README.md b/samples/client/petstore/python-asyncio/README.md index b88da343a42c..40e3e1e2e76c 100644 --- a/samples/client/petstore/python-asyncio/README.md +++ b/samples/client/petstore/python-asyncio/README.md @@ -75,6 +75,7 @@ Class | Method | HTTP request | Description *FakeApi* | [**fake_outer_composite_serialize**](docs/FakeApi.md#fake_outer_composite_serialize) | **POST** /fake/outer/composite | *FakeApi* | [**fake_outer_number_serialize**](docs/FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number | *FakeApi* | [**fake_outer_string_serialize**](docs/FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string | +*FakeApi* | [**test_body_with_file_schema**](docs/FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema | *FakeApi* | [**test_body_with_query_params**](docs/FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params | *FakeApi* | [**test_client_model**](docs/FakeApi.md#test_client_model) | **PATCH** /fake | To test \"client\" model *FakeApi* | [**test_endpoint_parameters**](docs/FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -90,6 +91,7 @@ Class | Method | HTTP request | Description *PetApi* | [**update_pet**](docs/PetApi.md#update_pet) | **PUT** /pet | Update an existing pet *PetApi* | [**update_pet_with_form**](docs/PetApi.md#update_pet_with_form) | **POST** /pet/{petId} | Updates a pet in the store with form data *PetApi* | [**upload_file**](docs/PetApi.md#upload_file) | **POST** /pet/{petId}/uploadImage | uploads an image +*PetApi* | [**upload_file_with_required_file**](docs/PetApi.md#upload_file_with_required_file) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) *StoreApi* | [**delete_order**](docs/StoreApi.md#delete_order) | **DELETE** /store/order/{order_id} | Delete purchase order by ID *StoreApi* | [**get_inventory**](docs/StoreApi.md#get_inventory) | **GET** /store/inventory | Returns pet inventories by status *StoreApi* | [**get_order_by_id**](docs/StoreApi.md#get_order_by_id) | **GET** /store/order/{order_id} | Find purchase order by ID @@ -122,6 +124,8 @@ Class | Method | HTTP request | Description - [EnumArrays](docs/EnumArrays.md) - [EnumClass](docs/EnumClass.md) - [EnumTest](docs/EnumTest.md) + - [File](docs/File.md) + - [FileSchemaTestClass](docs/FileSchemaTestClass.md) - [FormatTest](docs/FormatTest.md) - [HasOnlyReadOnly](docs/HasOnlyReadOnly.md) - [List](docs/List.md) @@ -137,6 +141,7 @@ Class | Method | HTTP request | Description - [Pet](docs/Pet.md) - [ReadOnlyFirst](docs/ReadOnlyFirst.md) - [SpecialModelName](docs/SpecialModelName.md) + - [StringBooleanMap](docs/StringBooleanMap.md) - [Tag](docs/Tag.md) - [User](docs/User.md) diff --git a/samples/client/petstore/python-asyncio/docs/FakeApi.md b/samples/client/petstore/python-asyncio/docs/FakeApi.md index 3b30ab1b4e9c..3510abda8b79 100644 --- a/samples/client/petstore/python-asyncio/docs/FakeApi.md +++ b/samples/client/petstore/python-asyncio/docs/FakeApi.md @@ -8,6 +8,7 @@ Method | HTTP request | Description [**fake_outer_composite_serialize**](FakeApi.md#fake_outer_composite_serialize) | **POST** /fake/outer/composite | [**fake_outer_number_serialize**](FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number | [**fake_outer_string_serialize**](FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string | +[**test_body_with_file_schema**](FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema | [**test_body_with_query_params**](FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params | [**test_client_model**](FakeApi.md#test_client_model) | **PATCH** /fake | To test \"client\" model [**test_endpoint_parameters**](FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -204,6 +205,52 @@ No authorization required [[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) +# **test_body_with_file_schema** +> test_body_with_file_schema(file_schema_test_class) + + + +For this test, the body for this request much reference a schema named `File`. + +### Example +```python +from __future__ import print_function +import time +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# create an instance of the API class +api_instance = petstore_api.FakeApi() +file_schema_test_class = petstore_api.FileSchemaTestClass() # FileSchemaTestClass | + +try: + api_instance.test_body_with_file_schema(file_schema_test_class) +except ApiException as e: + print("Exception when calling FakeApi->test_body_with_file_schema: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **file_schema_test_class** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +[[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) + # **test_body_with_query_params** > test_body_with_query_params(query, user) diff --git a/samples/client/petstore/python-asyncio/docs/File.md b/samples/client/petstore/python-asyncio/docs/File.md new file mode 100644 index 000000000000..6a925f0a7af4 --- /dev/null +++ b/samples/client/petstore/python-asyncio/docs/File.md @@ -0,0 +1,10 @@ +# File + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**source_uri** | **str** | Test capitalization | [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/python-asyncio/docs/FileSchemaTestClass.md b/samples/client/petstore/python-asyncio/docs/FileSchemaTestClass.md new file mode 100644 index 000000000000..dc3722289887 --- /dev/null +++ b/samples/client/petstore/python-asyncio/docs/FileSchemaTestClass.md @@ -0,0 +1,11 @@ +# FileSchemaTestClass + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**file** | [**File**](File.md) | | [optional] +**files** | [**list[File]**](File.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/python-asyncio/docs/MapTest.md b/samples/client/petstore/python-asyncio/docs/MapTest.md index 68844755d420..ee6036eb2f42 100644 --- a/samples/client/petstore/python-asyncio/docs/MapTest.md +++ b/samples/client/petstore/python-asyncio/docs/MapTest.md @@ -5,6 +5,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **map_map_of_string** | **dict(str, dict(str, str))** | | [optional] **map_of_enum_string** | **dict(str, str)** | | [optional] +**direct_map** | **dict(str, bool)** | | [optional] +**indirect_map** | [**StringBooleanMap**](StringBooleanMap.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/python-asyncio/docs/PetApi.md b/samples/client/petstore/python-asyncio/docs/PetApi.md index 748cf407ea45..583883799e2e 100644 --- a/samples/client/petstore/python-asyncio/docs/PetApi.md +++ b/samples/client/petstore/python-asyncio/docs/PetApi.md @@ -12,6 +12,7 @@ Method | HTTP request | Description [**update_pet**](PetApi.md#update_pet) | **PUT** /pet | Update an existing pet [**update_pet_with_form**](PetApi.md#update_pet_with_form) | **POST** /pet/{petId} | Updates a pet in the store with form data [**upload_file**](PetApi.md#upload_file) | **POST** /pet/{petId}/uploadImage | uploads an image +[**upload_file_with_required_file**](PetApi.md#upload_file_with_required_file) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) # **add_pet** @@ -428,3 +429,57 @@ Name | Type | Description | Notes [[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) +# **upload_file_with_required_file** +> ApiResponse upload_file_with_required_file(pet_id, file, additional_metadata=additional_metadata) + +uploads an image (required) + +### Example +```python +from __future__ import print_function +import time +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration() +configuration.access_token = 'YOUR_ACCESS_TOKEN' + +# create an instance of the API class +api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration)) +pet_id = 56 # int | ID of pet to update +file = '/path/to/file' # file | file to upload +additional_metadata = 'additional_metadata_example' # str | Additional data to pass to server (optional) + +try: + # uploads an image (required) + api_response = api_instance.upload_file_with_required_file(pet_id, file, additional_metadata=additional_metadata) + pprint(api_response) +except ApiException as e: + print("Exception when calling PetApi->upload_file_with_required_file: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet_id** | **int**| ID of pet to update | + **file** | **file**| file to upload | + **additional_metadata** | **str**| Additional data to pass to server | [optional] + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + +[[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/python-asyncio/docs/StringBooleanMap.md b/samples/client/petstore/python-asyncio/docs/StringBooleanMap.md new file mode 100644 index 000000000000..7abf11ec68b1 --- /dev/null +++ b/samples/client/petstore/python-asyncio/docs/StringBooleanMap.md @@ -0,0 +1,9 @@ +# StringBooleanMap + +## 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/python-asyncio/petstore_api/__init__.py b/samples/client/petstore/python-asyncio/petstore_api/__init__.py index 565f09697410..ec4d33177cc0 100644 --- a/samples/client/petstore/python-asyncio/petstore_api/__init__.py +++ b/samples/client/petstore/python-asyncio/petstore_api/__init__.py @@ -42,6 +42,8 @@ from petstore_api.models.enum_arrays import EnumArrays from petstore_api.models.enum_class import EnumClass from petstore_api.models.enum_test import EnumTest +from petstore_api.models.file import File +from petstore_api.models.file_schema_test_class import FileSchemaTestClass from petstore_api.models.format_test import FormatTest from petstore_api.models.has_only_read_only import HasOnlyReadOnly from petstore_api.models.list import List @@ -57,5 +59,6 @@ from petstore_api.models.pet import Pet from petstore_api.models.read_only_first import ReadOnlyFirst from petstore_api.models.special_model_name import SpecialModelName +from petstore_api.models.string_boolean_map import StringBooleanMap from petstore_api.models.tag import Tag from petstore_api.models.user import User diff --git a/samples/client/petstore/python-asyncio/petstore_api/api/fake_api.py b/samples/client/petstore/python-asyncio/petstore_api/api/fake_api.py index be7767d8b65a..7c83ca0d064e 100644 --- a/samples/client/petstore/python-asyncio/petstore_api/api/fake_api.py +++ b/samples/client/petstore/python-asyncio/petstore_api/api/fake_api.py @@ -396,6 +396,101 @@ def fake_outer_string_serialize_with_http_info(self, **kwargs): # noqa: E501 _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) + def test_body_with_file_schema(self, file_schema_test_class, **kwargs): # noqa: E501 + """test_body_with_file_schema # noqa: E501 + + For this test, the body for this request much reference a schema named `File`. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.test_body_with_file_schema(file_schema_test_class, async=True) + >>> result = thread.get() + + :param async bool + :param FileSchemaTestClass file_schema_test_class: (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.test_body_with_file_schema_with_http_info(file_schema_test_class, **kwargs) # noqa: E501 + else: + (data) = self.test_body_with_file_schema_with_http_info(file_schema_test_class, **kwargs) # noqa: E501 + return data + + def test_body_with_file_schema_with_http_info(self, file_schema_test_class, **kwargs): # noqa: E501 + """test_body_with_file_schema # noqa: E501 + + For this test, the body for this request much reference a schema named `File`. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.test_body_with_file_schema_with_http_info(file_schema_test_class, async=True) + >>> result = thread.get() + + :param async bool + :param FileSchemaTestClass file_schema_test_class: (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['file_schema_test_class'] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method test_body_with_file_schema" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'file_schema_test_class' is set + if ('file_schema_test_class' not in params or + params['file_schema_test_class'] is None): + raise ValueError("Missing the required parameter `file_schema_test_class` when calling `test_body_with_file_schema`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'file_schema_test_class' in params: + body_params = params['file_schema_test_class'] + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/fake/body-with-file-schema', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + def test_body_with_query_params(self, query, user, **kwargs): # noqa: E501 """test_body_with_query_params # noqa: E501 diff --git a/samples/client/petstore/python-asyncio/petstore_api/api/pet_api.py b/samples/client/petstore/python-asyncio/petstore_api/api/pet_api.py index 5b62a0b12a5c..9eb0aa2eac61 100644 --- a/samples/client/petstore/python-asyncio/petstore_api/api/pet_api.py +++ b/samples/client/petstore/python-asyncio/petstore_api/api/pet_api.py @@ -803,3 +803,112 @@ def upload_file_with_http_info(self, pet_id, **kwargs): # noqa: E501 _preload_content=params.get('_preload_content', True), _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) + + def upload_file_with_required_file(self, pet_id, file, **kwargs): # noqa: E501 + """uploads an image (required) # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.upload_file_with_required_file(pet_id, file, async=True) + >>> result = thread.get() + + :param async bool + :param int pet_id: ID of pet to update (required) + :param file file: file to upload (required) + :param str additional_metadata: Additional data to pass to server + :return: ApiResponse + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.upload_file_with_required_file_with_http_info(pet_id, file, **kwargs) # noqa: E501 + else: + (data) = self.upload_file_with_required_file_with_http_info(pet_id, file, **kwargs) # noqa: E501 + return data + + def upload_file_with_required_file_with_http_info(self, pet_id, file, **kwargs): # noqa: E501 + """uploads an image (required) # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.upload_file_with_required_file_with_http_info(pet_id, file, async=True) + >>> result = thread.get() + + :param async bool + :param int pet_id: ID of pet to update (required) + :param file file: file to upload (required) + :param str additional_metadata: Additional data to pass to server + :return: ApiResponse + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['pet_id', 'file', 'additional_metadata'] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method upload_file_with_required_file" % 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 `upload_file_with_required_file`") # noqa: E501 + # verify the required parameter 'file' is set + if ('file' not in params or + params['file'] is None): + raise ValueError("Missing the required parameter `file` when calling `upload_file_with_required_file`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'pet_id' in params: + path_params['petId'] = params['pet_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + if 'additional_metadata' in params: + form_params.append(('additionalMetadata', params['additional_metadata'])) # noqa: E501 + if 'file' in params: + local_var_files['file'] = params['file'] # noqa: E501 + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['multipart/form-data']) # noqa: E501 + + # Authentication setting + auth_settings = ['petstore_auth'] # noqa: E501 + + return self.api_client.call_api( + '/fake/{petId}/uploadImageWithRequiredFile', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='ApiResponse', # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/samples/client/petstore/python-asyncio/petstore_api/api_client.py b/samples/client/petstore/python-asyncio/petstore_api/api_client.py index cff6604b98b2..c548ce4e2898 100644 --- a/samples/client/petstore/python-asyncio/petstore_api/api_client.py +++ b/samples/client/petstore/python-asyncio/petstore_api/api_client.py @@ -545,7 +545,7 @@ def __deserialize_primitive(self, data, klass): return data def __deserialize_object(self, value): - """Return a original value. + """Return an original value. :return: object. """ diff --git a/samples/client/petstore/python-asyncio/petstore_api/models/__init__.py b/samples/client/petstore/python-asyncio/petstore_api/models/__init__.py index 445cb787a19a..2450cb334f7e 100644 --- a/samples/client/petstore/python-asyncio/petstore_api/models/__init__.py +++ b/samples/client/petstore/python-asyncio/petstore_api/models/__init__.py @@ -30,6 +30,8 @@ from petstore_api.models.enum_arrays import EnumArrays from petstore_api.models.enum_class import EnumClass from petstore_api.models.enum_test import EnumTest +from petstore_api.models.file import File +from petstore_api.models.file_schema_test_class import FileSchemaTestClass from petstore_api.models.format_test import FormatTest from petstore_api.models.has_only_read_only import HasOnlyReadOnly from petstore_api.models.list import List @@ -45,5 +47,6 @@ from petstore_api.models.pet import Pet from petstore_api.models.read_only_first import ReadOnlyFirst from petstore_api.models.special_model_name import SpecialModelName +from petstore_api.models.string_boolean_map import StringBooleanMap from petstore_api.models.tag import Tag from petstore_api.models.user import User diff --git a/samples/client/petstore/python-asyncio/petstore_api/models/file.py b/samples/client/petstore/python-asyncio/petstore_api/models/file.py new file mode 100644 index 000000000000..34d77c3b4cf8 --- /dev/null +++ b/samples/client/petstore/python-asyncio/petstore_api/models/file.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 + + OpenAPI spec version: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +import pprint +import re # noqa: F401 + +import six + + +class File(object): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + """ + Attributes: + openapi_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + openapi_types = { + 'source_uri': 'str' + } + + attribute_map = { + 'source_uri': 'sourceURI' + } + + def __init__(self, source_uri=None): # noqa: E501 + """File - a model defined in OpenAPI""" # noqa: E501 + + self._source_uri = None + self.discriminator = None + + if source_uri is not None: + self.source_uri = source_uri + + @property + def source_uri(self): + """Gets the source_uri of this File. # noqa: E501 + + Test capitalization # noqa: E501 + + :return: The source_uri of this File. # noqa: E501 + :rtype: str + """ + return self._source_uri + + @source_uri.setter + def source_uri(self, source_uri): + """Sets the source_uri of this File. + + Test capitalization # noqa: E501 + + :param source_uri: The source_uri of this File. # noqa: E501 + :type: str + """ + + self._source_uri = source_uri + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.openapi_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 pprint.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""" + if not isinstance(other, File): + return False + + 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-asyncio/petstore_api/models/file_schema_test_class.py b/samples/client/petstore/python-asyncio/petstore_api/models/file_schema_test_class.py new file mode 100644 index 000000000000..026822dee749 --- /dev/null +++ b/samples/client/petstore/python-asyncio/petstore_api/models/file_schema_test_class.py @@ -0,0 +1,138 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 + + OpenAPI spec version: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +import pprint +import re # noqa: F401 + +import six + + +class FileSchemaTestClass(object): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + """ + Attributes: + openapi_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + openapi_types = { + 'file': 'File', + 'files': 'list[File]' + } + + attribute_map = { + 'file': 'file', + 'files': 'files' + } + + def __init__(self, file=None, files=None): # noqa: E501 + """FileSchemaTestClass - a model defined in OpenAPI""" # noqa: E501 + + self._file = None + self._files = None + self.discriminator = None + + if file is not None: + self.file = file + if files is not None: + self.files = files + + @property + def file(self): + """Gets the file of this FileSchemaTestClass. # noqa: E501 + + + :return: The file of this FileSchemaTestClass. # noqa: E501 + :rtype: File + """ + return self._file + + @file.setter + def file(self, file): + """Sets the file of this FileSchemaTestClass. + + + :param file: The file of this FileSchemaTestClass. # noqa: E501 + :type: File + """ + + self._file = file + + @property + def files(self): + """Gets the files of this FileSchemaTestClass. # noqa: E501 + + + :return: The files of this FileSchemaTestClass. # noqa: E501 + :rtype: list[File] + """ + return self._files + + @files.setter + def files(self, files): + """Sets the files of this FileSchemaTestClass. + + + :param files: The files of this FileSchemaTestClass. # noqa: E501 + :type: list[File] + """ + + self._files = files + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.openapi_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 pprint.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""" + if not isinstance(other, FileSchemaTestClass): + return False + + 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-asyncio/petstore_api/models/map_test.py b/samples/client/petstore/python-asyncio/petstore_api/models/map_test.py index 02ff04f98391..f2d1042556bf 100644 --- a/samples/client/petstore/python-asyncio/petstore_api/models/map_test.py +++ b/samples/client/petstore/python-asyncio/petstore_api/models/map_test.py @@ -32,25 +32,35 @@ class MapTest(object): """ openapi_types = { 'map_map_of_string': 'dict(str, dict(str, str))', - 'map_of_enum_string': 'dict(str, str)' + 'map_of_enum_string': 'dict(str, str)', + 'direct_map': 'dict(str, bool)', + 'indirect_map': 'StringBooleanMap' } attribute_map = { 'map_map_of_string': 'map_map_of_string', - 'map_of_enum_string': 'map_of_enum_string' + 'map_of_enum_string': 'map_of_enum_string', + 'direct_map': 'direct_map', + 'indirect_map': 'indirect_map' } - def __init__(self, map_map_of_string=None, map_of_enum_string=None): # noqa: E501 + def __init__(self, map_map_of_string=None, map_of_enum_string=None, direct_map=None, indirect_map=None): # noqa: E501 """MapTest - a model defined in OpenAPI""" # noqa: E501 self._map_map_of_string = None self._map_of_enum_string = None + self._direct_map = None + self._indirect_map = None self.discriminator = None if map_map_of_string is not None: self.map_map_of_string = map_map_of_string if map_of_enum_string is not None: self.map_of_enum_string = map_of_enum_string + if direct_map is not None: + self.direct_map = direct_map + if indirect_map is not None: + self.indirect_map = indirect_map @property def map_map_of_string(self): @@ -101,6 +111,48 @@ def map_of_enum_string(self, map_of_enum_string): self._map_of_enum_string = map_of_enum_string + @property + def direct_map(self): + """Gets the direct_map of this MapTest. # noqa: E501 + + + :return: The direct_map of this MapTest. # noqa: E501 + :rtype: dict(str, bool) + """ + return self._direct_map + + @direct_map.setter + def direct_map(self, direct_map): + """Sets the direct_map of this MapTest. + + + :param direct_map: The direct_map of this MapTest. # noqa: E501 + :type: dict(str, bool) + """ + + self._direct_map = direct_map + + @property + def indirect_map(self): + """Gets the indirect_map of this MapTest. # noqa: E501 + + + :return: The indirect_map of this MapTest. # noqa: E501 + :rtype: StringBooleanMap + """ + return self._indirect_map + + @indirect_map.setter + def indirect_map(self, indirect_map): + """Sets the indirect_map of this MapTest. + + + :param indirect_map: The indirect_map of this MapTest. # noqa: E501 + :type: StringBooleanMap + """ + + self._indirect_map = indirect_map + def to_dict(self): """Returns the model properties as a dict""" result = {} diff --git a/samples/client/petstore/python-asyncio/petstore_api/models/string_boolean_map.py b/samples/client/petstore/python-asyncio/petstore_api/models/string_boolean_map.py new file mode 100644 index 000000000000..e837adf61958 --- /dev/null +++ b/samples/client/petstore/python-asyncio/petstore_api/models/string_boolean_map.py @@ -0,0 +1,84 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 + + OpenAPI spec version: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +import pprint +import re # noqa: F401 + +import six + + +class StringBooleanMap(object): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + """ + Attributes: + openapi_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + openapi_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """StringBooleanMap - a model defined in OpenAPI""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.openapi_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 pprint.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""" + if not isinstance(other, StringBooleanMap): + return False + + 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-asyncio/test/test_file.py b/samples/client/petstore/python-asyncio/test/test_file.py new file mode 100644 index 000000000000..cc32edb7b523 --- /dev/null +++ b/samples/client/petstore/python-asyncio/test/test_file.py @@ -0,0 +1,39 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 + + OpenAPI spec version: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +from __future__ import absolute_import + +import unittest + +import petstore_api +from petstore_api.models.file import File # noqa: E501 +from petstore_api.rest import ApiException + + +class TestFile(unittest.TestCase): + """File unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testFile(self): + """Test File""" + # FIXME: construct object with mandatory attributes with example values + # model = petstore_api.models.file.File() # noqa: E501 + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-asyncio/test/test_file_schema_test_class.py b/samples/client/petstore/python-asyncio/test/test_file_schema_test_class.py new file mode 100644 index 000000000000..91e1b6a1c745 --- /dev/null +++ b/samples/client/petstore/python-asyncio/test/test_file_schema_test_class.py @@ -0,0 +1,39 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 + + OpenAPI spec version: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +from __future__ import absolute_import + +import unittest + +import petstore_api +from petstore_api.models.file_schema_test_class import FileSchemaTestClass # noqa: E501 +from petstore_api.rest import ApiException + + +class TestFileSchemaTestClass(unittest.TestCase): + """FileSchemaTestClass unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testFileSchemaTestClass(self): + """Test FileSchemaTestClass""" + # FIXME: construct object with mandatory attributes with example values + # model = petstore_api.models.file_schema_test_class.FileSchemaTestClass() # noqa: E501 + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-asyncio/test/test_string_boolean_map.py b/samples/client/petstore/python-asyncio/test/test_string_boolean_map.py new file mode 100644 index 000000000000..47dd8529a1a3 --- /dev/null +++ b/samples/client/petstore/python-asyncio/test/test_string_boolean_map.py @@ -0,0 +1,39 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 + + OpenAPI spec version: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +from __future__ import absolute_import + +import unittest + +import petstore_api +from petstore_api.models.string_boolean_map import StringBooleanMap # noqa: E501 +from petstore_api.rest import ApiException + + +class TestStringBooleanMap(unittest.TestCase): + """StringBooleanMap unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testStringBooleanMap(self): + """Test StringBooleanMap""" + # FIXME: construct object with mandatory attributes with example values + # model = petstore_api.models.string_boolean_map.StringBooleanMap() # noqa: E501 + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-tornado/.openapi-generator/VERSION b/samples/client/petstore/python-tornado/.openapi-generator/VERSION index 096bf47efe31..a0cd9f0ccb01 100644 --- a/samples/client/petstore/python-tornado/.openapi-generator/VERSION +++ b/samples/client/petstore/python-tornado/.openapi-generator/VERSION @@ -1 +1 @@ -3.0.0-SNAPSHOT \ No newline at end of file +3.1.0 \ No newline at end of file diff --git a/samples/client/petstore/python-tornado/README.md b/samples/client/petstore/python-tornado/README.md index b88da343a42c..40e3e1e2e76c 100644 --- a/samples/client/petstore/python-tornado/README.md +++ b/samples/client/petstore/python-tornado/README.md @@ -75,6 +75,7 @@ Class | Method | HTTP request | Description *FakeApi* | [**fake_outer_composite_serialize**](docs/FakeApi.md#fake_outer_composite_serialize) | **POST** /fake/outer/composite | *FakeApi* | [**fake_outer_number_serialize**](docs/FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number | *FakeApi* | [**fake_outer_string_serialize**](docs/FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string | +*FakeApi* | [**test_body_with_file_schema**](docs/FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema | *FakeApi* | [**test_body_with_query_params**](docs/FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params | *FakeApi* | [**test_client_model**](docs/FakeApi.md#test_client_model) | **PATCH** /fake | To test \"client\" model *FakeApi* | [**test_endpoint_parameters**](docs/FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -90,6 +91,7 @@ Class | Method | HTTP request | Description *PetApi* | [**update_pet**](docs/PetApi.md#update_pet) | **PUT** /pet | Update an existing pet *PetApi* | [**update_pet_with_form**](docs/PetApi.md#update_pet_with_form) | **POST** /pet/{petId} | Updates a pet in the store with form data *PetApi* | [**upload_file**](docs/PetApi.md#upload_file) | **POST** /pet/{petId}/uploadImage | uploads an image +*PetApi* | [**upload_file_with_required_file**](docs/PetApi.md#upload_file_with_required_file) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) *StoreApi* | [**delete_order**](docs/StoreApi.md#delete_order) | **DELETE** /store/order/{order_id} | Delete purchase order by ID *StoreApi* | [**get_inventory**](docs/StoreApi.md#get_inventory) | **GET** /store/inventory | Returns pet inventories by status *StoreApi* | [**get_order_by_id**](docs/StoreApi.md#get_order_by_id) | **GET** /store/order/{order_id} | Find purchase order by ID @@ -122,6 +124,8 @@ Class | Method | HTTP request | Description - [EnumArrays](docs/EnumArrays.md) - [EnumClass](docs/EnumClass.md) - [EnumTest](docs/EnumTest.md) + - [File](docs/File.md) + - [FileSchemaTestClass](docs/FileSchemaTestClass.md) - [FormatTest](docs/FormatTest.md) - [HasOnlyReadOnly](docs/HasOnlyReadOnly.md) - [List](docs/List.md) @@ -137,6 +141,7 @@ Class | Method | HTTP request | Description - [Pet](docs/Pet.md) - [ReadOnlyFirst](docs/ReadOnlyFirst.md) - [SpecialModelName](docs/SpecialModelName.md) + - [StringBooleanMap](docs/StringBooleanMap.md) - [Tag](docs/Tag.md) - [User](docs/User.md) diff --git a/samples/client/petstore/python-tornado/docs/FakeApi.md b/samples/client/petstore/python-tornado/docs/FakeApi.md index 3b30ab1b4e9c..3510abda8b79 100644 --- a/samples/client/petstore/python-tornado/docs/FakeApi.md +++ b/samples/client/petstore/python-tornado/docs/FakeApi.md @@ -8,6 +8,7 @@ Method | HTTP request | Description [**fake_outer_composite_serialize**](FakeApi.md#fake_outer_composite_serialize) | **POST** /fake/outer/composite | [**fake_outer_number_serialize**](FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number | [**fake_outer_string_serialize**](FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string | +[**test_body_with_file_schema**](FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema | [**test_body_with_query_params**](FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params | [**test_client_model**](FakeApi.md#test_client_model) | **PATCH** /fake | To test \"client\" model [**test_endpoint_parameters**](FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -204,6 +205,52 @@ No authorization required [[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) +# **test_body_with_file_schema** +> test_body_with_file_schema(file_schema_test_class) + + + +For this test, the body for this request much reference a schema named `File`. + +### Example +```python +from __future__ import print_function +import time +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# create an instance of the API class +api_instance = petstore_api.FakeApi() +file_schema_test_class = petstore_api.FileSchemaTestClass() # FileSchemaTestClass | + +try: + api_instance.test_body_with_file_schema(file_schema_test_class) +except ApiException as e: + print("Exception when calling FakeApi->test_body_with_file_schema: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **file_schema_test_class** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +[[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) + # **test_body_with_query_params** > test_body_with_query_params(query, user) diff --git a/samples/client/petstore/python-tornado/docs/File.md b/samples/client/petstore/python-tornado/docs/File.md new file mode 100644 index 000000000000..6a925f0a7af4 --- /dev/null +++ b/samples/client/petstore/python-tornado/docs/File.md @@ -0,0 +1,10 @@ +# File + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**source_uri** | **str** | Test capitalization | [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/python-tornado/docs/FileSchemaTestClass.md b/samples/client/petstore/python-tornado/docs/FileSchemaTestClass.md new file mode 100644 index 000000000000..dc3722289887 --- /dev/null +++ b/samples/client/petstore/python-tornado/docs/FileSchemaTestClass.md @@ -0,0 +1,11 @@ +# FileSchemaTestClass + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**file** | [**File**](File.md) | | [optional] +**files** | [**list[File]**](File.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/python-tornado/docs/MapTest.md b/samples/client/petstore/python-tornado/docs/MapTest.md index 68844755d420..ee6036eb2f42 100644 --- a/samples/client/petstore/python-tornado/docs/MapTest.md +++ b/samples/client/petstore/python-tornado/docs/MapTest.md @@ -5,6 +5,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **map_map_of_string** | **dict(str, dict(str, str))** | | [optional] **map_of_enum_string** | **dict(str, str)** | | [optional] +**direct_map** | **dict(str, bool)** | | [optional] +**indirect_map** | [**StringBooleanMap**](StringBooleanMap.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/python-tornado/docs/PetApi.md b/samples/client/petstore/python-tornado/docs/PetApi.md index 748cf407ea45..583883799e2e 100644 --- a/samples/client/petstore/python-tornado/docs/PetApi.md +++ b/samples/client/petstore/python-tornado/docs/PetApi.md @@ -12,6 +12,7 @@ Method | HTTP request | Description [**update_pet**](PetApi.md#update_pet) | **PUT** /pet | Update an existing pet [**update_pet_with_form**](PetApi.md#update_pet_with_form) | **POST** /pet/{petId} | Updates a pet in the store with form data [**upload_file**](PetApi.md#upload_file) | **POST** /pet/{petId}/uploadImage | uploads an image +[**upload_file_with_required_file**](PetApi.md#upload_file_with_required_file) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) # **add_pet** @@ -428,3 +429,57 @@ Name | Type | Description | Notes [[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) +# **upload_file_with_required_file** +> ApiResponse upload_file_with_required_file(pet_id, file, additional_metadata=additional_metadata) + +uploads an image (required) + +### Example +```python +from __future__ import print_function +import time +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration() +configuration.access_token = 'YOUR_ACCESS_TOKEN' + +# create an instance of the API class +api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration)) +pet_id = 56 # int | ID of pet to update +file = '/path/to/file' # file | file to upload +additional_metadata = 'additional_metadata_example' # str | Additional data to pass to server (optional) + +try: + # uploads an image (required) + api_response = api_instance.upload_file_with_required_file(pet_id, file, additional_metadata=additional_metadata) + pprint(api_response) +except ApiException as e: + print("Exception when calling PetApi->upload_file_with_required_file: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet_id** | **int**| ID of pet to update | + **file** | **file**| file to upload | + **additional_metadata** | **str**| Additional data to pass to server | [optional] + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + +[[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/python-tornado/docs/StringBooleanMap.md b/samples/client/petstore/python-tornado/docs/StringBooleanMap.md new file mode 100644 index 000000000000..7abf11ec68b1 --- /dev/null +++ b/samples/client/petstore/python-tornado/docs/StringBooleanMap.md @@ -0,0 +1,9 @@ +# StringBooleanMap + +## 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/python-tornado/petstore_api/__init__.py b/samples/client/petstore/python-tornado/petstore_api/__init__.py index 565f09697410..ec4d33177cc0 100644 --- a/samples/client/petstore/python-tornado/petstore_api/__init__.py +++ b/samples/client/petstore/python-tornado/petstore_api/__init__.py @@ -42,6 +42,8 @@ from petstore_api.models.enum_arrays import EnumArrays from petstore_api.models.enum_class import EnumClass from petstore_api.models.enum_test import EnumTest +from petstore_api.models.file import File +from petstore_api.models.file_schema_test_class import FileSchemaTestClass from petstore_api.models.format_test import FormatTest from petstore_api.models.has_only_read_only import HasOnlyReadOnly from petstore_api.models.list import List @@ -57,5 +59,6 @@ from petstore_api.models.pet import Pet from petstore_api.models.read_only_first import ReadOnlyFirst from petstore_api.models.special_model_name import SpecialModelName +from petstore_api.models.string_boolean_map import StringBooleanMap from petstore_api.models.tag import Tag from petstore_api.models.user import User diff --git a/samples/client/petstore/python-tornado/petstore_api/api/fake_api.py b/samples/client/petstore/python-tornado/petstore_api/api/fake_api.py index be7767d8b65a..7c83ca0d064e 100644 --- a/samples/client/petstore/python-tornado/petstore_api/api/fake_api.py +++ b/samples/client/petstore/python-tornado/petstore_api/api/fake_api.py @@ -396,6 +396,101 @@ def fake_outer_string_serialize_with_http_info(self, **kwargs): # noqa: E501 _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) + def test_body_with_file_schema(self, file_schema_test_class, **kwargs): # noqa: E501 + """test_body_with_file_schema # noqa: E501 + + For this test, the body for this request much reference a schema named `File`. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.test_body_with_file_schema(file_schema_test_class, async=True) + >>> result = thread.get() + + :param async bool + :param FileSchemaTestClass file_schema_test_class: (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.test_body_with_file_schema_with_http_info(file_schema_test_class, **kwargs) # noqa: E501 + else: + (data) = self.test_body_with_file_schema_with_http_info(file_schema_test_class, **kwargs) # noqa: E501 + return data + + def test_body_with_file_schema_with_http_info(self, file_schema_test_class, **kwargs): # noqa: E501 + """test_body_with_file_schema # noqa: E501 + + For this test, the body for this request much reference a schema named `File`. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.test_body_with_file_schema_with_http_info(file_schema_test_class, async=True) + >>> result = thread.get() + + :param async bool + :param FileSchemaTestClass file_schema_test_class: (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['file_schema_test_class'] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method test_body_with_file_schema" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'file_schema_test_class' is set + if ('file_schema_test_class' not in params or + params['file_schema_test_class'] is None): + raise ValueError("Missing the required parameter `file_schema_test_class` when calling `test_body_with_file_schema`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'file_schema_test_class' in params: + body_params = params['file_schema_test_class'] + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/fake/body-with-file-schema', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + def test_body_with_query_params(self, query, user, **kwargs): # noqa: E501 """test_body_with_query_params # noqa: E501 diff --git a/samples/client/petstore/python-tornado/petstore_api/api/pet_api.py b/samples/client/petstore/python-tornado/petstore_api/api/pet_api.py index 5b62a0b12a5c..9eb0aa2eac61 100644 --- a/samples/client/petstore/python-tornado/petstore_api/api/pet_api.py +++ b/samples/client/petstore/python-tornado/petstore_api/api/pet_api.py @@ -803,3 +803,112 @@ def upload_file_with_http_info(self, pet_id, **kwargs): # noqa: E501 _preload_content=params.get('_preload_content', True), _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) + + def upload_file_with_required_file(self, pet_id, file, **kwargs): # noqa: E501 + """uploads an image (required) # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.upload_file_with_required_file(pet_id, file, async=True) + >>> result = thread.get() + + :param async bool + :param int pet_id: ID of pet to update (required) + :param file file: file to upload (required) + :param str additional_metadata: Additional data to pass to server + :return: ApiResponse + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.upload_file_with_required_file_with_http_info(pet_id, file, **kwargs) # noqa: E501 + else: + (data) = self.upload_file_with_required_file_with_http_info(pet_id, file, **kwargs) # noqa: E501 + return data + + def upload_file_with_required_file_with_http_info(self, pet_id, file, **kwargs): # noqa: E501 + """uploads an image (required) # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.upload_file_with_required_file_with_http_info(pet_id, file, async=True) + >>> result = thread.get() + + :param async bool + :param int pet_id: ID of pet to update (required) + :param file file: file to upload (required) + :param str additional_metadata: Additional data to pass to server + :return: ApiResponse + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['pet_id', 'file', 'additional_metadata'] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method upload_file_with_required_file" % 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 `upload_file_with_required_file`") # noqa: E501 + # verify the required parameter 'file' is set + if ('file' not in params or + params['file'] is None): + raise ValueError("Missing the required parameter `file` when calling `upload_file_with_required_file`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'pet_id' in params: + path_params['petId'] = params['pet_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + if 'additional_metadata' in params: + form_params.append(('additionalMetadata', params['additional_metadata'])) # noqa: E501 + if 'file' in params: + local_var_files['file'] = params['file'] # noqa: E501 + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['multipart/form-data']) # noqa: E501 + + # Authentication setting + auth_settings = ['petstore_auth'] # noqa: E501 + + return self.api_client.call_api( + '/fake/{petId}/uploadImageWithRequiredFile', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='ApiResponse', # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/samples/client/petstore/python-tornado/petstore_api/api_client.py b/samples/client/petstore/python-tornado/petstore_api/api_client.py index a98c0247a0ce..65e37617061a 100644 --- a/samples/client/petstore/python-tornado/petstore_api/api_client.py +++ b/samples/client/petstore/python-tornado/petstore_api/api_client.py @@ -547,7 +547,7 @@ def __deserialize_primitive(self, data, klass): return data def __deserialize_object(self, value): - """Return a original value. + """Return an original value. :return: object. """ diff --git a/samples/client/petstore/python-tornado/petstore_api/models/__init__.py b/samples/client/petstore/python-tornado/petstore_api/models/__init__.py index 445cb787a19a..2450cb334f7e 100644 --- a/samples/client/petstore/python-tornado/petstore_api/models/__init__.py +++ b/samples/client/petstore/python-tornado/petstore_api/models/__init__.py @@ -30,6 +30,8 @@ from petstore_api.models.enum_arrays import EnumArrays from petstore_api.models.enum_class import EnumClass from petstore_api.models.enum_test import EnumTest +from petstore_api.models.file import File +from petstore_api.models.file_schema_test_class import FileSchemaTestClass from petstore_api.models.format_test import FormatTest from petstore_api.models.has_only_read_only import HasOnlyReadOnly from petstore_api.models.list import List @@ -45,5 +47,6 @@ from petstore_api.models.pet import Pet from petstore_api.models.read_only_first import ReadOnlyFirst from petstore_api.models.special_model_name import SpecialModelName +from petstore_api.models.string_boolean_map import StringBooleanMap from petstore_api.models.tag import Tag from petstore_api.models.user import User diff --git a/samples/client/petstore/python-tornado/petstore_api/models/file.py b/samples/client/petstore/python-tornado/petstore_api/models/file.py new file mode 100644 index 000000000000..34d77c3b4cf8 --- /dev/null +++ b/samples/client/petstore/python-tornado/petstore_api/models/file.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 + + OpenAPI spec version: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +import pprint +import re # noqa: F401 + +import six + + +class File(object): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + """ + Attributes: + openapi_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + openapi_types = { + 'source_uri': 'str' + } + + attribute_map = { + 'source_uri': 'sourceURI' + } + + def __init__(self, source_uri=None): # noqa: E501 + """File - a model defined in OpenAPI""" # noqa: E501 + + self._source_uri = None + self.discriminator = None + + if source_uri is not None: + self.source_uri = source_uri + + @property + def source_uri(self): + """Gets the source_uri of this File. # noqa: E501 + + Test capitalization # noqa: E501 + + :return: The source_uri of this File. # noqa: E501 + :rtype: str + """ + return self._source_uri + + @source_uri.setter + def source_uri(self, source_uri): + """Sets the source_uri of this File. + + Test capitalization # noqa: E501 + + :param source_uri: The source_uri of this File. # noqa: E501 + :type: str + """ + + self._source_uri = source_uri + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.openapi_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 pprint.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""" + if not isinstance(other, File): + return False + + 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-tornado/petstore_api/models/file_schema_test_class.py b/samples/client/petstore/python-tornado/petstore_api/models/file_schema_test_class.py new file mode 100644 index 000000000000..026822dee749 --- /dev/null +++ b/samples/client/petstore/python-tornado/petstore_api/models/file_schema_test_class.py @@ -0,0 +1,138 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 + + OpenAPI spec version: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +import pprint +import re # noqa: F401 + +import six + + +class FileSchemaTestClass(object): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + """ + Attributes: + openapi_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + openapi_types = { + 'file': 'File', + 'files': 'list[File]' + } + + attribute_map = { + 'file': 'file', + 'files': 'files' + } + + def __init__(self, file=None, files=None): # noqa: E501 + """FileSchemaTestClass - a model defined in OpenAPI""" # noqa: E501 + + self._file = None + self._files = None + self.discriminator = None + + if file is not None: + self.file = file + if files is not None: + self.files = files + + @property + def file(self): + """Gets the file of this FileSchemaTestClass. # noqa: E501 + + + :return: The file of this FileSchemaTestClass. # noqa: E501 + :rtype: File + """ + return self._file + + @file.setter + def file(self, file): + """Sets the file of this FileSchemaTestClass. + + + :param file: The file of this FileSchemaTestClass. # noqa: E501 + :type: File + """ + + self._file = file + + @property + def files(self): + """Gets the files of this FileSchemaTestClass. # noqa: E501 + + + :return: The files of this FileSchemaTestClass. # noqa: E501 + :rtype: list[File] + """ + return self._files + + @files.setter + def files(self, files): + """Sets the files of this FileSchemaTestClass. + + + :param files: The files of this FileSchemaTestClass. # noqa: E501 + :type: list[File] + """ + + self._files = files + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.openapi_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 pprint.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""" + if not isinstance(other, FileSchemaTestClass): + return False + + 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-tornado/petstore_api/models/map_test.py b/samples/client/petstore/python-tornado/petstore_api/models/map_test.py index 02ff04f98391..f2d1042556bf 100644 --- a/samples/client/petstore/python-tornado/petstore_api/models/map_test.py +++ b/samples/client/petstore/python-tornado/petstore_api/models/map_test.py @@ -32,25 +32,35 @@ class MapTest(object): """ openapi_types = { 'map_map_of_string': 'dict(str, dict(str, str))', - 'map_of_enum_string': 'dict(str, str)' + 'map_of_enum_string': 'dict(str, str)', + 'direct_map': 'dict(str, bool)', + 'indirect_map': 'StringBooleanMap' } attribute_map = { 'map_map_of_string': 'map_map_of_string', - 'map_of_enum_string': 'map_of_enum_string' + 'map_of_enum_string': 'map_of_enum_string', + 'direct_map': 'direct_map', + 'indirect_map': 'indirect_map' } - def __init__(self, map_map_of_string=None, map_of_enum_string=None): # noqa: E501 + def __init__(self, map_map_of_string=None, map_of_enum_string=None, direct_map=None, indirect_map=None): # noqa: E501 """MapTest - a model defined in OpenAPI""" # noqa: E501 self._map_map_of_string = None self._map_of_enum_string = None + self._direct_map = None + self._indirect_map = None self.discriminator = None if map_map_of_string is not None: self.map_map_of_string = map_map_of_string if map_of_enum_string is not None: self.map_of_enum_string = map_of_enum_string + if direct_map is not None: + self.direct_map = direct_map + if indirect_map is not None: + self.indirect_map = indirect_map @property def map_map_of_string(self): @@ -101,6 +111,48 @@ def map_of_enum_string(self, map_of_enum_string): self._map_of_enum_string = map_of_enum_string + @property + def direct_map(self): + """Gets the direct_map of this MapTest. # noqa: E501 + + + :return: The direct_map of this MapTest. # noqa: E501 + :rtype: dict(str, bool) + """ + return self._direct_map + + @direct_map.setter + def direct_map(self, direct_map): + """Sets the direct_map of this MapTest. + + + :param direct_map: The direct_map of this MapTest. # noqa: E501 + :type: dict(str, bool) + """ + + self._direct_map = direct_map + + @property + def indirect_map(self): + """Gets the indirect_map of this MapTest. # noqa: E501 + + + :return: The indirect_map of this MapTest. # noqa: E501 + :rtype: StringBooleanMap + """ + return self._indirect_map + + @indirect_map.setter + def indirect_map(self, indirect_map): + """Sets the indirect_map of this MapTest. + + + :param indirect_map: The indirect_map of this MapTest. # noqa: E501 + :type: StringBooleanMap + """ + + self._indirect_map = indirect_map + def to_dict(self): """Returns the model properties as a dict""" result = {} diff --git a/samples/client/petstore/python-tornado/petstore_api/models/string_boolean_map.py b/samples/client/petstore/python-tornado/petstore_api/models/string_boolean_map.py new file mode 100644 index 000000000000..e837adf61958 --- /dev/null +++ b/samples/client/petstore/python-tornado/petstore_api/models/string_boolean_map.py @@ -0,0 +1,84 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 + + OpenAPI spec version: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +import pprint +import re # noqa: F401 + +import six + + +class StringBooleanMap(object): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + """ + Attributes: + openapi_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + openapi_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """StringBooleanMap - a model defined in OpenAPI""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.openapi_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 pprint.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""" + if not isinstance(other, StringBooleanMap): + return False + + 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-tornado/test/test_file.py b/samples/client/petstore/python-tornado/test/test_file.py new file mode 100644 index 000000000000..cc32edb7b523 --- /dev/null +++ b/samples/client/petstore/python-tornado/test/test_file.py @@ -0,0 +1,39 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 + + OpenAPI spec version: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +from __future__ import absolute_import + +import unittest + +import petstore_api +from petstore_api.models.file import File # noqa: E501 +from petstore_api.rest import ApiException + + +class TestFile(unittest.TestCase): + """File unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testFile(self): + """Test File""" + # FIXME: construct object with mandatory attributes with example values + # model = petstore_api.models.file.File() # noqa: E501 + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-tornado/test/test_file_schema_test_class.py b/samples/client/petstore/python-tornado/test/test_file_schema_test_class.py new file mode 100644 index 000000000000..91e1b6a1c745 --- /dev/null +++ b/samples/client/petstore/python-tornado/test/test_file_schema_test_class.py @@ -0,0 +1,39 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 + + OpenAPI spec version: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +from __future__ import absolute_import + +import unittest + +import petstore_api +from petstore_api.models.file_schema_test_class import FileSchemaTestClass # noqa: E501 +from petstore_api.rest import ApiException + + +class TestFileSchemaTestClass(unittest.TestCase): + """FileSchemaTestClass unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testFileSchemaTestClass(self): + """Test FileSchemaTestClass""" + # FIXME: construct object with mandatory attributes with example values + # model = petstore_api.models.file_schema_test_class.FileSchemaTestClass() # noqa: E501 + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-tornado/test/test_string_boolean_map.py b/samples/client/petstore/python-tornado/test/test_string_boolean_map.py new file mode 100644 index 000000000000..47dd8529a1a3 --- /dev/null +++ b/samples/client/petstore/python-tornado/test/test_string_boolean_map.py @@ -0,0 +1,39 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 + + OpenAPI spec version: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +from __future__ import absolute_import + +import unittest + +import petstore_api +from petstore_api.models.string_boolean_map import StringBooleanMap # noqa: E501 +from petstore_api.rest import ApiException + + +class TestStringBooleanMap(unittest.TestCase): + """StringBooleanMap unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testStringBooleanMap(self): + """Test StringBooleanMap""" + # FIXME: construct object with mandatory attributes with example values + # model = petstore_api.models.string_boolean_map.StringBooleanMap() # noqa: E501 + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python/.openapi-generator/VERSION b/samples/client/petstore/python/.openapi-generator/VERSION index 096bf47efe31..a0cd9f0ccb01 100644 --- a/samples/client/petstore/python/.openapi-generator/VERSION +++ b/samples/client/petstore/python/.openapi-generator/VERSION @@ -1 +1 @@ -3.0.0-SNAPSHOT \ No newline at end of file +3.1.0 \ No newline at end of file diff --git a/samples/client/petstore/python/README.md b/samples/client/petstore/python/README.md index b88da343a42c..40e3e1e2e76c 100644 --- a/samples/client/petstore/python/README.md +++ b/samples/client/petstore/python/README.md @@ -75,6 +75,7 @@ Class | Method | HTTP request | Description *FakeApi* | [**fake_outer_composite_serialize**](docs/FakeApi.md#fake_outer_composite_serialize) | **POST** /fake/outer/composite | *FakeApi* | [**fake_outer_number_serialize**](docs/FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number | *FakeApi* | [**fake_outer_string_serialize**](docs/FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string | +*FakeApi* | [**test_body_with_file_schema**](docs/FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema | *FakeApi* | [**test_body_with_query_params**](docs/FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params | *FakeApi* | [**test_client_model**](docs/FakeApi.md#test_client_model) | **PATCH** /fake | To test \"client\" model *FakeApi* | [**test_endpoint_parameters**](docs/FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -90,6 +91,7 @@ Class | Method | HTTP request | Description *PetApi* | [**update_pet**](docs/PetApi.md#update_pet) | **PUT** /pet | Update an existing pet *PetApi* | [**update_pet_with_form**](docs/PetApi.md#update_pet_with_form) | **POST** /pet/{petId} | Updates a pet in the store with form data *PetApi* | [**upload_file**](docs/PetApi.md#upload_file) | **POST** /pet/{petId}/uploadImage | uploads an image +*PetApi* | [**upload_file_with_required_file**](docs/PetApi.md#upload_file_with_required_file) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) *StoreApi* | [**delete_order**](docs/StoreApi.md#delete_order) | **DELETE** /store/order/{order_id} | Delete purchase order by ID *StoreApi* | [**get_inventory**](docs/StoreApi.md#get_inventory) | **GET** /store/inventory | Returns pet inventories by status *StoreApi* | [**get_order_by_id**](docs/StoreApi.md#get_order_by_id) | **GET** /store/order/{order_id} | Find purchase order by ID @@ -122,6 +124,8 @@ Class | Method | HTTP request | Description - [EnumArrays](docs/EnumArrays.md) - [EnumClass](docs/EnumClass.md) - [EnumTest](docs/EnumTest.md) + - [File](docs/File.md) + - [FileSchemaTestClass](docs/FileSchemaTestClass.md) - [FormatTest](docs/FormatTest.md) - [HasOnlyReadOnly](docs/HasOnlyReadOnly.md) - [List](docs/List.md) @@ -137,6 +141,7 @@ Class | Method | HTTP request | Description - [Pet](docs/Pet.md) - [ReadOnlyFirst](docs/ReadOnlyFirst.md) - [SpecialModelName](docs/SpecialModelName.md) + - [StringBooleanMap](docs/StringBooleanMap.md) - [Tag](docs/Tag.md) - [User](docs/User.md) diff --git a/samples/client/petstore/python/docs/FakeApi.md b/samples/client/petstore/python/docs/FakeApi.md index 3b30ab1b4e9c..3510abda8b79 100644 --- a/samples/client/petstore/python/docs/FakeApi.md +++ b/samples/client/petstore/python/docs/FakeApi.md @@ -8,6 +8,7 @@ Method | HTTP request | Description [**fake_outer_composite_serialize**](FakeApi.md#fake_outer_composite_serialize) | **POST** /fake/outer/composite | [**fake_outer_number_serialize**](FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number | [**fake_outer_string_serialize**](FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string | +[**test_body_with_file_schema**](FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema | [**test_body_with_query_params**](FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params | [**test_client_model**](FakeApi.md#test_client_model) | **PATCH** /fake | To test \"client\" model [**test_endpoint_parameters**](FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -204,6 +205,52 @@ No authorization required [[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) +# **test_body_with_file_schema** +> test_body_with_file_schema(file_schema_test_class) + + + +For this test, the body for this request much reference a schema named `File`. + +### Example +```python +from __future__ import print_function +import time +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# create an instance of the API class +api_instance = petstore_api.FakeApi() +file_schema_test_class = petstore_api.FileSchemaTestClass() # FileSchemaTestClass | + +try: + api_instance.test_body_with_file_schema(file_schema_test_class) +except ApiException as e: + print("Exception when calling FakeApi->test_body_with_file_schema: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **file_schema_test_class** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +[[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) + # **test_body_with_query_params** > test_body_with_query_params(query, user) diff --git a/samples/client/petstore/python/docs/File.md b/samples/client/petstore/python/docs/File.md new file mode 100644 index 000000000000..6a925f0a7af4 --- /dev/null +++ b/samples/client/petstore/python/docs/File.md @@ -0,0 +1,10 @@ +# File + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**source_uri** | **str** | Test capitalization | [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/python/docs/FileSchemaTestClass.md b/samples/client/petstore/python/docs/FileSchemaTestClass.md new file mode 100644 index 000000000000..dc3722289887 --- /dev/null +++ b/samples/client/petstore/python/docs/FileSchemaTestClass.md @@ -0,0 +1,11 @@ +# FileSchemaTestClass + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**file** | [**File**](File.md) | | [optional] +**files** | [**list[File]**](File.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/python/docs/MapTest.md b/samples/client/petstore/python/docs/MapTest.md index 68844755d420..ee6036eb2f42 100644 --- a/samples/client/petstore/python/docs/MapTest.md +++ b/samples/client/petstore/python/docs/MapTest.md @@ -5,6 +5,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **map_map_of_string** | **dict(str, dict(str, str))** | | [optional] **map_of_enum_string** | **dict(str, str)** | | [optional] +**direct_map** | **dict(str, bool)** | | [optional] +**indirect_map** | [**StringBooleanMap**](StringBooleanMap.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/python/docs/PetApi.md b/samples/client/petstore/python/docs/PetApi.md index 748cf407ea45..583883799e2e 100644 --- a/samples/client/petstore/python/docs/PetApi.md +++ b/samples/client/petstore/python/docs/PetApi.md @@ -12,6 +12,7 @@ Method | HTTP request | Description [**update_pet**](PetApi.md#update_pet) | **PUT** /pet | Update an existing pet [**update_pet_with_form**](PetApi.md#update_pet_with_form) | **POST** /pet/{petId} | Updates a pet in the store with form data [**upload_file**](PetApi.md#upload_file) | **POST** /pet/{petId}/uploadImage | uploads an image +[**upload_file_with_required_file**](PetApi.md#upload_file_with_required_file) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) # **add_pet** @@ -428,3 +429,57 @@ Name | Type | Description | Notes [[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) +# **upload_file_with_required_file** +> ApiResponse upload_file_with_required_file(pet_id, file, additional_metadata=additional_metadata) + +uploads an image (required) + +### Example +```python +from __future__ import print_function +import time +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration() +configuration.access_token = 'YOUR_ACCESS_TOKEN' + +# create an instance of the API class +api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration)) +pet_id = 56 # int | ID of pet to update +file = '/path/to/file' # file | file to upload +additional_metadata = 'additional_metadata_example' # str | Additional data to pass to server (optional) + +try: + # uploads an image (required) + api_response = api_instance.upload_file_with_required_file(pet_id, file, additional_metadata=additional_metadata) + pprint(api_response) +except ApiException as e: + print("Exception when calling PetApi->upload_file_with_required_file: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet_id** | **int**| ID of pet to update | + **file** | **file**| file to upload | + **additional_metadata** | **str**| Additional data to pass to server | [optional] + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + +[[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/python/docs/StringBooleanMap.md b/samples/client/petstore/python/docs/StringBooleanMap.md new file mode 100644 index 000000000000..7abf11ec68b1 --- /dev/null +++ b/samples/client/petstore/python/docs/StringBooleanMap.md @@ -0,0 +1,9 @@ +# StringBooleanMap + +## 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/python/petstore_api/__init__.py b/samples/client/petstore/python/petstore_api/__init__.py index 565f09697410..ec4d33177cc0 100644 --- a/samples/client/petstore/python/petstore_api/__init__.py +++ b/samples/client/petstore/python/petstore_api/__init__.py @@ -42,6 +42,8 @@ from petstore_api.models.enum_arrays import EnumArrays from petstore_api.models.enum_class import EnumClass from petstore_api.models.enum_test import EnumTest +from petstore_api.models.file import File +from petstore_api.models.file_schema_test_class import FileSchemaTestClass from petstore_api.models.format_test import FormatTest from petstore_api.models.has_only_read_only import HasOnlyReadOnly from petstore_api.models.list import List @@ -57,5 +59,6 @@ from petstore_api.models.pet import Pet from petstore_api.models.read_only_first import ReadOnlyFirst from petstore_api.models.special_model_name import SpecialModelName +from petstore_api.models.string_boolean_map import StringBooleanMap from petstore_api.models.tag import Tag from petstore_api.models.user import User diff --git a/samples/client/petstore/python/petstore_api/api/fake_api.py b/samples/client/petstore/python/petstore_api/api/fake_api.py index be7767d8b65a..7c83ca0d064e 100644 --- a/samples/client/petstore/python/petstore_api/api/fake_api.py +++ b/samples/client/petstore/python/petstore_api/api/fake_api.py @@ -396,6 +396,101 @@ def fake_outer_string_serialize_with_http_info(self, **kwargs): # noqa: E501 _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) + def test_body_with_file_schema(self, file_schema_test_class, **kwargs): # noqa: E501 + """test_body_with_file_schema # noqa: E501 + + For this test, the body for this request much reference a schema named `File`. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.test_body_with_file_schema(file_schema_test_class, async=True) + >>> result = thread.get() + + :param async bool + :param FileSchemaTestClass file_schema_test_class: (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.test_body_with_file_schema_with_http_info(file_schema_test_class, **kwargs) # noqa: E501 + else: + (data) = self.test_body_with_file_schema_with_http_info(file_schema_test_class, **kwargs) # noqa: E501 + return data + + def test_body_with_file_schema_with_http_info(self, file_schema_test_class, **kwargs): # noqa: E501 + """test_body_with_file_schema # noqa: E501 + + For this test, the body for this request much reference a schema named `File`. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.test_body_with_file_schema_with_http_info(file_schema_test_class, async=True) + >>> result = thread.get() + + :param async bool + :param FileSchemaTestClass file_schema_test_class: (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['file_schema_test_class'] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method test_body_with_file_schema" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'file_schema_test_class' is set + if ('file_schema_test_class' not in params or + params['file_schema_test_class'] is None): + raise ValueError("Missing the required parameter `file_schema_test_class` when calling `test_body_with_file_schema`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'file_schema_test_class' in params: + body_params = params['file_schema_test_class'] + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/fake/body-with-file-schema', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + def test_body_with_query_params(self, query, user, **kwargs): # noqa: E501 """test_body_with_query_params # noqa: E501 diff --git a/samples/client/petstore/python/petstore_api/api/pet_api.py b/samples/client/petstore/python/petstore_api/api/pet_api.py index 5b62a0b12a5c..9eb0aa2eac61 100644 --- a/samples/client/petstore/python/petstore_api/api/pet_api.py +++ b/samples/client/petstore/python/petstore_api/api/pet_api.py @@ -803,3 +803,112 @@ def upload_file_with_http_info(self, pet_id, **kwargs): # noqa: E501 _preload_content=params.get('_preload_content', True), _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) + + def upload_file_with_required_file(self, pet_id, file, **kwargs): # noqa: E501 + """uploads an image (required) # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.upload_file_with_required_file(pet_id, file, async=True) + >>> result = thread.get() + + :param async bool + :param int pet_id: ID of pet to update (required) + :param file file: file to upload (required) + :param str additional_metadata: Additional data to pass to server + :return: ApiResponse + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async'): + return self.upload_file_with_required_file_with_http_info(pet_id, file, **kwargs) # noqa: E501 + else: + (data) = self.upload_file_with_required_file_with_http_info(pet_id, file, **kwargs) # noqa: E501 + return data + + def upload_file_with_required_file_with_http_info(self, pet_id, file, **kwargs): # noqa: E501 + """uploads an image (required) # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async=True + >>> thread = api.upload_file_with_required_file_with_http_info(pet_id, file, async=True) + >>> result = thread.get() + + :param async bool + :param int pet_id: ID of pet to update (required) + :param file file: file to upload (required) + :param str additional_metadata: Additional data to pass to server + :return: ApiResponse + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['pet_id', 'file', 'additional_metadata'] # noqa: E501 + all_params.append('async') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method upload_file_with_required_file" % 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 `upload_file_with_required_file`") # noqa: E501 + # verify the required parameter 'file' is set + if ('file' not in params or + params['file'] is None): + raise ValueError("Missing the required parameter `file` when calling `upload_file_with_required_file`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'pet_id' in params: + path_params['petId'] = params['pet_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + if 'additional_metadata' in params: + form_params.append(('additionalMetadata', params['additional_metadata'])) # noqa: E501 + if 'file' in params: + local_var_files['file'] = params['file'] # noqa: E501 + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['multipart/form-data']) # noqa: E501 + + # Authentication setting + auth_settings = ['petstore_auth'] # noqa: E501 + + return self.api_client.call_api( + '/fake/{petId}/uploadImageWithRequiredFile', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='ApiResponse', # noqa: E501 + auth_settings=auth_settings, + async=params.get('async'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/samples/client/petstore/python/petstore_api/api_client.py b/samples/client/petstore/python/petstore_api/api_client.py index 432ab964f37a..b5396239330c 100644 --- a/samples/client/petstore/python/petstore_api/api_client.py +++ b/samples/client/petstore/python/petstore_api/api_client.py @@ -545,7 +545,7 @@ def __deserialize_primitive(self, data, klass): return data def __deserialize_object(self, value): - """Return a original value. + """Return an original value. :return: object. """ diff --git a/samples/client/petstore/python/petstore_api/models/__init__.py b/samples/client/petstore/python/petstore_api/models/__init__.py index 445cb787a19a..2450cb334f7e 100644 --- a/samples/client/petstore/python/petstore_api/models/__init__.py +++ b/samples/client/petstore/python/petstore_api/models/__init__.py @@ -30,6 +30,8 @@ from petstore_api.models.enum_arrays import EnumArrays from petstore_api.models.enum_class import EnumClass from petstore_api.models.enum_test import EnumTest +from petstore_api.models.file import File +from petstore_api.models.file_schema_test_class import FileSchemaTestClass from petstore_api.models.format_test import FormatTest from petstore_api.models.has_only_read_only import HasOnlyReadOnly from petstore_api.models.list import List @@ -45,5 +47,6 @@ from petstore_api.models.pet import Pet from petstore_api.models.read_only_first import ReadOnlyFirst from petstore_api.models.special_model_name import SpecialModelName +from petstore_api.models.string_boolean_map import StringBooleanMap from petstore_api.models.tag import Tag from petstore_api.models.user import User diff --git a/samples/client/petstore/python/petstore_api/models/file.py b/samples/client/petstore/python/petstore_api/models/file.py new file mode 100644 index 000000000000..34d77c3b4cf8 --- /dev/null +++ b/samples/client/petstore/python/petstore_api/models/file.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 + + OpenAPI spec version: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +import pprint +import re # noqa: F401 + +import six + + +class File(object): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + """ + Attributes: + openapi_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + openapi_types = { + 'source_uri': 'str' + } + + attribute_map = { + 'source_uri': 'sourceURI' + } + + def __init__(self, source_uri=None): # noqa: E501 + """File - a model defined in OpenAPI""" # noqa: E501 + + self._source_uri = None + self.discriminator = None + + if source_uri is not None: + self.source_uri = source_uri + + @property + def source_uri(self): + """Gets the source_uri of this File. # noqa: E501 + + Test capitalization # noqa: E501 + + :return: The source_uri of this File. # noqa: E501 + :rtype: str + """ + return self._source_uri + + @source_uri.setter + def source_uri(self, source_uri): + """Sets the source_uri of this File. + + Test capitalization # noqa: E501 + + :param source_uri: The source_uri of this File. # noqa: E501 + :type: str + """ + + self._source_uri = source_uri + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.openapi_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 pprint.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""" + if not isinstance(other, File): + return False + + 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/petstore_api/models/file_schema_test_class.py b/samples/client/petstore/python/petstore_api/models/file_schema_test_class.py new file mode 100644 index 000000000000..026822dee749 --- /dev/null +++ b/samples/client/petstore/python/petstore_api/models/file_schema_test_class.py @@ -0,0 +1,138 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 + + OpenAPI spec version: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +import pprint +import re # noqa: F401 + +import six + + +class FileSchemaTestClass(object): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + """ + Attributes: + openapi_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + openapi_types = { + 'file': 'File', + 'files': 'list[File]' + } + + attribute_map = { + 'file': 'file', + 'files': 'files' + } + + def __init__(self, file=None, files=None): # noqa: E501 + """FileSchemaTestClass - a model defined in OpenAPI""" # noqa: E501 + + self._file = None + self._files = None + self.discriminator = None + + if file is not None: + self.file = file + if files is not None: + self.files = files + + @property + def file(self): + """Gets the file of this FileSchemaTestClass. # noqa: E501 + + + :return: The file of this FileSchemaTestClass. # noqa: E501 + :rtype: File + """ + return self._file + + @file.setter + def file(self, file): + """Sets the file of this FileSchemaTestClass. + + + :param file: The file of this FileSchemaTestClass. # noqa: E501 + :type: File + """ + + self._file = file + + @property + def files(self): + """Gets the files of this FileSchemaTestClass. # noqa: E501 + + + :return: The files of this FileSchemaTestClass. # noqa: E501 + :rtype: list[File] + """ + return self._files + + @files.setter + def files(self, files): + """Sets the files of this FileSchemaTestClass. + + + :param files: The files of this FileSchemaTestClass. # noqa: E501 + :type: list[File] + """ + + self._files = files + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.openapi_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 pprint.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""" + if not isinstance(other, FileSchemaTestClass): + return False + + 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/petstore_api/models/map_test.py b/samples/client/petstore/python/petstore_api/models/map_test.py index 02ff04f98391..f2d1042556bf 100644 --- a/samples/client/petstore/python/petstore_api/models/map_test.py +++ b/samples/client/petstore/python/petstore_api/models/map_test.py @@ -32,25 +32,35 @@ class MapTest(object): """ openapi_types = { 'map_map_of_string': 'dict(str, dict(str, str))', - 'map_of_enum_string': 'dict(str, str)' + 'map_of_enum_string': 'dict(str, str)', + 'direct_map': 'dict(str, bool)', + 'indirect_map': 'StringBooleanMap' } attribute_map = { 'map_map_of_string': 'map_map_of_string', - 'map_of_enum_string': 'map_of_enum_string' + 'map_of_enum_string': 'map_of_enum_string', + 'direct_map': 'direct_map', + 'indirect_map': 'indirect_map' } - def __init__(self, map_map_of_string=None, map_of_enum_string=None): # noqa: E501 + def __init__(self, map_map_of_string=None, map_of_enum_string=None, direct_map=None, indirect_map=None): # noqa: E501 """MapTest - a model defined in OpenAPI""" # noqa: E501 self._map_map_of_string = None self._map_of_enum_string = None + self._direct_map = None + self._indirect_map = None self.discriminator = None if map_map_of_string is not None: self.map_map_of_string = map_map_of_string if map_of_enum_string is not None: self.map_of_enum_string = map_of_enum_string + if direct_map is not None: + self.direct_map = direct_map + if indirect_map is not None: + self.indirect_map = indirect_map @property def map_map_of_string(self): @@ -101,6 +111,48 @@ def map_of_enum_string(self, map_of_enum_string): self._map_of_enum_string = map_of_enum_string + @property + def direct_map(self): + """Gets the direct_map of this MapTest. # noqa: E501 + + + :return: The direct_map of this MapTest. # noqa: E501 + :rtype: dict(str, bool) + """ + return self._direct_map + + @direct_map.setter + def direct_map(self, direct_map): + """Sets the direct_map of this MapTest. + + + :param direct_map: The direct_map of this MapTest. # noqa: E501 + :type: dict(str, bool) + """ + + self._direct_map = direct_map + + @property + def indirect_map(self): + """Gets the indirect_map of this MapTest. # noqa: E501 + + + :return: The indirect_map of this MapTest. # noqa: E501 + :rtype: StringBooleanMap + """ + return self._indirect_map + + @indirect_map.setter + def indirect_map(self, indirect_map): + """Sets the indirect_map of this MapTest. + + + :param indirect_map: The indirect_map of this MapTest. # noqa: E501 + :type: StringBooleanMap + """ + + self._indirect_map = indirect_map + def to_dict(self): """Returns the model properties as a dict""" result = {} diff --git a/samples/client/petstore/python/petstore_api/models/string_boolean_map.py b/samples/client/petstore/python/petstore_api/models/string_boolean_map.py new file mode 100644 index 000000000000..e837adf61958 --- /dev/null +++ b/samples/client/petstore/python/petstore_api/models/string_boolean_map.py @@ -0,0 +1,84 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 + + OpenAPI spec version: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +import pprint +import re # noqa: F401 + +import six + + +class StringBooleanMap(object): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + """ + Attributes: + openapi_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + openapi_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """StringBooleanMap - a model defined in OpenAPI""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.openapi_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 pprint.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""" + if not isinstance(other, StringBooleanMap): + return False + + 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/test/test_file.py b/samples/client/petstore/python/test/test_file.py new file mode 100644 index 000000000000..cc32edb7b523 --- /dev/null +++ b/samples/client/petstore/python/test/test_file.py @@ -0,0 +1,39 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 + + OpenAPI spec version: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +from __future__ import absolute_import + +import unittest + +import petstore_api +from petstore_api.models.file import File # noqa: E501 +from petstore_api.rest import ApiException + + +class TestFile(unittest.TestCase): + """File unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testFile(self): + """Test File""" + # FIXME: construct object with mandatory attributes with example values + # model = petstore_api.models.file.File() # noqa: E501 + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python/test/test_file_schema_test_class.py b/samples/client/petstore/python/test/test_file_schema_test_class.py new file mode 100644 index 000000000000..91e1b6a1c745 --- /dev/null +++ b/samples/client/petstore/python/test/test_file_schema_test_class.py @@ -0,0 +1,39 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 + + OpenAPI spec version: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +from __future__ import absolute_import + +import unittest + +import petstore_api +from petstore_api.models.file_schema_test_class import FileSchemaTestClass # noqa: E501 +from petstore_api.rest import ApiException + + +class TestFileSchemaTestClass(unittest.TestCase): + """FileSchemaTestClass unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testFileSchemaTestClass(self): + """Test FileSchemaTestClass""" + # FIXME: construct object with mandatory attributes with example values + # model = petstore_api.models.file_schema_test_class.FileSchemaTestClass() # noqa: E501 + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python/test/test_string_boolean_map.py b/samples/client/petstore/python/test/test_string_boolean_map.py new file mode 100644 index 000000000000..47dd8529a1a3 --- /dev/null +++ b/samples/client/petstore/python/test/test_string_boolean_map.py @@ -0,0 +1,39 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 + + OpenAPI spec version: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +from __future__ import absolute_import + +import unittest + +import petstore_api +from petstore_api.models.string_boolean_map import StringBooleanMap # noqa: E501 +from petstore_api.rest import ApiException + + +class TestStringBooleanMap(unittest.TestCase): + """StringBooleanMap unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testStringBooleanMap(self): + """Test StringBooleanMap""" + # FIXME: construct object with mandatory attributes with example values + # model = petstore_api.models.string_boolean_map.StringBooleanMap() # noqa: E501 + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python/tests/test_map_test.py b/samples/client/petstore/python/tests/test_map_test.py index a411a4e541b3..6031cebf3a2b 100644 --- a/samples/client/petstore/python/tests/test_map_test.py +++ b/samples/client/petstore/python/tests/test_map_test.py @@ -52,7 +52,6 @@ def test_maptest_init(self): except ValueError: self.assertTrue(1) - def test_maptest_setter(self): # # Check with some valid values @@ -65,7 +64,6 @@ def test_maptest_setter(self): map_enum_test.map_of_enum_string = up_or_low_dict self.assertEqual(map_enum_test.map_of_enum_string, up_or_low_dict) - # # Check if the setter fails for invalid enum values # @@ -79,7 +77,6 @@ def test_maptest_setter(self): except ValueError: self.assertEqual(map_enum_test.map_of_enum_string, None) - def test_todict(self): # # Check dictionary serialization @@ -94,15 +91,27 @@ def test_todict(self): 'valText': "Text", 'valueDict': up_or_low_dict } + indirect_map = { + 'option1': True + } + direct_map = { + 'option2': False + } map_enum_test.map_of_enum_string = up_or_low_dict map_enum_test.map_map_of_string = map_of_map_of_strings - + map_enum_test.indirect_map = indirect_map + map_enum_test.direct_map = direct_map + self.assertEqual(map_enum_test.map_of_enum_string, up_or_low_dict) self.assertEqual(map_enum_test.map_map_of_string, map_of_map_of_strings) + self.assertEqual(map_enum_test.indirect_map, indirect_map) + self.assertEqual(map_enum_test.direct_map, direct_map) expected_dict = { 'map_of_enum_string': up_or_low_dict, - 'map_map_of_string': map_of_map_of_strings + 'map_map_of_string': map_of_map_of_strings, + 'indirect_map': indirect_map, + 'direct_map': direct_map } self.assertEqual(map_enum_test.to_dict(), expected_dict)