diff --git a/bin/windows/typescript-node-petstore-with-npm.bat b/bin/windows/typescript-node-petstore-with-npm.bat old mode 100644 new mode 100755 diff --git a/bin/windows/typescript-node-petstore.bat b/bin/windows/typescript-node-petstore.bat old mode 100644 new mode 100755 diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConstants.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConstants.java index 88cf6c2df20..0d5780a775e 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConstants.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConstants.java @@ -213,6 +213,9 @@ public class CodegenConstants { public static final String EXCLUDE_TESTS = "excludeTests"; public static final String EXCLUDE_TESTS_DESC = "Specifies that no tests are to be generated."; + public static final String SOURCECODEONLY_GENERATION = "generateSourceCodeOnly"; + public static final String SOURCECODEONLY_GENERATION_DESC = "Specifies that only a library source code is to be generated."; + // Not user-configurable. System provided for use in templates. public static final String GENERATE_APIS = "generateApis"; diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java index 618e5a5bdcd..cb829433f5d 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java @@ -159,6 +159,8 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG_DESC).defaultValue(Boolean.TRUE.toString())); cliOptions.add(new CliOption(CodegenConstants.HIDE_GENERATION_TIMESTAMP, CodegenConstants.HIDE_GENERATION_TIMESTAMP_DESC) .defaultValue(Boolean.TRUE.toString())); + cliOptions.add(new CliOption(CodegenConstants.SOURCECODEONLY_GENERATION, CodegenConstants.SOURCECODEONLY_GENERATION_DESC) + .defaultValue(Boolean.FALSE.toString())); supportedLibraries.put("urllib3", "urllib3-based client"); supportedLibraries.put("asyncio", "Asyncio-based client (python 3.5+)"); @@ -198,10 +200,22 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig setPackageVersion("1.0.0"); } + Boolean generateSourceCodeOnly = false; + if (additionalProperties.containsKey(CodegenConstants.SOURCECODEONLY_GENERATION)) { + generateSourceCodeOnly = true; + } + additionalProperties.put(CodegenConstants.PROJECT_NAME, projectName); additionalProperties.put(CodegenConstants.PACKAGE_NAME, packageName); additionalProperties.put(CodegenConstants.PACKAGE_VERSION, packageVersion); + if (generateSourceCodeOnly) { + // tests in /test + testFolder = packageName + File.separatorChar + testFolder; + // api/model docs in /docs + apiDocPath = packageName + File.separatorChar + apiDocPath; + modelDocPath = packageName + File.separatorChar + modelDocPath; + } // make api and model doc path available in mustache template additionalProperties.put("apiDocPath", apiDocPath); additionalProperties.put("modelDocPath", modelDocPath); @@ -210,12 +224,24 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig setPackageUrl((String) additionalProperties.get(PACKAGE_URL)); } - supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")); + String readmePath ="README.md"; + String readmeTemplate = "README.mustache"; + if (generateSourceCodeOnly) { + readmePath = packageName + "_" + readmePath; + readmeTemplate = "README_onlypackage.mustache"; + } + supportingFiles.add(new SupportingFile(readmeTemplate, "", readmePath)); - supportingFiles.add(new SupportingFile("tox.mustache", "", "tox.ini")); - supportingFiles.add(new SupportingFile("test-requirements.mustache", "", "test-requirements.txt")); - supportingFiles.add(new SupportingFile("requirements.mustache", "", "requirements.txt")); + if (!generateSourceCodeOnly){ + supportingFiles.add(new SupportingFile("tox.mustache", "", "tox.ini")); + supportingFiles.add(new SupportingFile("test-requirements.mustache", "", "test-requirements.txt")); + supportingFiles.add(new SupportingFile("requirements.mustache", "", "requirements.txt")); + supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh")); + supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore")); + supportingFiles.add(new SupportingFile("travis.mustache", "", ".travis.yml")); + supportingFiles.add(new SupportingFile("setup.mustache", "", "setup.py")); + } supportingFiles.add(new SupportingFile("configuration.mustache", packageName, "configuration.py")); supportingFiles.add(new SupportingFile("__init__package.mustache", packageName, "__init__.py")); supportingFiles.add(new SupportingFile("__init__model.mustache", packageName + File.separatorChar + modelPackage, "__init__.py")); @@ -224,10 +250,7 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig if (Boolean.FALSE.equals(excludeTests)) { supportingFiles.add(new SupportingFile("__init__test.mustache", testFolder, "__init__.py")); } - supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh")); - supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore")); - supportingFiles.add(new SupportingFile("travis.mustache", "", ".travis.yml")); - supportingFiles.add(new SupportingFile("setup.mustache", "", "setup.py")); + supportingFiles.add(new SupportingFile("api_client.mustache", packageName, "api_client.py")); if ("asyncio".equals(getLibrary())) { diff --git a/modules/openapi-generator/src/main/resources/python/README.mustache b/modules/openapi-generator/src/main/resources/python/README.mustache index cf92dc583db..be835339063 100644 --- a/modules/openapi-generator/src/main/resources/python/README.mustache +++ b/modules/openapi-generator/src/main/resources/python/README.mustache @@ -52,78 +52,4 @@ import {{{packageName}}} Please follow the [installation procedure](#installation--usage) and then run the following: -```python -from __future__ import print_function -import time -import {{{packageName}}} -from {{{packageName}}}.rest import ApiException -from pprint import pprint -{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}}{{#hasAuthMethods}}{{#authMethods}}{{#isBasic}} -# Configure HTTP basic authorization: {{{name}}} -configuration = {{{packageName}}}.Configuration() -configuration.username = 'YOUR_USERNAME' -configuration.password = 'YOUR_PASSWORD'{{/isBasic}}{{#isApiKey}} -# Configure API key authorization: {{{name}}} -configuration = {{{packageName}}}.Configuration() -configuration.api_key['{{{keyParamName}}}'] = 'YOUR_API_KEY' -# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -# configuration.api_key_prefix['{{{keyParamName}}}'] = 'Bearer'{{/isApiKey}}{{#isOAuth}} -# Configure OAuth2 access token for authorization: {{{name}}} -configuration = {{{packageName}}}.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN'{{/isOAuth}}{{/authMethods}} -{{/hasAuthMethods}} - -# create an instance of the API class -api_instance = {{{packageName}}}.{{{classname}}}({{{packageName}}}.ApiClient(configuration)) -{{#allParams}}{{paramName}} = {{{example}}} # {{{dataType}}} | {{{description}}}{{^required}} (optional){{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}} -{{/allParams}} - -try: -{{#summary}} # {{{.}}} -{{/summary}} {{#returnType}}api_response = {{/returnType}}api_instance.{{{operationId}}}({{#allParams}}{{#required}}{{paramName}}{{/required}}{{^required}}{{paramName}}={{paramName}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}){{#returnType}} - pprint(api_response){{/returnType}} -except ApiException as e: - print("Exception when calling {{classname}}->{{operationId}}: %s\n" % e) -{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}} -``` - -## Documentation for API Endpoints - -All URIs are relative to *{{basePath}}* - -Class | Method | HTTP request | Description ------------- | ------------- | ------------- | ------------- -{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}} -{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} - -## Documentation For Models - -{{#models}}{{#model}} - [{{{classname}}}]({{modelDocPath}}{{{classname}}}.md) -{{/model}}{{/models}} - -## Documentation For Authorization - -{{^authMethods}} All endpoints do not require authorization. -{{/authMethods}}{{#authMethods}}{{#last}} Authentication schemes defined for the API:{{/last}}{{/authMethods}} -{{#authMethods}}## {{{name}}} - -{{#isApiKey}}- **Type**: API key -- **API key parameter name**: {{{keyParamName}}} -- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}} -{{/isApiKey}} -{{#isBasic}}- **Type**: HTTP basic authentication -{{/isBasic}} -{{#isOAuth}}- **Type**: OAuth -- **Flow**: {{{flow}}} -- **Authorization URL**: {{{authorizationUrl}}} -- **Scopes**: {{^scopes}}N/A{{/scopes}} -{{#scopes}} - **{{{scope}}}**: {{{description}}} -{{/scopes}} -{{/isOAuth}} - -{{/authMethods}} - -## Author - -{{#apiInfo}}{{#apis}}{{^hasMore}}{{infoEmail}} -{{/hasMore}}{{/apis}}{{/apiInfo}} +{{> common_README }} diff --git a/modules/openapi-generator/src/main/resources/python/README_onlypackage.mustache b/modules/openapi-generator/src/main/resources/python/README_onlypackage.mustache new file mode 100644 index 00000000000..826454b1eac --- /dev/null +++ b/modules/openapi-generator/src/main/resources/python/README_onlypackage.mustache @@ -0,0 +1,44 @@ +# {{{projectName}}} +{{#appDescription}} +{{{appDescription}}} +{{/appDescription}} + +The `{{packageName}}` package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: + +- API version: {{appVersion}} +- Package version: {{packageVersion}} +{{^hideGenerationTimestamp}} +- Build date: {{generatedDate}} +{{/hideGenerationTimestamp}} +- Build package: {{generatorClass}} +{{#infoUrl}} +For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}) +{{/infoUrl}} + +## Requirements. + +Python 2.7 and 3.4+ + +## Installation & Usage + +This python library package is generated without supporting files like setup.py or requirements files + +To be able to use it, you will need these dependencies in your own package that uses this library: + +* urllib3 >= 1.15 +* six >= 1.10 +* certifi +* python-dateutil +{{#asyncio}} +* aiohttp +{{/asyncio}} +{{#tornado}} +* tornado>=4.2,<5 +{{/tornado}} + +## Getting Started + +In your own code, to use this library to connect and interact with {{{projectName}}}, +you can run the following: + +{{> common_README }} diff --git a/modules/openapi-generator/src/main/resources/python/__init__package.mustache b/modules/openapi-generator/src/main/resources/python/__init__package.mustache index cd42506f540..a21c6dbac9d 100644 --- a/modules/openapi-generator/src/main/resources/python/__init__package.mustache +++ b/modules/openapi-generator/src/main/resources/python/__init__package.mustache @@ -6,6 +6,8 @@ from __future__ import absolute_import +__version__ = "{{packageVersion}}" + # import apis into sdk package {{#apiInfo}}{{#apis}}from {{apiPackage}}.{{classVarName}} import {{classname}} {{/apis}}{{/apiInfo}} diff --git a/modules/openapi-generator/src/main/resources/python/common_README.mustache b/modules/openapi-generator/src/main/resources/python/common_README.mustache new file mode 100644 index 00000000000..f203456f208 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/python/common_README.mustache @@ -0,0 +1,75 @@ +```python +from __future__ import print_function +import time +import {{{packageName}}} +from {{{packageName}}}.rest import ApiException +from pprint import pprint +{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}}{{#hasAuthMethods}}{{#authMethods}}{{#isBasic}} +# Configure HTTP basic authorization: {{{name}}} +configuration = {{{packageName}}}.Configuration() +configuration.username = 'YOUR_USERNAME' +configuration.password = 'YOUR_PASSWORD'{{/isBasic}}{{#isApiKey}} +# Configure API key authorization: {{{name}}} +configuration = {{{packageName}}}.Configuration() +configuration.api_key['{{{keyParamName}}}'] = 'YOUR_API_KEY' +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['{{{keyParamName}}}'] = 'Bearer'{{/isApiKey}}{{#isOAuth}} +# Configure OAuth2 access token for authorization: {{{name}}} +configuration = {{{packageName}}}.Configuration() +configuration.access_token = 'YOUR_ACCESS_TOKEN'{{/isOAuth}}{{/authMethods}} +{{/hasAuthMethods}} + +# create an instance of the API class +api_instance = {{{packageName}}}.{{{classname}}}({{{packageName}}}.ApiClient(configuration)) +{{#allParams}}{{paramName}} = {{{example}}} # {{{dataType}}} | {{{description}}}{{^required}} (optional){{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}} +{{/allParams}} + +try: +{{#summary}} # {{{.}}} +{{/summary}} {{#returnType}}api_response = {{/returnType}}api_instance.{{{operationId}}}({{#allParams}}{{#required}}{{paramName}}{{/required}}{{^required}}{{paramName}}={{paramName}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}){{#returnType}} + pprint(api_response){{/returnType}} +except ApiException as e: + print("Exception when calling {{classname}}->{{operationId}}: %s\n" % e) +{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}} +``` + +## Documentation for API Endpoints + +All URIs are relative to *{{basePath}}* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}} +{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} + +## Documentation For Models + +{{#models}}{{#model}} - [{{{classname}}}]({{modelDocPath}}{{{classname}}}.md) +{{/model}}{{/models}} + +## Documentation For Authorization + +{{^authMethods}} All endpoints do not require authorization. +{{/authMethods}}{{#authMethods}}{{#last}} Authentication schemes defined for the API:{{/last}}{{/authMethods}} +{{#authMethods}}## {{{name}}} + +{{#isApiKey}}- **Type**: API key +- **API key parameter name**: {{{keyParamName}}} +- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}} +{{/isApiKey}} +{{#isBasic}}- **Type**: HTTP basic authentication +{{/isBasic}} +{{#isOAuth}}- **Type**: OAuth +- **Flow**: {{{flow}}} +- **Authorization URL**: {{{authorizationUrl}}} +- **Scopes**: {{^scopes}}N/A{{/scopes}} +{{#scopes}} - **{{{scope}}}**: {{{description}}} +{{/scopes}} +{{/isOAuth}} + +{{/authMethods}} + +## Author + +{{#apiInfo}}{{#apis}}{{^hasMore}}{{infoEmail}} +{{/hasMore}}{{/apis}}{{/apiInfo}} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PythonClientOptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PythonClientOptionsProvider.java index df8647e65a4..099d2369e95 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PythonClientOptionsProvider.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PythonClientOptionsProvider.java @@ -44,6 +44,7 @@ public class PythonClientOptionsProvider implements OptionsProvider { .put(CodegenConstants.PACKAGE_VERSION, PACKAGE_VERSION_VALUE) .put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, "true") .put(CodegenConstants.HIDE_GENERATION_TIMESTAMP, "true") + .put(CodegenConstants.SOURCECODEONLY_GENERATION, "false") .put(CodegenConstants.LIBRARY, "urllib3") .build(); } diff --git a/samples/client/petstore/python-asyncio/README.md b/samples/client/petstore/python-asyncio/README.md index 40e3e1e2e76..b76d6153e89 100644 --- a/samples/client/petstore/python-asyncio/README.md +++ b/samples/client/petstore/python-asyncio/README.md @@ -179,3 +179,4 @@ Class | Method | HTTP request | Description + diff --git a/samples/client/petstore/python-asyncio/docs/PetApi.md b/samples/client/petstore/python-asyncio/docs/PetApi.md index 583883799e2..9b8fd577a52 100644 --- a/samples/client/petstore/python-asyncio/docs/PetApi.md +++ b/samples/client/petstore/python-asyncio/docs/PetApi.md @@ -430,7 +430,7 @@ 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) +> ApiResponse upload_file_with_required_file(pet_id, required_file, additional_metadata=additional_metadata) uploads an image (required) @@ -449,12 +449,12 @@ 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 +required_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) + api_response = api_instance.upload_file_with_required_file(pet_id, required_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) @@ -465,7 +465,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **pet_id** | **int**| ID of pet to update | - **file** | **file**| file to upload | + **required_file** | **file**| file to upload | **additional_metadata** | **str**| Additional data to pass to server | [optional] ### Return type diff --git a/samples/client/petstore/python-asyncio/petstore_api/__init__.py b/samples/client/petstore/python-asyncio/petstore_api/__init__.py index ec4d33177cc..f54256a687c 100644 --- a/samples/client/petstore/python-asyncio/petstore_api/__init__.py +++ b/samples/client/petstore/python-asyncio/petstore_api/__init__.py @@ -14,6 +14,8 @@ from __future__ import absolute_import +__version__ = "1.0.0" + # import apis into sdk package from petstore_api.api.another_fake_api import AnotherFakeApi from petstore_api.api.fake_api import FakeApi 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 cccf4ed7b5e..c0a119de975 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 @@ -812,17 +812,17 @@ class PetApi(object): _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def upload_file_with_required_file(self, pet_id, file, **kwargs): # noqa: E501 + def upload_file_with_required_file(self, pet_id, required_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) + >>> thread = api.upload_file_with_required_file(pet_id, required_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 file required_file: file to upload (required) :param str additional_metadata: Additional data to pass to server :return: ApiResponse If the method is called asynchronously, @@ -830,22 +830,22 @@ class PetApi(object): """ 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 + return self.upload_file_with_required_file_with_http_info(pet_id, required_file, **kwargs) # noqa: E501 else: - (data) = self.upload_file_with_required_file_with_http_info(pet_id, file, **kwargs) # noqa: E501 + (data) = self.upload_file_with_required_file_with_http_info(pet_id, required_file, **kwargs) # noqa: E501 return data - def upload_file_with_required_file_with_http_info(self, pet_id, file, **kwargs): # noqa: E501 + def upload_file_with_required_file_with_http_info(self, pet_id, required_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) + >>> thread = api.upload_file_with_required_file_with_http_info(pet_id, required_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 file required_file: file to upload (required) :param str additional_metadata: Additional data to pass to server :return: ApiResponse If the method is called asynchronously, @@ -854,7 +854,7 @@ class PetApi(object): local_var_params = locals() - all_params = ['pet_id', 'file', 'additional_metadata'] # noqa: E501 + all_params = ['pet_id', 'required_file', 'additional_metadata'] # noqa: E501 all_params.append('async') all_params.append('_return_http_data_only') all_params.append('_preload_content') @@ -872,10 +872,10 @@ class PetApi(object): if ('pet_id' not in local_var_params or local_var_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 local_var_params or - local_var_params['file'] is None): - raise ValueError("Missing the required parameter `file` when calling `upload_file_with_required_file`") # noqa: E501 + # verify the required parameter 'required_file' is set + if ('required_file' not in local_var_params or + local_var_params['required_file'] is None): + raise ValueError("Missing the required parameter `required_file` when calling `upload_file_with_required_file`") # noqa: E501 collection_formats = {} @@ -891,8 +891,8 @@ class PetApi(object): local_var_files = {} if 'additional_metadata' in local_var_params: form_params.append(('additionalMetadata', local_var_params['additional_metadata'])) # noqa: E501 - if 'file' in local_var_params: - local_var_files['file'] = local_var_params['file'] # noqa: E501 + if 'required_file' in local_var_params: + local_var_files['requiredFile'] = local_var_params['required_file'] # noqa: E501 body_params = None # HTTP header `Accept` diff --git a/samples/client/petstore/python-tornado/README.md b/samples/client/petstore/python-tornado/README.md index 40e3e1e2e76..b76d6153e89 100644 --- a/samples/client/petstore/python-tornado/README.md +++ b/samples/client/petstore/python-tornado/README.md @@ -179,3 +179,4 @@ Class | Method | HTTP request | Description + diff --git a/samples/client/petstore/python-tornado/docs/PetApi.md b/samples/client/petstore/python-tornado/docs/PetApi.md index 583883799e2..9b8fd577a52 100644 --- a/samples/client/petstore/python-tornado/docs/PetApi.md +++ b/samples/client/petstore/python-tornado/docs/PetApi.md @@ -430,7 +430,7 @@ 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) +> ApiResponse upload_file_with_required_file(pet_id, required_file, additional_metadata=additional_metadata) uploads an image (required) @@ -449,12 +449,12 @@ 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 +required_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) + api_response = api_instance.upload_file_with_required_file(pet_id, required_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) @@ -465,7 +465,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **pet_id** | **int**| ID of pet to update | - **file** | **file**| file to upload | + **required_file** | **file**| file to upload | **additional_metadata** | **str**| Additional data to pass to server | [optional] ### Return type diff --git a/samples/client/petstore/python-tornado/petstore_api/__init__.py b/samples/client/petstore/python-tornado/petstore_api/__init__.py index ec4d33177cc..f54256a687c 100644 --- a/samples/client/petstore/python-tornado/petstore_api/__init__.py +++ b/samples/client/petstore/python-tornado/petstore_api/__init__.py @@ -14,6 +14,8 @@ from __future__ import absolute_import +__version__ = "1.0.0" + # import apis into sdk package from petstore_api.api.another_fake_api import AnotherFakeApi from petstore_api.api.fake_api import FakeApi 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 cccf4ed7b5e..c0a119de975 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 @@ -812,17 +812,17 @@ class PetApi(object): _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def upload_file_with_required_file(self, pet_id, file, **kwargs): # noqa: E501 + def upload_file_with_required_file(self, pet_id, required_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) + >>> thread = api.upload_file_with_required_file(pet_id, required_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 file required_file: file to upload (required) :param str additional_metadata: Additional data to pass to server :return: ApiResponse If the method is called asynchronously, @@ -830,22 +830,22 @@ class PetApi(object): """ 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 + return self.upload_file_with_required_file_with_http_info(pet_id, required_file, **kwargs) # noqa: E501 else: - (data) = self.upload_file_with_required_file_with_http_info(pet_id, file, **kwargs) # noqa: E501 + (data) = self.upload_file_with_required_file_with_http_info(pet_id, required_file, **kwargs) # noqa: E501 return data - def upload_file_with_required_file_with_http_info(self, pet_id, file, **kwargs): # noqa: E501 + def upload_file_with_required_file_with_http_info(self, pet_id, required_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) + >>> thread = api.upload_file_with_required_file_with_http_info(pet_id, required_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 file required_file: file to upload (required) :param str additional_metadata: Additional data to pass to server :return: ApiResponse If the method is called asynchronously, @@ -854,7 +854,7 @@ class PetApi(object): local_var_params = locals() - all_params = ['pet_id', 'file', 'additional_metadata'] # noqa: E501 + all_params = ['pet_id', 'required_file', 'additional_metadata'] # noqa: E501 all_params.append('async') all_params.append('_return_http_data_only') all_params.append('_preload_content') @@ -872,10 +872,10 @@ class PetApi(object): if ('pet_id' not in local_var_params or local_var_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 local_var_params or - local_var_params['file'] is None): - raise ValueError("Missing the required parameter `file` when calling `upload_file_with_required_file`") # noqa: E501 + # verify the required parameter 'required_file' is set + if ('required_file' not in local_var_params or + local_var_params['required_file'] is None): + raise ValueError("Missing the required parameter `required_file` when calling `upload_file_with_required_file`") # noqa: E501 collection_formats = {} @@ -891,8 +891,8 @@ class PetApi(object): local_var_files = {} if 'additional_metadata' in local_var_params: form_params.append(('additionalMetadata', local_var_params['additional_metadata'])) # noqa: E501 - if 'file' in local_var_params: - local_var_files['file'] = local_var_params['file'] # noqa: E501 + if 'required_file' in local_var_params: + local_var_files['requiredFile'] = local_var_params['required_file'] # noqa: E501 body_params = None # HTTP header `Accept` diff --git a/samples/client/petstore/python/README.md b/samples/client/petstore/python/README.md index 40e3e1e2e76..b76d6153e89 100644 --- a/samples/client/petstore/python/README.md +++ b/samples/client/petstore/python/README.md @@ -179,3 +179,4 @@ Class | Method | HTTP request | Description + diff --git a/samples/client/petstore/python/docs/PetApi.md b/samples/client/petstore/python/docs/PetApi.md index 583883799e2..9b8fd577a52 100644 --- a/samples/client/petstore/python/docs/PetApi.md +++ b/samples/client/petstore/python/docs/PetApi.md @@ -430,7 +430,7 @@ 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) +> ApiResponse upload_file_with_required_file(pet_id, required_file, additional_metadata=additional_metadata) uploads an image (required) @@ -449,12 +449,12 @@ 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 +required_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) + api_response = api_instance.upload_file_with_required_file(pet_id, required_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) @@ -465,7 +465,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **pet_id** | **int**| ID of pet to update | - **file** | **file**| file to upload | + **required_file** | **file**| file to upload | **additional_metadata** | **str**| Additional data to pass to server | [optional] ### Return type diff --git a/samples/client/petstore/python/petstore_api/__init__.py b/samples/client/petstore/python/petstore_api/__init__.py index ec4d33177cc..f54256a687c 100644 --- a/samples/client/petstore/python/petstore_api/__init__.py +++ b/samples/client/petstore/python/petstore_api/__init__.py @@ -14,6 +14,8 @@ from __future__ import absolute_import +__version__ = "1.0.0" + # import apis into sdk package from petstore_api.api.another_fake_api import AnotherFakeApi from petstore_api.api.fake_api import FakeApi 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 cccf4ed7b5e..c0a119de975 100644 --- a/samples/client/petstore/python/petstore_api/api/pet_api.py +++ b/samples/client/petstore/python/petstore_api/api/pet_api.py @@ -812,17 +812,17 @@ class PetApi(object): _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def upload_file_with_required_file(self, pet_id, file, **kwargs): # noqa: E501 + def upload_file_with_required_file(self, pet_id, required_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) + >>> thread = api.upload_file_with_required_file(pet_id, required_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 file required_file: file to upload (required) :param str additional_metadata: Additional data to pass to server :return: ApiResponse If the method is called asynchronously, @@ -830,22 +830,22 @@ class PetApi(object): """ 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 + return self.upload_file_with_required_file_with_http_info(pet_id, required_file, **kwargs) # noqa: E501 else: - (data) = self.upload_file_with_required_file_with_http_info(pet_id, file, **kwargs) # noqa: E501 + (data) = self.upload_file_with_required_file_with_http_info(pet_id, required_file, **kwargs) # noqa: E501 return data - def upload_file_with_required_file_with_http_info(self, pet_id, file, **kwargs): # noqa: E501 + def upload_file_with_required_file_with_http_info(self, pet_id, required_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) + >>> thread = api.upload_file_with_required_file_with_http_info(pet_id, required_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 file required_file: file to upload (required) :param str additional_metadata: Additional data to pass to server :return: ApiResponse If the method is called asynchronously, @@ -854,7 +854,7 @@ class PetApi(object): local_var_params = locals() - all_params = ['pet_id', 'file', 'additional_metadata'] # noqa: E501 + all_params = ['pet_id', 'required_file', 'additional_metadata'] # noqa: E501 all_params.append('async') all_params.append('_return_http_data_only') all_params.append('_preload_content') @@ -872,10 +872,10 @@ class PetApi(object): if ('pet_id' not in local_var_params or local_var_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 local_var_params or - local_var_params['file'] is None): - raise ValueError("Missing the required parameter `file` when calling `upload_file_with_required_file`") # noqa: E501 + # verify the required parameter 'required_file' is set + if ('required_file' not in local_var_params or + local_var_params['required_file'] is None): + raise ValueError("Missing the required parameter `required_file` when calling `upload_file_with_required_file`") # noqa: E501 collection_formats = {} @@ -891,8 +891,8 @@ class PetApi(object): local_var_files = {} if 'additional_metadata' in local_var_params: form_params.append(('additionalMetadata', local_var_params['additional_metadata'])) # noqa: E501 - if 'file' in local_var_params: - local_var_files['file'] = local_var_params['file'] # noqa: E501 + if 'required_file' in local_var_params: + local_var_files['requiredFile'] = local_var_params['required_file'] # noqa: E501 body_params = None # HTTP header `Accept`