From 88af8964fdcaf06f0816751d39388191ed8a219c Mon Sep 17 00:00:00 2001 From: Justin Black Date: Wed, 31 Jul 2019 06:18:30 -0700 Subject: [PATCH] [python-experimental] automatically use values for enums of length1 (#3118) * Update python client java generator * Updates python generator mustache files * Python sample regenerated * Switches from getfullargspec to getargspec for python2 compatibility * Uses getattr to get model class init method to correctly see its arguments, linting fixes to pass python tests * Updates comment in python centerator to restart CI tests * Adds bin/windows/python-experimental-petstore.bat * CHanges spec update to apply to the python-experimental spec * Moves new python templates to python-experimental * Moves generator python java code to python-experimental * Reverts python generator mustache files * Regenerates python, v3 python, python-experimental samples * Test moved to python-experimental, unused python files removed --- bin/windows/python-experimental-petstore.bat | 10 + .../PythonClientExperimentalCodegen.java | 119 ++ .../python/python-experimental/api.mustache | 294 +++++ .../python-experimental/api_client.mustache | 665 ++++++++++ .../python-experimental/api_doc.mustache | 78 ++ .../api_doc_example.mustache | 58 + .../python/python-experimental/model.mustache | 241 ++++ .../python-experimental/model_doc.mustache | 13 + ...ith-fake-endpoints-models-for-testing.yaml | 83 +- .../petstore/python-experimental/README.md | 5 +- .../docs/AnotherFakeApi.md | 4 +- .../python-experimental/docs/FakeApi.md | 183 ++- .../docs/FakeClassnameTags123Api.md | 6 +- .../python-experimental/docs/PetApi.md | 76 +- .../python-experimental/docs/StoreApi.md | 16 +- .../docs/TypeHolderDefault.md | 6 +- .../docs/TypeHolderExample.md | 6 +- .../python-experimental/docs/UserApi.md | 34 +- .../openapi_client/api_client.py | 658 ++++++++++ .../petstore_api/api/another_fake_api.py | 64 +- .../petstore_api/api/fake_api.py | 1144 +++++++++++------ .../api/fake_classname_tags_123_api.py | 64 +- .../petstore_api/api/pet_api.py | 594 +++++---- .../petstore_api/api/store_api.py | 248 ++-- .../petstore_api/api/user_api.py | 498 +++---- .../models/additional_properties_any_type.py | 21 +- .../models/additional_properties_array.py | 21 +- .../models/additional_properties_boolean.py | 21 +- .../models/additional_properties_class.py | 141 +- .../models/additional_properties_integer.py | 21 +- .../models/additional_properties_number.py | 21 +- .../models/additional_properties_object.py | 21 +- .../models/additional_properties_string.py | 21 +- .../petstore_api/models/animal.py | 33 +- .../petstore_api/models/api_response.py | 45 +- .../models/array_of_array_of_number_only.py | 21 +- .../models/array_of_number_only.py | 21 +- .../petstore_api/models/array_test.py | 45 +- .../petstore_api/models/capitalization.py | 81 +- .../petstore_api/models/cat.py | 29 +- .../petstore_api/models/cat_all_of.py | 21 +- .../petstore_api/models/category.py | 33 +- .../petstore_api/models/class_model.py | 21 +- .../petstore_api/models/client.py | 21 +- .../petstore_api/models/dog.py | 29 +- .../petstore_api/models/dog_all_of.py | 21 +- .../petstore_api/models/enum_arrays.py | 33 +- .../petstore_api/models/enum_class.py | 7 +- .../petstore_api/models/enum_test.py | 71 +- .../petstore_api/models/file.py | 21 +- .../models/file_schema_test_class.py | 33 +- .../petstore_api/models/format_test.py | 165 ++- .../petstore_api/models/has_only_read_only.py | 33 +- .../petstore_api/models/list.py | 21 +- .../petstore_api/models/map_test.py | 57 +- ...perties_and_additional_properties_class.py | 45 +- .../petstore_api/models/model200_response.py | 33 +- .../petstore_api/models/model_return.py | 21 +- .../petstore_api/models/name.py | 57 +- .../petstore_api/models/number_only.py | 21 +- .../petstore_api/models/order.py | 83 +- .../petstore_api/models/outer_composite.py | 45 +- .../petstore_api/models/outer_enum.py | 7 +- .../petstore_api/models/pet.py | 83 +- .../petstore_api/models/read_only_first.py | 33 +- .../petstore_api/models/special_model_name.py | 21 +- .../petstore_api/models/tag.py | 33 +- .../models/type_holder_default.py | 121 +- .../models/type_holder_example.py | 79 +- .../petstore_api/models/user.py | 105 +- .../petstore_api/models/xml_item.py | 357 +++-- .../test/test_type_holder_default.py | 13 +- 72 files changed, 5602 insertions(+), 1872 deletions(-) create mode 100644 bin/windows/python-experimental-petstore.bat create mode 100644 modules/openapi-generator/src/main/resources/python/python-experimental/api.mustache create mode 100644 modules/openapi-generator/src/main/resources/python/python-experimental/api_client.mustache create mode 100644 modules/openapi-generator/src/main/resources/python/python-experimental/api_doc.mustache create mode 100644 modules/openapi-generator/src/main/resources/python/python-experimental/api_doc_example.mustache create mode 100644 modules/openapi-generator/src/main/resources/python/python-experimental/model.mustache create mode 100644 modules/openapi-generator/src/main/resources/python/python-experimental/model_doc.mustache create mode 100644 samples/client/petstore/python-experimental/openapi_client/api_client.py diff --git a/bin/windows/python-experimental-petstore.bat b/bin/windows/python-experimental-petstore.bat new file mode 100644 index 00000000000..50df98535f4 --- /dev/null +++ b/bin/windows/python-experimental-petstore.bat @@ -0,0 +1,10 @@ +set executable=.\modules\openapi-generator-cli\target\openapi-generator-cli.jar + +If Not Exist %executable% ( + mvn clean package +) + +REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M +set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g python-experimental -o samples\client\petstore\python-experimental -DpackageName=petstore_api + +java %JAVA_OPTS% -jar %executable% %ags% diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientExperimentalCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientExperimentalCodegen.java index ba468d47ded..ffbad6f5d23 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientExperimentalCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientExperimentalCodegen.java @@ -16,14 +16,29 @@ package org.openapitools.codegen.languages; +import java.text.DateFormat; +import java.text.SimpleDateFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import io.swagger.v3.oas.models.media.Schema; +import org.openapitools.codegen.*; +import org.openapitools.codegen.utils.ModelUtils; + +import java.util.*; +import java.util.regex.Pattern; + public class PythonClientExperimentalCodegen extends PythonClientCodegen { private static final Logger LOGGER = LoggerFactory.getLogger(PythonClientExperimentalCodegen.class); public PythonClientExperimentalCodegen() { super(); + + supportingFiles.add(new SupportingFile("python-experimental/api_client.mustache", packagePath(), "api_client.py")); + apiDocTemplateFiles.put("python-experimental/api_doc.mustache", ".md"); + apiTemplateFiles.put("python-experimental/api.mustache", ".py"); + modelDocTemplateFiles.put("python-experimental/model_doc.mustache", ".md"); + modelTemplateFiles.put("python-experimental/model.mustache", ".py"); } /** @@ -36,4 +51,108 @@ public class PythonClientExperimentalCodegen extends PythonClientCodegen { public String getName() { return "python-experimental"; } + + public String dateToString(Schema p, Date date, DateFormat dateFormatter, DateFormat dateTimeFormatter) { + // converts a date into a date or date-time python string + if (!(ModelUtils.isDateSchema(p) || ModelUtils.isDateTimeSchema(p))) { + throw new RuntimeException("passed schema must be of type Date or DateTime"); + } + if (ModelUtils.isDateSchema(p)) { + return "dateutil_parser('" + dateFormatter.format(date) + "').date()"; + } + return "dateutil_parser('" + dateTimeFormatter.format(date) + "')"; + } + + /** + * Return the default value of the property + * @param p OpenAPI property object + * @return string presentation of the default value of the property + */ + @Override + public String toDefaultValue(Schema p) { + // if a variable has no default set and only has one allowed value + // using enum of length == 1 we use that value. Server/client usage: + // python servers: should only use default values for optional params + // python clients: should only use default values for required params + Object defaultObject = null; + Boolean enumLengthOne = (p.getEnum() != null && p.getEnum().size() == 1); + if (p.getDefault() != null) { + defaultObject = p.getDefault(); + } else if (enumLengthOne) { + defaultObject = p.getEnum().get(0); + } + + // convert datetime and date enums if they exist + DateFormat iso8601Date = new SimpleDateFormat("yyyy-MM-dd", Locale.ROOT); + DateFormat iso8601DateTime = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX", Locale.ROOT); + TimeZone utc = TimeZone.getTimeZone("UTC"); + iso8601Date.setTimeZone(utc); + iso8601DateTime.setTimeZone(utc); + + if (ModelUtils.isDateSchema(p) || ModelUtils.isDateTimeSchema(p)) { + List currentEnum = p.getEnum(); + List fixedEnum = new ArrayList(); + String fixedValue = null; + Date date = null; + if (currentEnum != null && !currentEnum.isEmpty()) { + for (Object enumItem : currentEnum) { + date = (Date) enumItem; + fixedValue = dateToString(p, date, iso8601Date, iso8601DateTime); + fixedEnum.add(fixedValue); + } + p.setEnum(fixedEnum); + } + + // convert the example if it exists + Object currentExample = p.getExample(); + if (currentExample != null) { + date = (Date) currentExample; + fixedValue = dateToString(p, date, iso8601Date, iso8601DateTime); + fixedEnum.add(fixedValue); + p.setExample(fixedValue); + } + + // fix defaultObject + if (defaultObject != null) { + date = (Date) defaultObject; + fixedValue = dateToString(p, date, iso8601Date, iso8601DateTime); + p.setDefault(fixedValue); + defaultObject = fixedValue; + } + } + + if (defaultObject == null) { + return null; + } + + String defaultValue = null; + if (ModelUtils.isStringSchema(p)) { + defaultValue = defaultObject.toString(); + if (ModelUtils.isDateSchema(p) || ModelUtils.isDateTimeSchema(p)) { + return defaultValue; + } + + if (!ModelUtils.isByteArraySchema(p) && !ModelUtils.isBinarySchema(p) && !ModelUtils.isFileSchema(p) && !ModelUtils.isUUIDSchema(p) && !ModelUtils.isEmailSchema(p) && !ModelUtils.isDateTimeSchema(p) && !ModelUtils.isDateSchema(p)) { + if (Pattern.compile("\r\n|\r|\n").matcher((String) defaultValue).find()) { + defaultValue = "'''" + defaultValue + "'''"; + } else { + defaultValue = "'" + defaultValue + "'"; + } + } + return defaultValue; + } else if (ModelUtils.isIntegerSchema(p) || ModelUtils.isNumberSchema(p) || ModelUtils.isBooleanSchema(p)) { + defaultValue = String.valueOf(defaultObject); + if (ModelUtils.isBooleanSchema(p)) { + if (Boolean.valueOf(defaultValue) == false) { + return "False"; + } else { + return "True"; + } + } + return defaultValue; + } else { + return defaultObject.toString(); + } + } + } diff --git a/modules/openapi-generator/src/main/resources/python/python-experimental/api.mustache b/modules/openapi-generator/src/main/resources/python/python-experimental/api.mustache new file mode 100644 index 00000000000..edf76be03bb --- /dev/null +++ b/modules/openapi-generator/src/main/resources/python/python-experimental/api.mustache @@ -0,0 +1,294 @@ +# coding: utf-8 + +{{>partial_header}} + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from {{packageName}}.api_client import ApiClient +from {{packageName}}.exceptions import ( # noqa: F401 + ApiTypeError, + ApiValueError +) + + +{{#operations}} +class {{classname}}(object): + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client +{{#operation}} + + def {{operationId}}(self{{#requiredParams}}{{^defaultValue}}, {{paramName}}{{/defaultValue}}{{/requiredParams}}{{#requiredParams}}{{#defaultValue}}, {{paramName}}={{{defaultValue}}}{{/defaultValue}}{{/requiredParams}}, **kwargs): # noqa: E501 + """{{#summary}}{{{.}}}{{/summary}}{{^summary}}{{operationId}}{{/summary}} # noqa: E501 + +{{#notes}} + {{{notes}}} # noqa: E501 +{{/notes}} + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.{{operationId}}({{#requiredParams}}{{^defaultValue}}{{paramName}}, {{/defaultValue}}{{/requiredParams}}{{#requiredParams}}{{#defaultValue}}{{paramName}}={{{defaultValue}}}, {{/defaultValue}}{{/requiredParams}}async_req=True) + >>> result = thread.get() + +{{#requiredParams}} +{{^hasMore}} + Args: +{{/hasMore}} +{{/requiredParams}} +{{#requiredParams}} +{{^defaultValue}} + {{paramName}} ({{dataType}}):{{#description}} {{description}}{{/description}}{{/defaultValue}}{{/requiredParams}}{{#requiredParams}}{{#defaultValue}} + {{paramName}} ({{dataType}}):{{#description}} {{description}}.{{/description}} defaults to {{{defaultValue}}}, must be one of [{{{defaultValue}}}]{{/defaultValue}}{{/requiredParams}} + + Keyword Args:{{#optionalParams}} + {{paramName}} ({{dataType}}):{{#description}} {{description}}.{{/description}} [optional]{{#defaultValue}} if omitted the server will use the default value of {{{defaultValue}}}{{/defaultValue}}{{/optionalParams}} + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + {{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}None{{/returnType}}: + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.{{operationId}}_with_http_info({{#requiredParams}}{{^defaultValue}}{{paramName}}, {{/defaultValue}}{{/requiredParams}}{{#requiredParams}}{{#defaultValue}}{{paramName}}={{paramName}}, {{/defaultValue}}{{/requiredParams}}**kwargs) # noqa: E501 + else: + (data) = self.{{operationId}}_with_http_info({{#requiredParams}}{{^defaultValue}}{{paramName}}, {{/defaultValue}}{{/requiredParams}}{{#requiredParams}}{{#defaultValue}}{{paramName}}={{paramName}}, {{/defaultValue}}{{/requiredParams}}**kwargs) # noqa: E501 + return data + + def {{operationId}}_with_http_info(self{{#requiredParams}}{{^defaultValue}}, {{paramName}}{{/defaultValue}}{{/requiredParams}}{{#requiredParams}}{{#defaultValue}}, {{paramName}}=None{{/defaultValue}}{{/requiredParams}}, **kwargs): # noqa: E501 + """{{#summary}}{{{.}}}{{/summary}}{{^summary}}{{operationId}}{{/summary}} # noqa: E501 + +{{#notes}} + {{{notes}}} # noqa: E501 +{{/notes}} + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.{{operationId}}_with_http_info({{#requiredParams}}{{^defaultValue}}{{paramName}}, {{/defaultValue}}{{/requiredParams}}async_req=True) + >>> result = thread.get() + +{{#requiredParams}} +{{^hasMore}} + Args: +{{/hasMore}} +{{/requiredParams}} +{{#requiredParams}} +{{^defaultValue}} + {{paramName}} ({{dataType}}):{{#description}} {{description}}{{/description}}{{/defaultValue}}{{/requiredParams}}{{#requiredParams}}{{#defaultValue}} + {{paramName}} ({{dataType}}):{{#description}} {{description}}.{{/description}} defaults to {{{defaultValue}}}, must be one of [{{{defaultValue}}}]{{/defaultValue}}{{/requiredParams}} + + Keyword Args:{{#optionalParams}} + {{paramName}} ({{dataType}}):{{#description}} {{description}}.{{/description}} [optional]{{#defaultValue}} if omitted the server will use the default value of {{{defaultValue}}}{{/defaultValue}}{{/optionalParams}} + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + {{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}None{{/returnType}}: + """ + + {{#servers.0}} + local_var_hosts = [{{#servers}} + '{{{url}}}'{{^-last}},{{/-last}}{{/servers}} + ] + local_var_host = local_var_hosts[0] + if kwargs.get('_host_index'): + if (int(kwargs.get('_host_index')) < 0 or + int(kwargs.get('_host_index')) >= len(local_var_hosts)): + raise ApiValueError( + "Invalid host index. Must be 0 <= index < %s" % + len(local_var_host) + ) + local_var_host = local_var_hosts[int(kwargs.get('_host_index'))] + {{/servers.0}} + local_var_params = locals() + + all_params = [{{#allParams}}'{{paramName}}'{{#hasMore}}, {{/hasMore}}{{/allParams}}] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + for key, val in six.iteritems(local_var_params['kwargs']): + if key not in all_params{{#servers.0}} and key != "_host_index"{{/servers.0}}: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method {{operationId}}" % key + ) + local_var_params[key] = val + del local_var_params['kwargs'] +{{#allParams}} +{{^isNullable}} +{{#required}} + # verify the required parameter '{{paramName}}' is set + if ('{{paramName}}' not in local_var_params or + local_var_params['{{paramName}}'] is None): + raise ApiValueError("Missing the required parameter `{{paramName}}` when calling `{{operationId}}`") # noqa: E501 +{{/required}} +{{/isNullable}} +{{#-last}} +{{/-last}} +{{/allParams}} +{{#allParams}} +{{#isEnum}} +{{#isContainer}} + allowed_values = [{{#allowableValues}}{{#values}}{{#items.isString}}"{{/items.isString}}{{{this}}}{{#items.isString}}"{{/items.isString}}{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}] # noqa: E501 +{{#isListContainer}} + if ('{{{paramName}}}' in local_var_params and + not set(local_var_params['{{{paramName}}}']).issubset(set(allowed_values))): # noqa: E501 + raise ValueError( + "Invalid values for `{{{paramName}}}` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(local_var_params['{{{paramName}}}']) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) +{{/isListContainer}} +{{#isMapContainer}} + if ('{{{paramName}}}' in local_var_params and + not set(local_var_params['{{{paramName}}}'].keys()).issubset(set(allowed_values))): + raise ValueError( + "Invalid keys in `{{{paramName}}}` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(local_var_params['{{{paramName}}}'].keys()) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) +{{/isMapContainer}} +{{/isContainer}} +{{^isContainer}} + allowed_values = [{{#allowableValues}}{{#values}}{{#isString}}"{{/isString}}{{{this}}}{{#isString}}"{{/isString}}{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}] # noqa: E501 + if ('{{{paramName}}}' in local_var_params and + local_var_params['{{{paramName}}}'] not in allowed_values): + raise ValueError( + "Invalid value for `{{{paramName}}}` ({0}), must be one of {1}" # noqa: E501 + .format(local_var_params['{{{paramName}}}'], allowed_values) + ) +{{/isContainer}} +{{/isEnum}} +{{/allParams}} +{{#allParams}} +{{#hasValidation}} + {{#maxLength}} + if ('{{paramName}}' in local_var_params and + len(local_var_params['{{paramName}}']) > {{maxLength}}): + raise ApiValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, length must be less than or equal to `{{maxLength}}`") # noqa: E501 + {{/maxLength}} + {{#minLength}} + if ('{{paramName}}' in local_var_params and + len(local_var_params['{{paramName}}']) < {{minLength}}): + raise ApiValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, length must be greater than or equal to `{{minLength}}`") # noqa: E501 + {{/minLength}} + {{#maximum}} + if '{{paramName}}' in local_var_params and local_var_params['{{paramName}}'] >{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{maximum}}: # noqa: E501 + raise ApiValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, must be a value less than {{^exclusiveMaximum}}or equal to {{/exclusiveMaximum}}`{{maximum}}`") # noqa: E501 + {{/maximum}} + {{#minimum}} + if '{{paramName}}' in local_var_params and local_var_params['{{paramName}}'] <{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{minimum}}: # noqa: E501 + raise ApiValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, must be a value greater than {{^exclusiveMinimum}}or equal to {{/exclusiveMinimum}}`{{minimum}}`") # noqa: E501 + {{/minimum}} + {{#pattern}} + if '{{paramName}}' in local_var_params and not re.search(r'{{{vendorExtensions.x-regex}}}', local_var_params['{{paramName}}']{{#vendorExtensions.x-modifiers}}{{#-first}}, flags={{/-first}}re.{{.}}{{^-last}} | {{/-last}}{{/vendorExtensions.x-modifiers}}): # noqa: E501 + raise ApiValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, must conform to the pattern `{{{pattern}}}`") # noqa: E501 + {{/pattern}} + {{#maxItems}} + if ('{{paramName}}' in local_var_params and + len(local_var_params['{{paramName}}']) > {{maxItems}}): + raise ApiValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, number of items must be less than or equal to `{{maxItems}}`") # noqa: E501 + {{/maxItems}} + {{#minItems}} + if ('{{paramName}}' in local_var_params and + len(local_var_params['{{paramName}}']) < {{minItems}}): + raise ApiValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, number of items must be greater than or equal to `{{minItems}}`") # noqa: E501 + {{/minItems}} +{{/hasValidation}} +{{/allParams}} + + collection_formats = {} + + path_params = {} +{{#pathParams}} + if '{{paramName}}' in local_var_params: + path_params['{{baseName}}'] = local_var_params['{{paramName}}']{{#isListContainer}} # noqa: E501 + collection_formats['{{baseName}}'] = '{{collectionFormat}}'{{/isListContainer}} # noqa: E501 +{{/pathParams}} + + query_params = [] +{{#queryParams}} + if '{{paramName}}' in local_var_params: + query_params.append(('{{baseName}}', local_var_params['{{paramName}}'])){{#isListContainer}} # noqa: E501 + collection_formats['{{baseName}}'] = '{{collectionFormat}}'{{/isListContainer}} # noqa: E501 +{{/queryParams}} + + header_params = {} +{{#headerParams}} + if '{{paramName}}' in local_var_params: + header_params['{{baseName}}'] = local_var_params['{{paramName}}']{{#isListContainer}} # noqa: E501 + collection_formats['{{baseName}}'] = '{{collectionFormat}}'{{/isListContainer}} # noqa: E501 +{{/headerParams}} + + form_params = [] + local_var_files = {} +{{#formParams}} + if '{{paramName}}' in local_var_params: + {{^isFile}}form_params.append(('{{baseName}}', local_var_params['{{paramName}}'])){{/isFile}}{{#isFile}}local_var_files['{{baseName}}'] = local_var_params['{{paramName}}']{{/isFile}}{{#isListContainer}} # noqa: E501 + collection_formats['{{baseName}}'] = '{{collectionFormat}}'{{/isListContainer}} # noqa: E501 +{{/formParams}} + + body_params = None +{{#bodyParam}} + if '{{paramName}}' in local_var_params: + body_params = local_var_params['{{paramName}}'] +{{/bodyParam}} + {{#hasProduces}} + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + [{{#produces}}'{{{mediaType}}}'{{#hasMore}}, {{/hasMore}}{{/produces}}]) # noqa: E501 + + {{/hasProduces}} + {{#hasConsumes}} + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + [{{#consumes}}'{{{mediaType}}}'{{#hasMore}}, {{/hasMore}}{{/consumes}}]) # noqa: E501 + + {{/hasConsumes}} + # Authentication setting + auth_settings = [{{#authMethods}}'{{name}}'{{#hasMore}}, {{/hasMore}}{{/authMethods}}] # noqa: E501 + + return self.api_client.call_api( + '{{{path}}}', '{{httpMethod}}', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type={{#returnType}}'{{returnType}}'{{/returnType}}{{^returnType}}None{{/returnType}}, # noqa: E501 + auth_settings=auth_settings, + async_req=local_var_params.get('async_req'), + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=local_var_params.get('_preload_content', True), + _request_timeout=local_var_params.get('_request_timeout'), + {{#servers.0}} + _host=local_var_host, + {{/servers.0}} + collection_formats=collection_formats) +{{/operation}} +{{/operations}} diff --git a/modules/openapi-generator/src/main/resources/python/python-experimental/api_client.mustache b/modules/openapi-generator/src/main/resources/python/python-experimental/api_client.mustache new file mode 100644 index 00000000000..e955eb05707 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/python/python-experimental/api_client.mustache @@ -0,0 +1,665 @@ +# coding: utf-8 +{{>partial_header}} +from __future__ import absolute_import + +import datetime +import inspect +import json +import mimetypes +from multiprocessing.pool import ThreadPool +import os +import re +import tempfile + +# python 2 and python 3 compatibility library +import six +from six.moves.urllib.parse import quote +{{#tornado}} +import tornado.gen +{{/tornado}} + +from {{packageName}}.configuration import Configuration +import {{modelPackage}} +from {{packageName}} import rest +from {{packageName}}.exceptions import ApiValueError + + +class ApiClient(object): + """Generic API client for OpenAPI client library builds. + + OpenAPI generic API client. This client handles the client- + server communication, and is invariant across implementations. Specifics of + the methods and models for each application are generated from the OpenAPI + templates. + + NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + Do not edit the class manually. + + :param configuration: .Configuration object for this client + :param header_name: a header to pass when making calls to the API. + :param header_value: a header value to pass when making calls to + the API. + :param cookie: a cookie to include in the header when making calls + to the API + :param pool_threads: The number of threads to use for async requests + to the API. More threads means more concurrent API requests. + """ + + PRIMITIVE_TYPES = (float, bool, bytes, six.text_type) + six.integer_types + NATIVE_TYPES_MAPPING = { + 'int': int, + 'long': int if six.PY3 else long, # noqa: F821 + 'float': float, + 'str': str, + 'bool': bool, + 'date': datetime.date, + 'datetime': datetime.datetime, + 'object': object, + } + _pool = None + + def __init__(self, configuration=None, header_name=None, header_value=None, + cookie=None, pool_threads=1): + if configuration is None: + configuration = Configuration() + self.configuration = configuration + self.pool_threads = pool_threads + + self.rest_client = rest.RESTClientObject(configuration) + self.default_headers = {} + if header_name is not None: + self.default_headers[header_name] = header_value + self.cookie = cookie + # Set default User-Agent. + self.user_agent = '{{#httpUserAgent}}{{{.}}}{{/httpUserAgent}}{{^httpUserAgent}}OpenAPI-Generator/{{{packageVersion}}}/python{{/httpUserAgent}}' + + def __del__(self): + if self._pool: + self._pool.close() + self._pool.join() + self._pool = None + + @property + def pool(self): + """Create thread pool on first request + avoids instantiating unused threadpool for blocking clients. + """ + if self._pool is None: + self._pool = ThreadPool(self.pool_threads) + return self._pool + + @property + def user_agent(self): + """User agent for this API client""" + return self.default_headers['User-Agent'] + + @user_agent.setter + def user_agent(self, value): + self.default_headers['User-Agent'] = value + + def set_default_header(self, header_name, header_value): + self.default_headers[header_name] = header_value + + {{#tornado}} + @tornado.gen.coroutine + {{/tornado}} + {{#asyncio}}async {{/asyncio}}def __call_api( + self, resource_path, method, path_params=None, + query_params=None, header_params=None, body=None, post_params=None, + files=None, response_type=None, auth_settings=None, + _return_http_data_only=None, collection_formats=None, + _preload_content=True, _request_timeout=None, _host=None): + + config = self.configuration + + # header parameters + header_params = header_params or {} + header_params.update(self.default_headers) + if self.cookie: + header_params['Cookie'] = self.cookie + if header_params: + header_params = self.sanitize_for_serialization(header_params) + header_params = dict(self.parameters_to_tuples(header_params, + collection_formats)) + + # path parameters + if path_params: + path_params = self.sanitize_for_serialization(path_params) + path_params = self.parameters_to_tuples(path_params, + collection_formats) + for k, v in path_params: + # specified safe chars, encode everything + resource_path = resource_path.replace( + '{%s}' % k, + quote(str(v), safe=config.safe_chars_for_path_param) + ) + + # query parameters + if query_params: + query_params = self.sanitize_for_serialization(query_params) + query_params = self.parameters_to_tuples(query_params, + collection_formats) + + # post parameters + if post_params or files: + post_params = post_params if post_params else [] + post_params = self.sanitize_for_serialization(post_params) + post_params = self.parameters_to_tuples(post_params, + collection_formats) + post_params.extend(self.files_parameters(files)) + + # auth setting + self.update_params_for_auth(header_params, query_params, auth_settings) + + # body + if body: + body = self.sanitize_for_serialization(body) + + # request url + if _host is None: + url = self.configuration.host + resource_path + else: + # use server/host defined in path or operation instead + url = _host + resource_path + + # perform request and return response + response_data = {{#asyncio}}await {{/asyncio}}{{#tornado}}yield {{/tornado}}self.request( + method, url, query_params=query_params, headers=header_params, + post_params=post_params, body=body, + _preload_content=_preload_content, + _request_timeout=_request_timeout) + + self.last_response = response_data + + return_data = response_data + if _preload_content: + # deserialize response data + if response_type: + return_data = self.deserialize(response_data, response_type) + else: + return_data = None + +{{^tornado}} + if _return_http_data_only: + return (return_data) + else: + return (return_data, response_data.status, + response_data.getheaders()) +{{/tornado}} +{{#tornado}} + if _return_http_data_only: + raise tornado.gen.Return(return_data) + else: + raise tornado.gen.Return((return_data, response_data.status, + response_data.getheaders())) +{{/tornado}} + + def sanitize_for_serialization(self, obj): + """Builds a JSON POST object. + + If obj is None, return None. + If obj is str, int, long, float, bool, return directly. + If obj is datetime.datetime, datetime.date + convert to string in iso8601 format. + If obj is list, sanitize each element in the list. + If obj is dict, return the dict. + If obj is OpenAPI model, return the properties dict. + + :param obj: The data to serialize. + :return: The serialized form of data. + """ + if obj is None: + return None + elif isinstance(obj, self.PRIMITIVE_TYPES): + return obj + elif isinstance(obj, list): + return [self.sanitize_for_serialization(sub_obj) + for sub_obj in obj] + elif isinstance(obj, tuple): + return tuple(self.sanitize_for_serialization(sub_obj) + for sub_obj in obj) + elif isinstance(obj, (datetime.datetime, datetime.date)): + return obj.isoformat() + + if isinstance(obj, dict): + obj_dict = obj + else: + # Convert model obj to dict except + # attributes `openapi_types`, `attribute_map` + # and attributes which value is not None. + # Convert attribute name to json key in + # model definition for request. + obj_dict = {obj.attribute_map[attr]: getattr(obj, attr) + for attr, _ in six.iteritems(obj.openapi_types) + if getattr(obj, attr) is not None} + + return {key: self.sanitize_for_serialization(val) + for key, val in six.iteritems(obj_dict)} + + def deserialize(self, response, response_type): + """Deserializes response into an object. + + :param response: RESTResponse object to be deserialized. + :param response_type: class literal for + deserialized object, or string of class name. + + :return: deserialized object. + """ + # handle file downloading + # save response body into a tmp file and return the instance + if response_type == "file": + return self.__deserialize_file(response) + + # fetch data from response object + try: + data = json.loads(response.data) + except ValueError: + data = response.data + + return self.__deserialize(data, response_type) + + def __deserialize(self, data, klass): + """Deserializes dict, list, str into an object. + + :param data: dict, list or str. + :param klass: class literal, or string of class name. + + :return: object. + """ + if data is None: + return None + + if type(klass) == str: + if klass.startswith('list['): + sub_kls = re.match(r'list\[(.*)\]', klass).group(1) + return [self.__deserialize(sub_data, sub_kls) + for sub_data in data] + + if klass.startswith('dict('): + sub_kls = re.match(r'dict\(([^,]*), (.*)\)', klass).group(2) + return {k: self.__deserialize(v, sub_kls) + for k, v in six.iteritems(data)} + + # convert str to class + if klass in self.NATIVE_TYPES_MAPPING: + klass = self.NATIVE_TYPES_MAPPING[klass] + else: + klass = getattr({{modelPackage}}, klass) + + if klass in self.PRIMITIVE_TYPES: + return self.__deserialize_primitive(data, klass) + elif klass == object: + return self.__deserialize_object(data) + elif klass == datetime.date: + return self.__deserialize_date(data) + elif klass == datetime.datetime: + return self.__deserialize_datatime(data) + else: + return self.__deserialize_model(data, klass) + + def call_api(self, resource_path, method, + path_params=None, query_params=None, header_params=None, + body=None, post_params=None, files=None, + response_type=None, auth_settings=None, async_req=None, + _return_http_data_only=None, collection_formats=None, + _preload_content=True, _request_timeout=None, _host=None): + """Makes the HTTP request (synchronous) and returns deserialized data. + + To make an async_req request, set the async_req parameter. + + :param resource_path: Path to method endpoint. + :param method: Method to call. + :param path_params: Path parameters in the url. + :param query_params: Query parameters in the url. + :param header_params: Header parameters to be + placed in the request header. + :param body: Request body. + :param post_params dict: Request post form parameters, + for `application/x-www-form-urlencoded`, `multipart/form-data`. + :param auth_settings list: Auth Settings names for the request. + :param response: Response data type. + :param files dict: key -> filename, value -> filepath, + for `multipart/form-data`. + :param async_req bool: execute request asynchronously + :param _return_http_data_only: response data without head status code + and headers + :param collection_formats: dict of collection formats for path, query, + header, and post parameters. + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: + If async_req parameter is True, + the request will be called asynchronously. + The method will return the request thread. + If parameter async_req is False or missing, + then the method will return the response directly. + """ + if not async_req: + return self.__call_api(resource_path, method, + path_params, query_params, header_params, + body, post_params, files, + response_type, auth_settings, + _return_http_data_only, collection_formats, + _preload_content, _request_timeout, _host) + else: + thread = self.pool.apply_async(self.__call_api, (resource_path, + method, path_params, query_params, + header_params, body, + post_params, files, + response_type, auth_settings, + _return_http_data_only, + collection_formats, + _preload_content, + _request_timeout, + _host)) + return thread + + def request(self, method, url, query_params=None, headers=None, + post_params=None, body=None, _preload_content=True, + _request_timeout=None): + """Makes the HTTP request using RESTClient.""" + if method == "GET": + return self.rest_client.GET(url, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + headers=headers) + elif method == "HEAD": + return self.rest_client.HEAD(url, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + headers=headers) + elif method == "OPTIONS": + return self.rest_client.OPTIONS(url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + elif method == "POST": + return self.rest_client.POST(url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + elif method == "PUT": + return self.rest_client.PUT(url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + elif method == "PATCH": + return self.rest_client.PATCH(url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + elif method == "DELETE": + return self.rest_client.DELETE(url, + query_params=query_params, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + else: + raise ApiValueError( + "http method must be `GET`, `HEAD`, `OPTIONS`," + " `POST`, `PATCH`, `PUT` or `DELETE`." + ) + + def parameters_to_tuples(self, params, collection_formats): + """Get parameters as list of tuples, formatting collections. + + :param params: Parameters as dict or list of two-tuples + :param dict collection_formats: Parameter collection formats + :return: Parameters as list of tuples, collections formatted + """ + new_params = [] + if collection_formats is None: + collection_formats = {} + for k, v in six.iteritems(params) if isinstance(params, dict) else params: # noqa: E501 + if k in collection_formats: + collection_format = collection_formats[k] + if collection_format == 'multi': + new_params.extend((k, value) for value in v) + else: + if collection_format == 'ssv': + delimiter = ' ' + elif collection_format == 'tsv': + delimiter = '\t' + elif collection_format == 'pipes': + delimiter = '|' + else: # csv is the default + delimiter = ',' + new_params.append( + (k, delimiter.join(str(value) for value in v))) + else: + new_params.append((k, v)) + return new_params + + def files_parameters(self, files=None): + """Builds form parameters. + + :param files: File parameters. + :return: Form parameters with files. + """ + params = [] + + if files: + for k, v in six.iteritems(files): + if not v: + continue + file_names = v if type(v) is list else [v] + for n in file_names: + with open(n, 'rb') as f: + filename = os.path.basename(f.name) + filedata = f.read() + mimetype = (mimetypes.guess_type(filename)[0] or + 'application/octet-stream') + params.append( + tuple([k, tuple([filename, filedata, mimetype])])) + + return params + + def select_header_accept(self, accepts): + """Returns `Accept` based on an array of accepts provided. + + :param accepts: List of headers. + :return: Accept (e.g. application/json). + """ + if not accepts: + return + + accepts = [x.lower() for x in accepts] + + if 'application/json' in accepts: + return 'application/json' + else: + return ', '.join(accepts) + + def select_header_content_type(self, content_types): + """Returns `Content-Type` based on an array of content_types provided. + + :param content_types: List of content-types. + :return: Content-Type (e.g. application/json). + """ + if not content_types: + return 'application/json' + + content_types = [x.lower() for x in content_types] + + if 'application/json' in content_types or '*/*' in content_types: + return 'application/json' + else: + return content_types[0] + + def update_params_for_auth(self, headers, querys, auth_settings): + """Updates header and query params based on authentication setting. + + :param headers: Header parameters dict to be updated. + :param querys: Query parameters tuple list to be updated. + :param auth_settings: Authentication setting identifiers list. + """ + if not auth_settings: + return + + for auth in auth_settings: + auth_setting = self.configuration.auth_settings().get(auth) + if auth_setting: + if not auth_setting['value']: + continue + elif auth_setting['in'] == 'cookie': + headers['Cookie'] = auth_setting['value'] + elif auth_setting['in'] == 'header': + headers[auth_setting['key']] = auth_setting['value'] + elif auth_setting['in'] == 'query': + querys.append((auth_setting['key'], auth_setting['value'])) + else: + raise ApiValueError( + 'Authentication token must be in `query` or `header`' + ) + + def __deserialize_file(self, response): + """Deserializes body to file + + Saves response body into a file in a temporary folder, + using the filename from the `Content-Disposition` header if provided. + + :param response: RESTResponse. + :return: file path. + """ + fd, path = tempfile.mkstemp(dir=self.configuration.temp_folder_path) + os.close(fd) + os.remove(path) + + content_disposition = response.getheader("Content-Disposition") + if content_disposition: + filename = re.search(r'filename=[\'"]?([^\'"\s]+)[\'"]?', + content_disposition).group(1) + path = os.path.join(os.path.dirname(path), filename) + + with open(path, "wb") as f: + f.write(response.data) + + return path + + def __deserialize_primitive(self, data, klass): + """Deserializes string to primitive type. + + :param data: str. + :param klass: class literal. + + :return: int, long, float, str, bool. + """ + try: + return klass(data) + except UnicodeEncodeError: + return six.text_type(data) + except TypeError: + return data + + def __deserialize_object(self, value): + """Return an original value. + + :return: object. + """ + return value + + def __deserialize_date(self, string): + """Deserializes string to date. + + :param string: str. + :return: date. + """ + try: + from dateutil.parser import parse + return parse(string).date() + except ImportError: + return string + except ValueError: + raise rest.ApiException( + status=0, + reason="Failed to parse `{0}` as date object".format(string) + ) + + def __deserialize_datatime(self, string): + """Deserializes string to datetime. + + The string should be in iso8601 datetime format. + + :param string: str. + :return: datetime. + """ + try: + from dateutil.parser import parse + return parse(string) + except ImportError: + return string + except ValueError: + raise rest.ApiException( + status=0, + reason=( + "Failed to parse `{0}` as datetime object" + .format(string) + ) + ) + + def __deserialize_model(self, data, klass): + """Deserializes list or dict to model. + + :param data: dict, list. + :param klass: class literal. + :return: model object. + """ + + if not klass.openapi_types and not hasattr(klass, + 'get_real_child_model'): + return data + + used_data = data + if not isinstance(data, (list, dict)): + used_data = [data] + keyword_args = {} + positional_args = [] + if klass.openapi_types is not None: + for attr, attr_type in six.iteritems(klass.openapi_types): + if (data is not None and + klass.attribute_map[attr] in used_data): + value = used_data[klass.attribute_map[attr]] + keyword_args[attr] = self.__deserialize(value, attr_type) + + end_index = None + argspec = inspect.getargspec(getattr(klass, '__init__')) + if argspec.defaults: + end_index = -len(argspec.defaults) + required_positional_args = argspec.args[1:end_index] + + for index, req_positional_arg in enumerate(required_positional_args): + if keyword_args and req_positional_arg in keyword_args: + positional_args.append(keyword_args[req_positional_arg]) + del keyword_args[req_positional_arg] + elif (not keyword_args and index < len(used_data) and + isinstance(used_data, list)): + positional_args.append(used_data[index]) + + instance = klass(*positional_args, **keyword_args) + + if hasattr(instance, 'get_real_child_model'): + klass_name = instance.get_real_child_model(data) + if klass_name: + instance = self.__deserialize(data, klass_name) + return instance diff --git a/modules/openapi-generator/src/main/resources/python/python-experimental/api_doc.mustache b/modules/openapi-generator/src/main/resources/python/python-experimental/api_doc.mustache new file mode 100644 index 00000000000..5cc638a2eb6 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/python/python-experimental/api_doc.mustache @@ -0,0 +1,78 @@ +# {{packageName}}.{{classname}}{{#description}} +{{description}}{{/description}} + +All URIs are relative to *{{basePath}}* + +Method | HTTP request | Description +------------- | ------------- | ------------- +{{#operations}}{{#operation}}[**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}} +{{/operation}}{{/operations}} + +{{#operations}} +{{#operation}} +# **{{{operationId}}}** +> {{#returnType}}{{{returnType}}} {{/returnType}}{{{operationId}}}({{#requiredParams}}{{^defaultValue}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/defaultValue}}{{/requiredParams}}) + +{{{summary}}}{{#notes}} + +{{{notes}}}{{/notes}} + +### Example + +{{#hasAuthMethods}} +{{#authMethods}} +{{#isBasic}} +{{^isBasicBearer}} +* Basic Authentication ({{name}}): +{{/isBasicBearer}} +{{#isBasicBearer}} +* Bearer{{#bearerFormat}} ({{{.}}}){{/bearerFormat}} Authentication ({{name}}): +{{/isBasicBearer}} +{{/isBasic}} +{{#isApiKey}} +* Api Key Authentication ({{name}}): +{{/isApiKey }} +{{#isOAuth}} +* OAuth Authentication ({{name}}): +{{/isOAuth }} +{{> api_doc_example }} +{{/authMethods}} +{{/hasAuthMethods}} +{{^hasAuthMethods}} +{{> api_doc_example }} +{{/hasAuthMethods}} +### Parameters +{{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}} +Name | Type | Description | Notes +------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}} +{{#requiredParams}}{{^defaultValue}} **{{paramName}}** | {{#isFile}}**{{dataType}}**{{/isFile}}{{^isFile}}{{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{dataType}}**]({{baseType}}.md){{/isPrimitiveType}}{{/isFile}}| {{description}} | +{{/defaultValue}}{{/requiredParams}}{{#requiredParams}}{{#defaultValue}} **{{paramName}}** | {{#isFile}}**{{dataType}}**{{/isFile}}{{^isFile}}{{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{dataType}}**]({{baseType}}.md){{/isPrimitiveType}}{{/isFile}}| {{description}} | defaults to {{{.}}} +{{/defaultValue}}{{/requiredParams}}{{#optionalParams}} **{{paramName}}** | {{#isFile}}**{{dataType}}**{{/isFile}}{{^isFile}}{{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{dataType}}**]({{baseType}}.md){{/isPrimitiveType}}{{/isFile}}| {{description}} | [optional]{{#defaultValue}} if omitted the server will use the default value of {{{.}}}{{/defaultValue}} +{{/optionalParams}} + +### Return type + +{{#returnType}}{{#returnTypeIsPrimitive}}**{{{returnType}}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{{returnType}}}**]({{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}void (empty response body){{/returnType}} + +### Authorization + +{{^authMethods}}No authorization required{{/authMethods}}{{#authMethods}}[{{{name}}}](../README.md#{{{name}}}){{^-last}}, {{/-last}}{{/authMethods}} + +### HTTP request headers + + - **Content-Type**: {{#consumes}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/consumes}}{{^consumes}}Not defined{{/consumes}} + - **Accept**: {{#produces}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/produces}}{{^produces}}Not defined{{/produces}} + +{{#responses.0}} +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +{{#responses}} +**{{code}}** | {{message}} | {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}} | +{{/responses}} +{{/responses.0}} + +[[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) + +{{/operation}} +{{/operations}} diff --git a/modules/openapi-generator/src/main/resources/python/python-experimental/api_doc_example.mustache b/modules/openapi-generator/src/main/resources/python/python-experimental/api_doc_example.mustache new file mode 100644 index 00000000000..e5eeee6b0ef --- /dev/null +++ b/modules/openapi-generator/src/main/resources/python/python-experimental/api_doc_example.mustache @@ -0,0 +1,58 @@ +```python +from __future__ import print_function +import time +import {{{packageName}}} +from {{{packageName}}}.rest import ApiException +from pprint import pprint +{{> python_doc_auth_partial}} +{{#hasAuthMethods}} +# Defining host is optional and default to {{{basePath}}} +configuration.host = "{{{basePath}}}" +# Create an instance of the API class +api_instance = {{{packageName}}}.{{{classname}}}({{{packageName}}}.ApiClient(configuration)) +{{/hasAuthMethods}} +{{^hasAuthMethods}} +# Create an instance of the API class +api_instance = {{{packageName}}}.{{{classname}}}() +{{/hasAuthMethods}} +{{#requiredParams}}{{^defaultValue}}{{paramName}} = {{{example}}} # {{{dataType}}} | {{{description}}} +{{/defaultValue}}{{/requiredParams}}{{#optionalParams}}{{paramName}} = {{{example}}} # {{{dataType}}} | {{{description}}}{{^required}} (optional){{/required}}{{#defaultValue}} if omitted the server will use the default value of {{{defaultValue}}}{{/defaultValue}} +{{/optionalParams}} + +{{#requiredParams}} +{{^hasMore}} +# example passing only required values which don't have defaults set +try: +{{#summary}} # {{{.}}} +{{/summary}} {{#returnType}}api_response = {{/returnType}}api_instance.{{{operationId}}}({{#requiredParams}}{{^defaultValue}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/defaultValue}}{{/requiredParams}}){{#returnType}} + pprint(api_response){{/returnType}} +except ApiException as e: + print("Exception when calling {{classname}}->{{operationId}}: %s\n" % e) +{{/hasMore}} +{{/requiredParams}} + +{{#optionalParams}} +{{^hasMore}} +# example passing only required values which don't have defaults set +# and optional values +try: +{{#summary}} # {{{.}}} +{{/summary}} {{#returnType}}api_response = {{/returnType}}api_instance.{{{operationId}}}({{#requiredParams}}{{^defaultValue}}{{paramName}}, {{/defaultValue}}{{/requiredParams}}{{#optionalParams}}{{paramName}}={{paramName}}{{#hasMore}}, {{/hasMore}}{{/optionalParams}}){{#returnType}} + pprint(api_response){{/returnType}} +except ApiException as e: + print("Exception when calling {{classname}}->{{operationId}}: %s\n" % e) +{{/hasMore}} +{{/optionalParams}} + +{{^requiredParams}} +{{^optionalParams}} +# example, this endpoint has no required or optional parameters +try: +{{#summary}} # {{{.}}} +{{/summary}} {{#returnType}}api_response = {{/returnType}}api_instance.{{{operationId}}}(){{#returnType}} + pprint(api_response){{/returnType}} +except ApiException as e: + print("Exception when calling {{classname}}->{{operationId}}: %s\n" % e) +{{/optionalParams}} +{{/requiredParams}} +``` diff --git a/modules/openapi-generator/src/main/resources/python/python-experimental/model.mustache b/modules/openapi-generator/src/main/resources/python/python-experimental/model.mustache new file mode 100644 index 00000000000..7dc8e01fa62 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/python/python-experimental/model.mustache @@ -0,0 +1,241 @@ +# coding: utf-8 + +{{>partial_header}} + +import pprint +import re # noqa: F401 + +import six + + +{{#models}} +{{#model}} +class {{classname}}(object): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """{{#allowableValues}} + + """ + allowed enum values + """ +{{#enumVars}} + {{name}} = {{{value}}}{{^-last}} +{{/-last}} +{{/enumVars}}{{/allowableValues}} + + """ + 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 = { +{{#requiredVars}} + '{{name}}': '{{{dataType}}}', +{{/requiredVars}} +{{#optionalVars}} + '{{name}}': '{{{dataType}}}', +{{/optionalVars}} + } + + attribute_map = { +{{#requiredVars}} + '{{name}}': '{{baseName}}', # noqa: E501 +{{/requiredVars}} +{{#optionalVars}} + '{{name}}': '{{baseName}}', # noqa: E501 +{{/optionalVars}} + } +{{#discriminator}} + + discriminator_value_class_map = { + {{#children}}'{{^vendorExtensions.x-discriminator-value}}{{name}}{{/vendorExtensions.x-discriminator-value}}{{#vendorExtensions.x-discriminator-value}}{{{vendorExtensions.x-discriminator-value}}}{{/vendorExtensions.x-discriminator-value}}': '{{{classname}}}'{{^-last}}, + {{/-last}}{{/children}} + } +{{/discriminator}} + + def __init__(self{{#requiredVars}}{{^defaultValue}}, {{name}}{{/defaultValue}}{{/requiredVars}}{{#requiredVars}}{{#defaultValue}}, {{name}}={{{defaultValue}}}{{/defaultValue}}{{/requiredVars}}{{#optionalVars}}, {{name}}=None{{/optionalVars}}): # noqa: E501 + """{{classname}} - a model defined in OpenAPI + +{{#requiredVars}}{{^hasMore}} Args:{{/hasMore}}{{/requiredVars}}{{#requiredVars}}{{^defaultValue}} + {{name}} ({{dataType}}):{{#description}} {{description}}{{/description}}{{/defaultValue}}{{/requiredVars}} + + Keyword Args:{{#requiredVars}}{{#defaultValue}} + {{name}} ({{dataType}}):{{#description}} {{description}}.{{/description}} defaults to {{{defaultValue}}}, must be one of [{{{defaultValue}}}]{{/defaultValue}} # noqa: E501{{/requiredVars}}{{#optionalVars}} + {{name}} ({{dataType}}):{{#description}} {{description}}.{{/description}} [optional]{{#defaultValue}} if omitted the server will use the default value of {{{defaultValue}}}{{/defaultValue}} # noqa: E501{{/optionalVars}} + """ +{{#vars}}{{#-first}} +{{/-first}} + self._{{name}} = None +{{/vars}} + self.discriminator = {{#discriminator}}'{{{discriminatorName}}}'{{/discriminator}}{{^discriminator}}None{{/discriminator}} +{{#vars}}{{#-first}} +{{/-first}} +{{#required}} + self.{{name}} = {{name}} +{{/required}} +{{^required}} +{{#isNullable}} + self.{{name}} = {{name}} +{{/isNullable}} +{{^isNullable}} + if {{name}} is not None: + self.{{name}} = {{name}} # noqa: E501 +{{/isNullable}} +{{/required}} +{{/vars}} + +{{#vars}} + @property + def {{name}}(self): + """Gets the {{name}} of this {{classname}}. # noqa: E501 + +{{#description}} + {{{description}}} # noqa: E501 +{{/description}} + + :return: The {{name}} of this {{classname}}. # noqa: E501 + :rtype: {{dataType}} + """ + return self._{{name}} + + @{{name}}.setter + def {{name}}( + self, + {{name}}): + """Sets the {{name}} of this {{classname}}. + +{{#description}} + {{{description}}} # noqa: E501 +{{/description}} + + :param {{name}}: The {{name}} of this {{classname}}. # noqa: E501 + :type: {{dataType}} + """ +{{^isNullable}} +{{#required}} + if {{name}} is None: + raise ValueError("Invalid value for `{{name}}`, must not be `None`") # noqa: E501 +{{/required}} +{{/isNullable}} +{{#isEnum}} +{{#isContainer}} + allowed_values = [{{#isNullable}}None,{{/isNullable}}{{#allowableValues}}{{#values}}{{#items.isString}}"{{/items.isString}}{{{this}}}{{#items.isString}}"{{/items.isString}}{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}] # noqa: E501 +{{#isListContainer}} + if not set({{{name}}}).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `{{{name}}}` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set({{{name}}}) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) +{{/isListContainer}} +{{#isMapContainer}} + if not set({{{name}}}.keys()).issubset(set(allowed_values)): + raise ValueError( + "Invalid keys in `{{{name}}}` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set({{{name}}}.keys()) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) +{{/isMapContainer}} +{{/isContainer}} +{{^isContainer}} + allowed_values = [{{#isNullable}}None,{{/isNullable}}{{#allowableValues}}{{#values}}{{#isString}}"{{/isString}}{{{this}}}{{#isString}}"{{/isString}}{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}] # noqa: E501 + if {{{name}}} not in allowed_values: + raise ValueError( + "Invalid value for `{{{name}}}` ({0}), must be one of {1}" # noqa: E501 + .format({{{name}}}, allowed_values) + ) +{{/isContainer}} +{{/isEnum}} +{{^isEnum}} +{{#hasValidation}} +{{#maxLength}} + if {{name}} is not None and len({{name}}) > {{maxLength}}: + raise ValueError("Invalid value for `{{name}}`, length must be less than or equal to `{{maxLength}}`") # noqa: E501 +{{/maxLength}} +{{#minLength}} + if {{name}} is not None and len({{name}}) < {{minLength}}: + raise ValueError("Invalid value for `{{name}}`, length must be greater than or equal to `{{minLength}}`") # noqa: E501 +{{/minLength}} +{{#maximum}} + if {{name}} is not None and {{name}} >{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{maximum}}: # noqa: E501 + raise ValueError("Invalid value for `{{name}}`, must be a value less than {{^exclusiveMaximum}}or equal to {{/exclusiveMaximum}}`{{maximum}}`") # noqa: E501 +{{/maximum}} +{{#minimum}} + if {{name}} is not None and {{name}} <{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{minimum}}: # noqa: E501 + raise ValueError("Invalid value for `{{name}}`, must be a value greater than {{^exclusiveMinimum}}or equal to {{/exclusiveMinimum}}`{{minimum}}`") # noqa: E501 +{{/minimum}} +{{#pattern}} + if {{name}} is not None and not re.search(r'{{{vendorExtensions.x-regex}}}', {{name}}{{#vendorExtensions.x-modifiers}}{{#-first}}, flags={{/-first}}re.{{.}}{{^-last}} | {{/-last}}{{/vendorExtensions.x-modifiers}}): # noqa: E501 + raise ValueError(r"Invalid value for `{{name}}`, must be a follow pattern or equal to `{{{pattern}}}`") # noqa: E501 +{{/pattern}} +{{#maxItems}} + if {{name}} is not None and len({{name}}) > {{maxItems}}: + raise ValueError("Invalid value for `{{name}}`, number of items must be less than or equal to `{{maxItems}}`") # noqa: E501 +{{/maxItems}} +{{#minItems}} + if {{name}} is not None and len({{name}}) < {{minItems}}: + raise ValueError("Invalid value for `{{name}}`, number of items must be greater than or equal to `{{minItems}}`") # noqa: E501 +{{/minItems}} +{{/hasValidation}} +{{/isEnum}} + + self._{{name}} = ( + {{name}}) + +{{/vars}} +{{#discriminator}} + def get_real_child_model(self, data): + """Returns the real base class specified by the discriminator""" + discriminator_key = self.attribute_map[self.discriminator] + discriminator_value = data[discriminator_key] + return self.discriminator_value_class_map.get(discriminator_value) + +{{/discriminator}} + 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, {{classname}}): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other +{{/model}} +{{/models}} diff --git a/modules/openapi-generator/src/main/resources/python/python-experimental/model_doc.mustache b/modules/openapi-generator/src/main/resources/python/python-experimental/model_doc.mustache new file mode 100644 index 00000000000..b6e1b263fcd --- /dev/null +++ b/modules/openapi-generator/src/main/resources/python/python-experimental/model_doc.mustache @@ -0,0 +1,13 @@ +{{#models}}{{#model}}# {{classname}} + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +{{#requiredVars}}{{^defaultValue}}**{{name}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{dataType}}**]({{complexType}}.md){{/isPrimitiveType}} | {{description}} | {{#readOnly}}[readonly] {{/readOnly}} +{{/defaultValue}}{{/requiredVars}}{{#requiredVars}}{{#defaultValue}}**{{name}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{dataType}}**]({{complexType}}.md){{/isPrimitiveType}} | {{description}} | {{^required}}[optional] {{/required}}{{#readOnly}}[readonly] {{/readOnly}}{{#defaultValue}}defaults to {{{.}}}{{/defaultValue}} +{{/defaultValue}}{{/requiredVars}}{{#optionalVars}}**{{name}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{dataType}}**]({{complexType}}.md){{/isPrimitiveType}} | {{description}} | [optional] {{#readOnly}}[readonly] {{/readOnly}}{{#defaultValue}} if omitted the server will use the default value of {{{.}}}{{/defaultValue}} +{{/optionalVars}} + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +{{/model}}{{/models}} diff --git a/modules/openapi-generator/src/test/resources/2_0/python-client-experimental/petstore-with-fake-endpoints-models-for-testing.yaml b/modules/openapi-generator/src/test/resources/2_0/python-client-experimental/petstore-with-fake-endpoints-models-for-testing.yaml index ed907f27854..d424cd93e96 100644 --- a/modules/openapi-generator/src/test/resources/2_0/python-client-experimental/petstore-with-fake-endpoints-models-for-testing.yaml +++ b/modules/openapi-generator/src/test/resources/2_0/python-client-experimental/petstore-with-fake-endpoints-models-for-testing.yaml @@ -1041,6 +1041,50 @@ paths: responses: '200': description: Success + /fake/enums-of-length-one/{path_string}/{path_integer}: + put: + tags: + - fake + description: 'This route has required values with enums of 1' + operationId: testEndpointEnumsLengthOne + parameters: + - in: query + name: query_integer + required: true + type: integer + format: int32 + enum: + - 3 + - in: query + name: query_string + required: true + type: string + enum: + - brillig + - in: path + name: path_string + required: true + type: string + enum: + - hello + - in: path + name: path_integer + required: true + type: integer + enum: + - 34 + - in: header + name: header_number + required: true + type: number + format: double + enum: + - 1.234 + consumes: + - application/json + responses: + '200': + description: Success '/fake/{petId}/uploadImageWithRequiredFile': post: tags: @@ -1703,6 +1747,7 @@ definitions: type: string TypeHolderDefault: type: object + description: a model to test optional properties with server defaults required: - string_item - number_item @@ -1716,12 +1761,25 @@ definitions: number_item: type: number default: 1.234 + format: double integer_item: type: integer + format: int32 default: -2 bool_item: type: boolean default: true + # swagger-parser does not see date defaults yet: https://github.com/swagger-api/swagger-parser/issues/971 + date_item: + type: string + format: date + default: 2017-07-21 + # swagger-parser does not see date-time defaults yet: https://github.com/swagger-api/swagger-parser/issues/971 + datetime_item: + type: string + format: date-time + default: 2017-07-21T17:32:28Z + # swagger-parser does not see array defaults yet: https://github.com/swagger-api/swagger-parser/issues/971 array_item: type: array items: @@ -1733,22 +1791,30 @@ definitions: - 3 TypeHolderExample: type: object + description: a model to test required properties with an example and length one enum required: - string_item - number_item - integer_item - bool_item - array_item + # - date_item/datetime_item adding date and datetime enums will be a future task, this does not yet work in many languages properties: string_item: type: string example: what + enum: [what] number_item: type: number + format: double example: 1.234 + enum: [1.234] integer_item: type: integer + format: int32 + enum: [-2] example: -2 + # swagger-parser does not see bool enums yet https://github.com/swagger-api/swagger-parser/issues/985 bool_item: type: boolean example: true @@ -1757,10 +1823,17 @@ definitions: items: type: integer example: - - 0 - - 1 - - 2 - - 3 + - + - 0 + - 1 + - 2 + - 3 + enum: + - + - 0 + - 1 + - 2 + - 3 XmlItem: type: object xml: @@ -1939,4 +2012,4 @@ definitions: type: integer xml: namespace: http://g.com/schema - prefix: g + prefix: g \ No newline at end of file diff --git a/samples/client/petstore/python-experimental/README.md b/samples/client/petstore/python-experimental/README.md index 3e91b2678be..8f84fade2fb 100644 --- a/samples/client/petstore/python-experimental/README.md +++ b/samples/client/petstore/python-experimental/README.md @@ -52,7 +52,9 @@ from petstore_api.rest import ApiException from pprint import pprint -# create an instance of the API class +# Defining host is optional and default to http://petstore.swagger.io:80/v2 +configuration.host = "http://petstore.swagger.io:80/v2" +# Create an instance of the API class api_instance = petstore_api.AnotherFakeApi(petstore_api.ApiClient(configuration)) body = petstore_api.Client() # Client | client model @@ -80,6 +82,7 @@ Class | Method | HTTP request | Description *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_enums_length_one**](docs/FakeApi.md#test_endpoint_enums_length_one) | **PUT** /fake/enums-of-length-one/{path_string}/{path_integer} | *FakeApi* | [**test_endpoint_parameters**](docs/FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 *FakeApi* | [**test_enum_parameters**](docs/FakeApi.md#test_enum_parameters) | **GET** /fake | To test enum parameters *FakeApi* | [**test_group_parameters**](docs/FakeApi.md#test_group_parameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) diff --git a/samples/client/petstore/python-experimental/docs/AnotherFakeApi.md b/samples/client/petstore/python-experimental/docs/AnotherFakeApi.md index c3f84772cfd..67906afc0cd 100644 --- a/samples/client/petstore/python-experimental/docs/AnotherFakeApi.md +++ b/samples/client/petstore/python-experimental/docs/AnotherFakeApi.md @@ -23,7 +23,7 @@ import petstore_api from petstore_api.rest import ApiException from pprint import pprint -# create an instance of the API class +# Create an instance of the API class api_instance = petstore_api.AnotherFakeApi() body = petstore_api.Client() # Client | client model @@ -39,7 +39,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Client**](Client.md)| client model | + **body** | [**Client**](Client.md)| client model | ### Return type diff --git a/samples/client/petstore/python-experimental/docs/FakeApi.md b/samples/client/petstore/python-experimental/docs/FakeApi.md index 946a8ce3e77..5aa5443d06f 100644 --- a/samples/client/petstore/python-experimental/docs/FakeApi.md +++ b/samples/client/petstore/python-experimental/docs/FakeApi.md @@ -12,6 +12,7 @@ Method | HTTP request | Description [**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_enums_length_one**](FakeApi.md#test_endpoint_enums_length_one) | **PUT** /fake/enums-of-length-one/{path_string}/{path_integer} | [**test_endpoint_parameters**](FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 [**test_enum_parameters**](FakeApi.md#test_enum_parameters) | **GET** /fake | To test enum parameters [**test_group_parameters**](FakeApi.md#test_group_parameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) @@ -35,7 +36,7 @@ import petstore_api from petstore_api.rest import ApiException from pprint import pprint -# create an instance of the API class +# Create an instance of the API class api_instance = petstore_api.FakeApi() xml_item = petstore_api.XmlItem() # XmlItem | XmlItem Body @@ -50,7 +51,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **xml_item** | [**XmlItem**](XmlItem.md)| XmlItem Body | + **xml_item** | [**XmlItem**](XmlItem.md)| XmlItem Body | ### Return type @@ -73,7 +74,7 @@ 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) # **fake_outer_boolean_serialize** -> bool fake_outer_boolean_serialize(body=body) +> bool fake_outer_boolean_serialize() @@ -88,7 +89,7 @@ import petstore_api from petstore_api.rest import ApiException from pprint import pprint -# create an instance of the API class +# Create an instance of the API class api_instance = petstore_api.FakeApi() body = True # bool | Input boolean as post body (optional) @@ -103,7 +104,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | **bool**| Input boolean as post body | [optional] + **body** | **bool**| Input boolean as post body | [optional] ### Return type @@ -126,7 +127,7 @@ 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) # **fake_outer_composite_serialize** -> OuterComposite fake_outer_composite_serialize(body=body) +> OuterComposite fake_outer_composite_serialize() @@ -141,7 +142,7 @@ import petstore_api from petstore_api.rest import ApiException from pprint import pprint -# create an instance of the API class +# Create an instance of the API class api_instance = petstore_api.FakeApi() body = petstore_api.OuterComposite() # OuterComposite | Input composite as post body (optional) @@ -156,7 +157,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional] + **body** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional] ### Return type @@ -179,7 +180,7 @@ 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) # **fake_outer_number_serialize** -> float fake_outer_number_serialize(body=body) +> float fake_outer_number_serialize() @@ -194,7 +195,7 @@ import petstore_api from petstore_api.rest import ApiException from pprint import pprint -# create an instance of the API class +# Create an instance of the API class api_instance = petstore_api.FakeApi() body = 3.4 # float | Input number as post body (optional) @@ -209,7 +210,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | **float**| Input number as post body | [optional] + **body** | **float**| Input number as post body | [optional] ### Return type @@ -232,7 +233,7 @@ 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) # **fake_outer_string_serialize** -> str fake_outer_string_serialize(body=body) +> str fake_outer_string_serialize() @@ -247,7 +248,7 @@ import petstore_api from petstore_api.rest import ApiException from pprint import pprint -# create an instance of the API class +# Create an instance of the API class api_instance = petstore_api.FakeApi() body = 'body_example' # str | Input string as post body (optional) @@ -262,7 +263,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | **str**| Input string as post body | [optional] + **body** | **str**| Input string as post body | [optional] ### Return type @@ -300,7 +301,7 @@ import petstore_api from petstore_api.rest import ApiException from pprint import pprint -# create an instance of the API class +# Create an instance of the API class api_instance = petstore_api.FakeApi() body = petstore_api.FileSchemaTestClass() # FileSchemaTestClass | @@ -314,7 +315,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| | + **body** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| | ### Return type @@ -350,7 +351,7 @@ import petstore_api from petstore_api.rest import ApiException from pprint import pprint -# create an instance of the API class +# Create an instance of the API class api_instance = petstore_api.FakeApi() query = 'query_example' # str | body = petstore_api.User() # User | @@ -365,8 +366,8 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **query** | **str**| | - **body** | [**User**](User.md)| | + **query** | **str**| | + **body** | [**User**](User.md)| | ### Return type @@ -404,7 +405,7 @@ import petstore_api from petstore_api.rest import ApiException from pprint import pprint -# create an instance of the API class +# Create an instance of the API class api_instance = petstore_api.FakeApi() body = petstore_api.Client() # Client | client model @@ -420,7 +421,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Client**](Client.md)| client model | + **body** | [**Client**](Client.md)| client model | ### Return type @@ -442,8 +443,68 @@ 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_endpoint_enums_length_one** +> test_endpoint_enums_length_one() + + + +This route has required values with enums of 1 + +### 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() +query_integer = 3 # int | (default to 3) +query_string = 'brillig' # str | (default to 'brillig') +path_string = 'hello' # str | (default to 'hello') +path_integer = 34 # int | (default to 34) +header_number = 1.234 # float | (default to 1.234) + +try: + api_instance.test_endpoint_enums_length_one(query_integer, query_string, path_string, path_integer, header_number) +except ApiException as e: + print("Exception when calling FakeApi->test_endpoint_enums_length_one: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **query_integer** | **int**| | defaults to 3 + **query_string** | **str**| | defaults to 'brillig' + **path_string** | **str**| | defaults to 'hello' + **path_integer** | **int**| | defaults to 34 + **header_number** | **float**| | defaults to 1.234 + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Success | - | + +[[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_endpoint_parameters** -> test_endpoint_parameters(number, double, pattern_without_delimiter, byte, integer=integer, int32=int32, int64=int64, float=float, string=string, binary=binary, date=date, date_time=date_time, password=password, param_callback=param_callback) +> test_endpoint_parameters(number, double, pattern_without_delimiter, byte) Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -463,7 +524,9 @@ configuration = petstore_api.Configuration() configuration.username = 'YOUR_USERNAME' configuration.password = 'YOUR_PASSWORD' -# create an instance of the API class +# Defining host is optional and default to http://petstore.swagger.io:80/v2 +configuration.host = "http://petstore.swagger.io:80/v2" +# Create an instance of the API class api_instance = petstore_api.FakeApi(petstore_api.ApiClient(configuration)) number = 3.4 # float | None double = 3.4 # float | None @@ -491,20 +554,20 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **number** | **float**| None | - **double** | **float**| None | - **pattern_without_delimiter** | **str**| None | - **byte** | **str**| None | - **integer** | **int**| None | [optional] - **int32** | **int**| None | [optional] - **int64** | **int**| None | [optional] - **float** | **float**| None | [optional] - **string** | **str**| None | [optional] - **binary** | **file**| None | [optional] - **date** | **date**| None | [optional] - **date_time** | **datetime**| None | [optional] - **password** | **str**| None | [optional] - **param_callback** | **str**| None | [optional] + **number** | **float**| None | + **double** | **float**| None | + **pattern_without_delimiter** | **str**| None | + **byte** | **str**| None | + **integer** | **int**| None | [optional] + **int32** | **int**| None | [optional] + **int64** | **int**| None | [optional] + **float** | **float**| None | [optional] + **string** | **str**| None | [optional] + **binary** | **file**| None | [optional] + **date** | **date**| None | [optional] + **date_time** | **datetime**| None | [optional] + **password** | **str**| None | [optional] + **param_callback** | **str**| None | [optional] ### Return type @@ -528,7 +591,7 @@ void (empty response body) [[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_enum_parameters** -> test_enum_parameters(enum_header_string_array=enum_header_string_array, enum_header_string=enum_header_string, enum_query_string_array=enum_query_string_array, enum_query_string=enum_query_string, enum_query_integer=enum_query_integer, enum_query_double=enum_query_double, enum_form_string_array=enum_form_string_array, enum_form_string=enum_form_string) +> test_enum_parameters() To test enum parameters @@ -543,7 +606,7 @@ import petstore_api from petstore_api.rest import ApiException from pprint import pprint -# create an instance of the API class +# Create an instance of the API class api_instance = petstore_api.FakeApi() enum_header_string_array = ['enum_header_string_array_example'] # list[str] | Header parameter enum test (string array) (optional) enum_header_string = '-efg' # str | Header parameter enum test (string) (optional) (default to '-efg') @@ -565,14 +628,14 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **enum_header_string_array** | [**list[str]**](str.md)| Header parameter enum test (string array) | [optional] - **enum_header_string** | **str**| Header parameter enum test (string) | [optional] [default to '-efg'] - **enum_query_string_array** | [**list[str]**](str.md)| Query parameter enum test (string array) | [optional] - **enum_query_string** | **str**| Query parameter enum test (string) | [optional] [default to '-efg'] - **enum_query_integer** | **int**| Query parameter enum test (double) | [optional] - **enum_query_double** | **float**| Query parameter enum test (double) | [optional] - **enum_form_string_array** | [**list[str]**](str.md)| Form parameter enum test (string array) | [optional] [default to '$'] - **enum_form_string** | **str**| Form parameter enum test (string) | [optional] [default to '-efg'] + **enum_header_string_array** | [**list[str]**](str.md)| Header parameter enum test (string array) | [optional] + **enum_header_string** | **str**| Header parameter enum test (string) | [optional] if omitted the server will use the default value of '-efg' + **enum_query_string_array** | [**list[str]**](str.md)| Query parameter enum test (string array) | [optional] + **enum_query_string** | **str**| Query parameter enum test (string) | [optional] if omitted the server will use the default value of '-efg' + **enum_query_integer** | **int**| Query parameter enum test (double) | [optional] + **enum_query_double** | **float**| Query parameter enum test (double) | [optional] + **enum_form_string_array** | [**list[str]**](str.md)| Form parameter enum test (string array) | [optional] if omitted the server will use the default value of '$' + **enum_form_string** | **str**| Form parameter enum test (string) | [optional] if omitted the server will use the default value of '-efg' ### Return type @@ -596,7 +659,7 @@ 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_group_parameters** -> test_group_parameters(required_string_group, required_boolean_group, required_int64_group, string_group=string_group, boolean_group=boolean_group, int64_group=int64_group) +> test_group_parameters(required_string_group, required_boolean_group, required_int64_group) Fake endpoint to test group parameters (optional) @@ -611,7 +674,7 @@ import petstore_api from petstore_api.rest import ApiException from pprint import pprint -# create an instance of the API class +# Create an instance of the API class api_instance = petstore_api.FakeApi() required_string_group = 56 # int | Required String in group parameters required_boolean_group = True # bool | Required Boolean in group parameters @@ -631,12 +694,12 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **required_string_group** | **int**| Required String in group parameters | - **required_boolean_group** | **bool**| Required Boolean in group parameters | - **required_int64_group** | **int**| Required Integer in group parameters | - **string_group** | **int**| String in group parameters | [optional] - **boolean_group** | **bool**| Boolean in group parameters | [optional] - **int64_group** | **int**| Integer in group parameters | [optional] + **required_string_group** | **int**| Required String in group parameters | + **required_boolean_group** | **bool**| Required Boolean in group parameters | + **required_int64_group** | **int**| Required Integer in group parameters | + **string_group** | **int**| String in group parameters | [optional] + **boolean_group** | **bool**| Boolean in group parameters | [optional] + **int64_group** | **int**| Integer in group parameters | [optional] ### Return type @@ -672,7 +735,7 @@ import petstore_api from petstore_api.rest import ApiException from pprint import pprint -# create an instance of the API class +# Create an instance of the API class api_instance = petstore_api.FakeApi() param = {'key': 'param_example'} # dict(str, str) | request body @@ -687,7 +750,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **param** | [**dict(str, str)**](str.md)| request body | + **param** | [**dict(str, str)**](str.md)| request body | ### Return type @@ -723,7 +786,7 @@ import petstore_api from petstore_api.rest import ApiException from pprint import pprint -# create an instance of the API class +# Create an instance of the API class api_instance = petstore_api.FakeApi() param = 'param_example' # str | field1 param2 = 'param2_example' # str | field2 @@ -739,8 +802,8 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **param** | **str**| field1 | - **param2** | **str**| field2 | + **param** | **str**| field1 | + **param2** | **str**| field2 | ### Return type diff --git a/samples/client/petstore/python-experimental/docs/FakeClassnameTags123Api.md b/samples/client/petstore/python-experimental/docs/FakeClassnameTags123Api.md index 7ffcf211224..321fd9e1854 100644 --- a/samples/client/petstore/python-experimental/docs/FakeClassnameTags123Api.md +++ b/samples/client/petstore/python-experimental/docs/FakeClassnameTags123Api.md @@ -29,7 +29,9 @@ configuration.api_key['api_key_query'] = 'YOUR_API_KEY' # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['api_key_query'] = 'Bearer' -# create an instance of the API class +# Defining host is optional and default to http://petstore.swagger.io:80/v2 +configuration.host = "http://petstore.swagger.io:80/v2" +# Create an instance of the API class api_instance = petstore_api.FakeClassnameTags123Api(petstore_api.ApiClient(configuration)) body = petstore_api.Client() # Client | client model @@ -45,7 +47,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Client**](Client.md)| client model | + **body** | [**Client**](Client.md)| client model | ### Return type diff --git a/samples/client/petstore/python-experimental/docs/PetApi.md b/samples/client/petstore/python-experimental/docs/PetApi.md index 3ed2551bd64..cda559d0c62 100644 --- a/samples/client/petstore/python-experimental/docs/PetApi.md +++ b/samples/client/petstore/python-experimental/docs/PetApi.md @@ -33,7 +33,9 @@ configuration = petstore_api.Configuration() # Configure OAuth2 access token for authorization: petstore_auth configuration.access_token = 'YOUR_ACCESS_TOKEN' -# create an instance of the API class +# Defining host is optional and default to http://petstore.swagger.io:80/v2 +configuration.host = "http://petstore.swagger.io:80/v2" +# Create an instance of the API class api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration)) body = petstore_api.Pet() # Pet | Pet object that needs to be added to the store @@ -48,7 +50,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | ### Return type @@ -72,7 +74,7 @@ void (empty response body) [[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) # **delete_pet** -> delete_pet(pet_id, api_key=api_key) +> delete_pet(pet_id) Deletes a pet @@ -89,7 +91,9 @@ configuration = petstore_api.Configuration() # Configure OAuth2 access token for authorization: petstore_auth configuration.access_token = 'YOUR_ACCESS_TOKEN' -# create an instance of the API class +# Defining host is optional and default to http://petstore.swagger.io:80/v2 +configuration.host = "http://petstore.swagger.io:80/v2" +# Create an instance of the API class api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration)) pet_id = 56 # int | Pet id to delete api_key = 'api_key_example' # str | (optional) @@ -105,8 +109,8 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **pet_id** | **int**| Pet id to delete | - **api_key** | **str**| | [optional] + **pet_id** | **int**| Pet id to delete | + **api_key** | **str**| | [optional] ### Return type @@ -149,7 +153,9 @@ configuration = petstore_api.Configuration() # Configure OAuth2 access token for authorization: petstore_auth configuration.access_token = 'YOUR_ACCESS_TOKEN' -# create an instance of the API class +# Defining host is optional and default to http://petstore.swagger.io:80/v2 +configuration.host = "http://petstore.swagger.io:80/v2" +# Create an instance of the API class api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration)) status = ['status_example'] # list[str] | Status values that need to be considered for filter @@ -165,7 +171,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **status** | [**list[str]**](str.md)| Status values that need to be considered for filter | + **status** | [**list[str]**](str.md)| Status values that need to be considered for filter | ### Return type @@ -208,7 +214,9 @@ configuration = petstore_api.Configuration() # Configure OAuth2 access token for authorization: petstore_auth configuration.access_token = 'YOUR_ACCESS_TOKEN' -# create an instance of the API class +# Defining host is optional and default to http://petstore.swagger.io:80/v2 +configuration.host = "http://petstore.swagger.io:80/v2" +# Create an instance of the API class api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration)) tags = ['tags_example'] # list[str] | Tags to filter by @@ -224,7 +232,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **tags** | [**list[str]**](str.md)| Tags to filter by | + **tags** | [**list[str]**](str.md)| Tags to filter by | ### Return type @@ -269,7 +277,9 @@ configuration.api_key['api_key'] = 'YOUR_API_KEY' # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['api_key'] = 'Bearer' -# create an instance of the API class +# Defining host is optional and default to http://petstore.swagger.io:80/v2 +configuration.host = "http://petstore.swagger.io:80/v2" +# Create an instance of the API class api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration)) pet_id = 56 # int | ID of pet to return @@ -285,7 +295,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **pet_id** | **int**| ID of pet to return | + **pet_id** | **int**| ID of pet to return | ### Return type @@ -327,7 +337,9 @@ configuration = petstore_api.Configuration() # Configure OAuth2 access token for authorization: petstore_auth configuration.access_token = 'YOUR_ACCESS_TOKEN' -# create an instance of the API class +# Defining host is optional and default to http://petstore.swagger.io:80/v2 +configuration.host = "http://petstore.swagger.io:80/v2" +# Create an instance of the API class api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration)) body = petstore_api.Pet() # Pet | Pet object that needs to be added to the store @@ -342,7 +354,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | ### Return type @@ -368,7 +380,7 @@ void (empty response body) [[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) # **update_pet_with_form** -> update_pet_with_form(pet_id, name=name, status=status) +> update_pet_with_form(pet_id) Updates a pet in the store with form data @@ -385,7 +397,9 @@ configuration = petstore_api.Configuration() # Configure OAuth2 access token for authorization: petstore_auth configuration.access_token = 'YOUR_ACCESS_TOKEN' -# create an instance of the API class +# Defining host is optional and default to http://petstore.swagger.io:80/v2 +configuration.host = "http://petstore.swagger.io:80/v2" +# Create an instance of the API class api_instance = petstore_api.PetApi(petstore_api.ApiClient(configuration)) pet_id = 56 # int | ID of pet that needs to be updated name = 'name_example' # str | Updated name of the pet (optional) @@ -402,9 +416,9 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **pet_id** | **int**| ID of pet that needs to be updated | - **name** | **str**| Updated name of the pet | [optional] - **status** | **str**| Updated status of the pet | [optional] + **pet_id** | **int**| ID of pet that needs to be updated | + **name** | **str**| Updated name of the pet | [optional] + **status** | **str**| Updated status of the pet | [optional] ### Return type @@ -427,7 +441,7 @@ void (empty response body) [[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** -> ApiResponse upload_file(pet_id, additional_metadata=additional_metadata, file=file) +> ApiResponse upload_file(pet_id) uploads an image @@ -444,7 +458,9 @@ configuration = petstore_api.Configuration() # Configure OAuth2 access token for authorization: petstore_auth configuration.access_token = 'YOUR_ACCESS_TOKEN' -# create an instance of the API class +# Defining host is optional and default to http://petstore.swagger.io:80/v2 +configuration.host = "http://petstore.swagger.io:80/v2" +# 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 additional_metadata = 'additional_metadata_example' # str | Additional data to pass to server (optional) @@ -462,9 +478,9 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **pet_id** | **int**| ID of pet to update | - **additional_metadata** | **str**| Additional data to pass to server | [optional] - **file** | **file**| file to upload | [optional] + **pet_id** | **int**| ID of pet to update | + **additional_metadata** | **str**| Additional data to pass to server | [optional] + **file** | **file**| file to upload | [optional] ### Return type @@ -487,7 +503,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, required_file, additional_metadata=additional_metadata) +> ApiResponse upload_file_with_required_file(pet_id, required_file) uploads an image (required) @@ -504,7 +520,9 @@ configuration = petstore_api.Configuration() # Configure OAuth2 access token for authorization: petstore_auth configuration.access_token = 'YOUR_ACCESS_TOKEN' -# create an instance of the API class +# Defining host is optional and default to http://petstore.swagger.io:80/v2 +configuration.host = "http://petstore.swagger.io:80/v2" +# 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 required_file = '/path/to/file' # file | file to upload @@ -522,9 +540,9 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **pet_id** | **int**| ID of pet to update | - **required_file** | **file**| file to upload | - **additional_metadata** | **str**| Additional data to pass to server | [optional] + **pet_id** | **int**| ID of pet to update | + **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-experimental/docs/StoreApi.md b/samples/client/petstore/python-experimental/docs/StoreApi.md index 76b94f73dcf..8c49f326222 100644 --- a/samples/client/petstore/python-experimental/docs/StoreApi.md +++ b/samples/client/petstore/python-experimental/docs/StoreApi.md @@ -26,7 +26,7 @@ import petstore_api from petstore_api.rest import ApiException from pprint import pprint -# create an instance of the API class +# Create an instance of the API class api_instance = petstore_api.StoreApi() order_id = 'order_id_example' # str | ID of the order that needs to be deleted @@ -41,7 +41,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **order_id** | **str**| ID of the order that needs to be deleted | + **order_id** | **str**| ID of the order that needs to be deleted | ### Return type @@ -86,7 +86,9 @@ configuration.api_key['api_key'] = 'YOUR_API_KEY' # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['api_key'] = 'Bearer' -# create an instance of the API class +# Defining host is optional and default to http://petstore.swagger.io:80/v2 +configuration.host = "http://petstore.swagger.io:80/v2" +# Create an instance of the API class api_instance = petstore_api.StoreApi(petstore_api.ApiClient(configuration)) try: @@ -136,7 +138,7 @@ import petstore_api from petstore_api.rest import ApiException from pprint import pprint -# create an instance of the API class +# Create an instance of the API class api_instance = petstore_api.StoreApi() order_id = 56 # int | ID of pet that needs to be fetched @@ -152,7 +154,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **order_id** | **int**| ID of pet that needs to be fetched | + **order_id** | **int**| ID of pet that needs to be fetched | ### Return type @@ -190,7 +192,7 @@ import petstore_api from petstore_api.rest import ApiException from pprint import pprint -# create an instance of the API class +# Create an instance of the API class api_instance = petstore_api.StoreApi() body = petstore_api.Order() # Order | order placed for purchasing the pet @@ -206,7 +208,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Order**](Order.md)| order placed for purchasing the pet | + **body** | [**Order**](Order.md)| order placed for purchasing the pet | ### Return type diff --git a/samples/client/petstore/python-experimental/docs/TypeHolderDefault.md b/samples/client/petstore/python-experimental/docs/TypeHolderDefault.md index 861da021826..fc82b9a827d 100644 --- a/samples/client/petstore/python-experimental/docs/TypeHolderDefault.md +++ b/samples/client/petstore/python-experimental/docs/TypeHolderDefault.md @@ -4,9 +4,11 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **string_item** | **str** | | [default to 'what'] -**number_item** | **float** | | -**integer_item** | **int** | | +**number_item** | **float** | | [default to 1.234] +**integer_item** | **int** | | [default to -2] **bool_item** | **bool** | | [default to True] +**date_item** | **date** | | [optional] +**datetime_item** | **datetime** | | [optional] **array_item** | **list[int]** | | [[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-experimental/docs/TypeHolderExample.md b/samples/client/petstore/python-experimental/docs/TypeHolderExample.md index d59718cdcb1..bb334f9925b 100644 --- a/samples/client/petstore/python-experimental/docs/TypeHolderExample.md +++ b/samples/client/petstore/python-experimental/docs/TypeHolderExample.md @@ -3,9 +3,9 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**string_item** | **str** | | -**number_item** | **float** | | -**integer_item** | **int** | | +**string_item** | **str** | | [default to 'what'] +**number_item** | **float** | | [default to 1.234] +**integer_item** | **int** | | [default to -2] **bool_item** | **bool** | | **array_item** | **list[int]** | | diff --git a/samples/client/petstore/python-experimental/docs/UserApi.md b/samples/client/petstore/python-experimental/docs/UserApi.md index 783bb991ce1..b4df7a36803 100644 --- a/samples/client/petstore/python-experimental/docs/UserApi.md +++ b/samples/client/petstore/python-experimental/docs/UserApi.md @@ -30,7 +30,7 @@ import petstore_api from petstore_api.rest import ApiException from pprint import pprint -# create an instance of the API class +# Create an instance of the API class api_instance = petstore_api.UserApi() body = petstore_api.User() # User | Created user object @@ -45,7 +45,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**User**](User.md)| Created user object | + **body** | [**User**](User.md)| Created user object | ### Return type @@ -81,7 +81,7 @@ import petstore_api from petstore_api.rest import ApiException from pprint import pprint -# create an instance of the API class +# Create an instance of the API class api_instance = petstore_api.UserApi() body = [petstore_api.User()] # list[User] | List of user object @@ -96,7 +96,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**list[User]**](User.md)| List of user object | + **body** | [**list[User]**](User.md)| List of user object | ### Return type @@ -132,7 +132,7 @@ import petstore_api from petstore_api.rest import ApiException from pprint import pprint -# create an instance of the API class +# Create an instance of the API class api_instance = petstore_api.UserApi() body = [petstore_api.User()] # list[User] | List of user object @@ -147,7 +147,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**list[User]**](User.md)| List of user object | + **body** | [**list[User]**](User.md)| List of user object | ### Return type @@ -185,7 +185,7 @@ import petstore_api from petstore_api.rest import ApiException from pprint import pprint -# create an instance of the API class +# Create an instance of the API class api_instance = petstore_api.UserApi() username = 'username_example' # str | The name that needs to be deleted @@ -200,7 +200,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **username** | **str**| The name that needs to be deleted | + **username** | **str**| The name that needs to be deleted | ### Return type @@ -237,7 +237,7 @@ import petstore_api from petstore_api.rest import ApiException from pprint import pprint -# create an instance of the API class +# Create an instance of the API class api_instance = petstore_api.UserApi() username = 'username_example' # str | The name that needs to be fetched. Use user1 for testing. @@ -253,7 +253,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **username** | **str**| The name that needs to be fetched. Use user1 for testing. | + **username** | **str**| The name that needs to be fetched. Use user1 for testing. | ### Return type @@ -291,7 +291,7 @@ import petstore_api from petstore_api.rest import ApiException from pprint import pprint -# create an instance of the API class +# Create an instance of the API class api_instance = petstore_api.UserApi() username = 'username_example' # str | The user name for login password = 'password_example' # str | The password for login in clear text @@ -308,8 +308,8 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **username** | **str**| The user name for login | - **password** | **str**| The password for login in clear text | + **username** | **str**| The user name for login | + **password** | **str**| The password for login in clear text | ### Return type @@ -346,7 +346,7 @@ import petstore_api from petstore_api.rest import ApiException from pprint import pprint -# create an instance of the API class +# Create an instance of the API class api_instance = petstore_api.UserApi() try: @@ -395,7 +395,7 @@ import petstore_api from petstore_api.rest import ApiException from pprint import pprint -# create an instance of the API class +# Create an instance of the API class api_instance = petstore_api.UserApi() username = 'username_example' # str | name that need to be deleted body = petstore_api.User() # User | Updated user object @@ -411,8 +411,8 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **username** | **str**| name that need to be deleted | - **body** | [**User**](User.md)| Updated user object | + **username** | **str**| name that need to be deleted | + **body** | [**User**](User.md)| Updated user object | ### Return type diff --git a/samples/client/petstore/python-experimental/openapi_client/api_client.py b/samples/client/petstore/python-experimental/openapi_client/api_client.py new file mode 100644 index 00000000000..efe3e5c3789 --- /dev/null +++ b/samples/client/petstore/python-experimental/openapi_client/api_client.py @@ -0,0 +1,658 @@ +# 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 + + The version of the OpenAPI document: 1.0.0 + Generated by: https://openapi-generator.tech +""" + +from __future__ import absolute_import + +import datetime +import inspect +import json +import mimetypes +from multiprocessing.pool import ThreadPool +import os +import re +import tempfile + +# python 2 and python 3 compatibility library +import six +from six.moves.urllib.parse import quote + +from petstore_api.configuration import Configuration +import petstore_api.models +from petstore_api import rest +from petstore_api.exceptions import ApiValueError + + +class ApiClient(object): + """Generic API client for OpenAPI client library builds. + + OpenAPI generic API client. This client handles the client- + server communication, and is invariant across implementations. Specifics of + the methods and models for each application are generated from the OpenAPI + templates. + + NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + Do not edit the class manually. + + :param configuration: .Configuration object for this client + :param header_name: a header to pass when making calls to the API. + :param header_value: a header value to pass when making calls to + the API. + :param cookie: a cookie to include in the header when making calls + to the API + :param pool_threads: The number of threads to use for async requests + to the API. More threads means more concurrent API requests. + """ + + PRIMITIVE_TYPES = (float, bool, bytes, six.text_type) + six.integer_types + NATIVE_TYPES_MAPPING = { + 'int': int, + 'long': int if six.PY3 else long, # noqa: F821 + 'float': float, + 'str': str, + 'bool': bool, + 'date': datetime.date, + 'datetime': datetime.datetime, + 'object': object, + } + _pool = None + + def __init__(self, configuration=None, header_name=None, header_value=None, + cookie=None, pool_threads=1): + if configuration is None: + configuration = Configuration() + self.configuration = configuration + self.pool_threads = pool_threads + + self.rest_client = rest.RESTClientObject(configuration) + self.default_headers = {} + if header_name is not None: + self.default_headers[header_name] = header_value + self.cookie = cookie + # Set default User-Agent. + self.user_agent = 'OpenAPI-Generator/1.0.0/python' + + def __del__(self): + if self._pool: + self._pool.close() + self._pool.join() + self._pool = None + + @property + def pool(self): + """Create thread pool on first request + avoids instantiating unused threadpool for blocking clients. + """ + if self._pool is None: + self._pool = ThreadPool(self.pool_threads) + return self._pool + + @property + def user_agent(self): + """User agent for this API client""" + return self.default_headers['User-Agent'] + + @user_agent.setter + def user_agent(self, value): + self.default_headers['User-Agent'] = value + + def set_default_header(self, header_name, header_value): + self.default_headers[header_name] = header_value + + def __call_api( + self, resource_path, method, path_params=None, + query_params=None, header_params=None, body=None, post_params=None, + files=None, response_type=None, auth_settings=None, + _return_http_data_only=None, collection_formats=None, + _preload_content=True, _request_timeout=None, _host=None): + + config = self.configuration + + # header parameters + header_params = header_params or {} + header_params.update(self.default_headers) + if self.cookie: + header_params['Cookie'] = self.cookie + if header_params: + header_params = self.sanitize_for_serialization(header_params) + header_params = dict(self.parameters_to_tuples(header_params, + collection_formats)) + + # path parameters + if path_params: + path_params = self.sanitize_for_serialization(path_params) + path_params = self.parameters_to_tuples(path_params, + collection_formats) + for k, v in path_params: + # specified safe chars, encode everything + resource_path = resource_path.replace( + '{%s}' % k, + quote(str(v), safe=config.safe_chars_for_path_param) + ) + + # query parameters + if query_params: + query_params = self.sanitize_for_serialization(query_params) + query_params = self.parameters_to_tuples(query_params, + collection_formats) + + # post parameters + if post_params or files: + post_params = post_params if post_params else [] + post_params = self.sanitize_for_serialization(post_params) + post_params = self.parameters_to_tuples(post_params, + collection_formats) + post_params.extend(self.files_parameters(files)) + + # auth setting + self.update_params_for_auth(header_params, query_params, auth_settings) + + # body + if body: + body = self.sanitize_for_serialization(body) + + # request url + if _host is None: + url = self.configuration.host + resource_path + else: + # use server/host defined in path or operation instead + url = _host + resource_path + + # perform request and return response + response_data = self.request( + method, url, query_params=query_params, headers=header_params, + post_params=post_params, body=body, + _preload_content=_preload_content, + _request_timeout=_request_timeout) + + self.last_response = response_data + + return_data = response_data + if _preload_content: + # deserialize response data + if response_type: + return_data = self.deserialize(response_data, response_type) + else: + return_data = None + + if _return_http_data_only: + return (return_data) + else: + return (return_data, response_data.status, + response_data.getheaders()) + + def sanitize_for_serialization(self, obj): + """Builds a JSON POST object. + + If obj is None, return None. + If obj is str, int, long, float, bool, return directly. + If obj is datetime.datetime, datetime.date + convert to string in iso8601 format. + If obj is list, sanitize each element in the list. + If obj is dict, return the dict. + If obj is OpenAPI model, return the properties dict. + + :param obj: The data to serialize. + :return: The serialized form of data. + """ + if obj is None: + return None + elif isinstance(obj, self.PRIMITIVE_TYPES): + return obj + elif isinstance(obj, list): + return [self.sanitize_for_serialization(sub_obj) + for sub_obj in obj] + elif isinstance(obj, tuple): + return tuple(self.sanitize_for_serialization(sub_obj) + for sub_obj in obj) + elif isinstance(obj, (datetime.datetime, datetime.date)): + return obj.isoformat() + + if isinstance(obj, dict): + obj_dict = obj + else: + # Convert model obj to dict except + # attributes `openapi_types`, `attribute_map` + # and attributes which value is not None. + # Convert attribute name to json key in + # model definition for request. + obj_dict = {obj.attribute_map[attr]: getattr(obj, attr) + for attr, _ in six.iteritems(obj.openapi_types) + if getattr(obj, attr) is not None} + + return {key: self.sanitize_for_serialization(val) + for key, val in six.iteritems(obj_dict)} + + def deserialize(self, response, response_type): + """Deserializes response into an object. + + :param response: RESTResponse object to be deserialized. + :param response_type: class literal for + deserialized object, or string of class name. + + :return: deserialized object. + """ + # handle file downloading + # save response body into a tmp file and return the instance + if response_type == "file": + return self.__deserialize_file(response) + + # fetch data from response object + try: + data = json.loads(response.data) + except ValueError: + data = response.data + + return self.__deserialize(data, response_type) + + def __deserialize(self, data, klass): + """Deserializes dict, list, str into an object. + + :param data: dict, list or str. + :param klass: class literal, or string of class name. + + :return: object. + """ + if data is None: + return None + + if type(klass) == str: + if klass.startswith('list['): + sub_kls = re.match(r'list\[(.*)\]', klass).group(1) + return [self.__deserialize(sub_data, sub_kls) + for sub_data in data] + + if klass.startswith('dict('): + sub_kls = re.match(r'dict\(([^,]*), (.*)\)', klass).group(2) + return {k: self.__deserialize(v, sub_kls) + for k, v in six.iteritems(data)} + + # convert str to class + if klass in self.NATIVE_TYPES_MAPPING: + klass = self.NATIVE_TYPES_MAPPING[klass] + else: + klass = getattr(petstore_api.models, klass) + + if klass in self.PRIMITIVE_TYPES: + return self.__deserialize_primitive(data, klass) + elif klass == object: + return self.__deserialize_object(data) + elif klass == datetime.date: + return self.__deserialize_date(data) + elif klass == datetime.datetime: + return self.__deserialize_datatime(data) + else: + return self.__deserialize_model(data, klass) + + def call_api(self, resource_path, method, + path_params=None, query_params=None, header_params=None, + body=None, post_params=None, files=None, + response_type=None, auth_settings=None, async_req=None, + _return_http_data_only=None, collection_formats=None, + _preload_content=True, _request_timeout=None, _host=None): + """Makes the HTTP request (synchronous) and returns deserialized data. + + To make an async_req request, set the async_req parameter. + + :param resource_path: Path to method endpoint. + :param method: Method to call. + :param path_params: Path parameters in the url. + :param query_params: Query parameters in the url. + :param header_params: Header parameters to be + placed in the request header. + :param body: Request body. + :param post_params dict: Request post form parameters, + for `application/x-www-form-urlencoded`, `multipart/form-data`. + :param auth_settings list: Auth Settings names for the request. + :param response: Response data type. + :param files dict: key -> filename, value -> filepath, + for `multipart/form-data`. + :param async_req bool: execute request asynchronously + :param _return_http_data_only: response data without head status code + and headers + :param collection_formats: dict of collection formats for path, query, + header, and post parameters. + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: + If async_req parameter is True, + the request will be called asynchronously. + The method will return the request thread. + If parameter async_req is False or missing, + then the method will return the response directly. + """ + if not async_req: + return self.__call_api(resource_path, method, + path_params, query_params, header_params, + body, post_params, files, + response_type, auth_settings, + _return_http_data_only, collection_formats, + _preload_content, _request_timeout, _host) + else: + thread = self.pool.apply_async(self.__call_api, (resource_path, + method, path_params, query_params, + header_params, body, + post_params, files, + response_type, auth_settings, + _return_http_data_only, + collection_formats, + _preload_content, + _request_timeout, + _host)) + return thread + + def request(self, method, url, query_params=None, headers=None, + post_params=None, body=None, _preload_content=True, + _request_timeout=None): + """Makes the HTTP request using RESTClient.""" + if method == "GET": + return self.rest_client.GET(url, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + headers=headers) + elif method == "HEAD": + return self.rest_client.HEAD(url, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + headers=headers) + elif method == "OPTIONS": + return self.rest_client.OPTIONS(url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + elif method == "POST": + return self.rest_client.POST(url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + elif method == "PUT": + return self.rest_client.PUT(url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + elif method == "PATCH": + return self.rest_client.PATCH(url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + elif method == "DELETE": + return self.rest_client.DELETE(url, + query_params=query_params, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + else: + raise ApiValueError( + "http method must be `GET`, `HEAD`, `OPTIONS`," + " `POST`, `PATCH`, `PUT` or `DELETE`." + ) + + def parameters_to_tuples(self, params, collection_formats): + """Get parameters as list of tuples, formatting collections. + + :param params: Parameters as dict or list of two-tuples + :param dict collection_formats: Parameter collection formats + :return: Parameters as list of tuples, collections formatted + """ + new_params = [] + if collection_formats is None: + collection_formats = {} + for k, v in six.iteritems(params) if isinstance(params, dict) else params: # noqa: E501 + if k in collection_formats: + collection_format = collection_formats[k] + if collection_format == 'multi': + new_params.extend((k, value) for value in v) + else: + if collection_format == 'ssv': + delimiter = ' ' + elif collection_format == 'tsv': + delimiter = '\t' + elif collection_format == 'pipes': + delimiter = '|' + else: # csv is the default + delimiter = ',' + new_params.append( + (k, delimiter.join(str(value) for value in v))) + else: + new_params.append((k, v)) + return new_params + + def files_parameters(self, files=None): + """Builds form parameters. + + :param files: File parameters. + :return: Form parameters with files. + """ + params = [] + + if files: + for k, v in six.iteritems(files): + if not v: + continue + file_names = v if type(v) is list else [v] + for n in file_names: + with open(n, 'rb') as f: + filename = os.path.basename(f.name) + filedata = f.read() + mimetype = (mimetypes.guess_type(filename)[0] or + 'application/octet-stream') + params.append( + tuple([k, tuple([filename, filedata, mimetype])])) + + return params + + def select_header_accept(self, accepts): + """Returns `Accept` based on an array of accepts provided. + + :param accepts: List of headers. + :return: Accept (e.g. application/json). + """ + if not accepts: + return + + accepts = [x.lower() for x in accepts] + + if 'application/json' in accepts: + return 'application/json' + else: + return ', '.join(accepts) + + def select_header_content_type(self, content_types): + """Returns `Content-Type` based on an array of content_types provided. + + :param content_types: List of content-types. + :return: Content-Type (e.g. application/json). + """ + if not content_types: + return 'application/json' + + content_types = [x.lower() for x in content_types] + + if 'application/json' in content_types or '*/*' in content_types: + return 'application/json' + else: + return content_types[0] + + def update_params_for_auth(self, headers, querys, auth_settings): + """Updates header and query params based on authentication setting. + + :param headers: Header parameters dict to be updated. + :param querys: Query parameters tuple list to be updated. + :param auth_settings: Authentication setting identifiers list. + """ + if not auth_settings: + return + + for auth in auth_settings: + auth_setting = self.configuration.auth_settings().get(auth) + if auth_setting: + if not auth_setting['value']: + continue + elif auth_setting['in'] == 'cookie': + headers['Cookie'] = auth_setting['value'] + elif auth_setting['in'] == 'header': + headers[auth_setting['key']] = auth_setting['value'] + elif auth_setting['in'] == 'query': + querys.append((auth_setting['key'], auth_setting['value'])) + else: + raise ApiValueError( + 'Authentication token must be in `query` or `header`' + ) + + def __deserialize_file(self, response): + """Deserializes body to file + + Saves response body into a file in a temporary folder, + using the filename from the `Content-Disposition` header if provided. + + :param response: RESTResponse. + :return: file path. + """ + fd, path = tempfile.mkstemp(dir=self.configuration.temp_folder_path) + os.close(fd) + os.remove(path) + + content_disposition = response.getheader("Content-Disposition") + if content_disposition: + filename = re.search(r'filename=[\'"]?([^\'"\s]+)[\'"]?', + content_disposition).group(1) + path = os.path.join(os.path.dirname(path), filename) + + with open(path, "wb") as f: + f.write(response.data) + + return path + + def __deserialize_primitive(self, data, klass): + """Deserializes string to primitive type. + + :param data: str. + :param klass: class literal. + + :return: int, long, float, str, bool. + """ + try: + return klass(data) + except UnicodeEncodeError: + return six.text_type(data) + except TypeError: + return data + + def __deserialize_object(self, value): + """Return an original value. + + :return: object. + """ + return value + + def __deserialize_date(self, string): + """Deserializes string to date. + + :param string: str. + :return: date. + """ + try: + from dateutil.parser import parse + return parse(string).date() + except ImportError: + return string + except ValueError: + raise rest.ApiException( + status=0, + reason="Failed to parse `{0}` as date object".format(string) + ) + + def __deserialize_datatime(self, string): + """Deserializes string to datetime. + + The string should be in iso8601 datetime format. + + :param string: str. + :return: datetime. + """ + try: + from dateutil.parser import parse + return parse(string) + except ImportError: + return string + except ValueError: + raise rest.ApiException( + status=0, + reason=( + "Failed to parse `{0}` as datetime object" + .format(string) + ) + ) + + def __deserialize_model(self, data, klass): + """Deserializes list or dict to model. + + :param data: dict, list. + :param klass: class literal. + :return: model object. + """ + + if not klass.openapi_types and not hasattr(klass, + 'get_real_child_model'): + return data + + used_data = data + if not isinstance(data, (list, dict)): + used_data = [data] + keyword_args = {} + positional_args = [] + if klass.openapi_types is not None: + for attr, attr_type in six.iteritems(klass.openapi_types): + if (data is not None and + klass.attribute_map[attr] in used_data): + value = used_data[klass.attribute_map[attr]] + keyword_args[attr] = self.__deserialize(value, attr_type) + + end_index = None + argspec = inspect.getargspec(getattr(klass, '__init__')) + if argspec.defaults: + end_index = -len(argspec.defaults) + required_positional_args = argspec.args[1:end_index] + + for index, req_positional_arg in enumerate(required_positional_args): + if keyword_args and req_positional_arg in keyword_args: + positional_args.append(keyword_args[req_positional_arg]) + del keyword_args[req_positional_arg] + elif (not keyword_args and index < len(used_data) and + isinstance(used_data, list)): + positional_args.append(used_data[index]) + + instance = klass(*positional_args, **keyword_args) + + if hasattr(instance, 'get_real_child_model'): + klass_name = instance.get_real_child_model(data) + if klass_name: + instance = self.__deserialize(data, klass_name) + return instance diff --git a/samples/client/petstore/python-experimental/petstore_api/api/another_fake_api.py b/samples/client/petstore/python-experimental/petstore_api/api/another_fake_api.py index a47a8e3ea18..01d055616eb 100644 --- a/samples/client/petstore/python-experimental/petstore_api/api/another_fake_api.py +++ b/samples/client/petstore/python-experimental/petstore_api/api/another_fake_api.py @@ -18,7 +18,7 @@ import re # noqa: F401 import six from petstore_api.api_client import ApiClient -from petstore_api.exceptions import ( +from petstore_api.exceptions import ( # noqa: F401 ApiTypeError, ApiValueError ) @@ -45,21 +45,28 @@ class AnotherFakeApi(object): >>> thread = api.call_123_test_special_tags(body, async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param Client body: client model (required) - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Client - If the method is called asynchronously, - returns the request thread. + Args: + body (Client): client model + + Keyword Args: + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + Client: """ kwargs['_return_http_data_only'] = True - return self.call_123_test_special_tags_with_http_info(body, **kwargs) # noqa: E501 + if kwargs.get('async_req'): + return self.call_123_test_special_tags_with_http_info(body, **kwargs) # noqa: E501 + else: + (data) = self.call_123_test_special_tags_with_http_info(body, **kwargs) # noqa: E501 + return data def call_123_test_special_tags_with_http_info(self, body, **kwargs): # noqa: E501 """To test special tags # noqa: E501 @@ -70,20 +77,21 @@ class AnotherFakeApi(object): >>> thread = api.call_123_test_special_tags_with_http_info(body, async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param Client body: client model (required) - :param _return_http_data_only: response data without head status code - and headers - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: tuple(Client, status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, - returns the request thread. + Args: + body (Client): client model + + Keyword Args: + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + Client: """ local_var_params = locals() diff --git a/samples/client/petstore/python-experimental/petstore_api/api/fake_api.py b/samples/client/petstore/python-experimental/petstore_api/api/fake_api.py index 1847804c552..0f14ef6739d 100644 --- a/samples/client/petstore/python-experimental/petstore_api/api/fake_api.py +++ b/samples/client/petstore/python-experimental/petstore_api/api/fake_api.py @@ -18,7 +18,7 @@ import re # noqa: F401 import six from petstore_api.api_client import ApiClient -from petstore_api.exceptions import ( +from petstore_api.exceptions import ( # noqa: F401 ApiTypeError, ApiValueError ) @@ -45,21 +45,28 @@ class FakeApi(object): >>> thread = api.create_xml_item(xml_item, async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param XmlItem xml_item: XmlItem Body (required) - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: None - If the method is called asynchronously, - returns the request thread. + Args: + xml_item (XmlItem): XmlItem Body + + Keyword Args: + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + None: """ kwargs['_return_http_data_only'] = True - return self.create_xml_item_with_http_info(xml_item, **kwargs) # noqa: E501 + if kwargs.get('async_req'): + return self.create_xml_item_with_http_info(xml_item, **kwargs) # noqa: E501 + else: + (data) = self.create_xml_item_with_http_info(xml_item, **kwargs) # noqa: E501 + return data def create_xml_item_with_http_info(self, xml_item, **kwargs): # noqa: E501 """creates an XmlItem # noqa: E501 @@ -70,20 +77,21 @@ class FakeApi(object): >>> thread = api.create_xml_item_with_http_info(xml_item, async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param XmlItem xml_item: XmlItem Body (required) - :param _return_http_data_only: response data without head status code - and headers - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: None - If the method is called asynchronously, - returns the request thread. + Args: + xml_item (XmlItem): XmlItem Body + + Keyword Args: + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + None: """ local_var_params = locals() @@ -153,21 +161,28 @@ class FakeApi(object): >>> thread = api.fake_outer_boolean_serialize(async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param bool body: Input boolean as post body - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: bool - If the method is called asynchronously, - returns the request thread. + + + Keyword Args: + body (bool): Input boolean as post body. [optional] + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + bool: """ kwargs['_return_http_data_only'] = True - return self.fake_outer_boolean_serialize_with_http_info(**kwargs) # noqa: E501 + if kwargs.get('async_req'): + return self.fake_outer_boolean_serialize_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.fake_outer_boolean_serialize_with_http_info(**kwargs) # noqa: E501 + return data def fake_outer_boolean_serialize_with_http_info(self, **kwargs): # noqa: E501 """fake_outer_boolean_serialize # noqa: E501 @@ -178,20 +193,21 @@ class FakeApi(object): >>> thread = api.fake_outer_boolean_serialize_with_http_info(async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param bool body: Input boolean as post body - :param _return_http_data_only: response data without head status code - and headers - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: tuple(bool, status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, - returns the request thread. + + + Keyword Args: + body (bool): Input boolean as post body. [optional] + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + bool: """ local_var_params = locals() @@ -257,21 +273,28 @@ class FakeApi(object): >>> thread = api.fake_outer_composite_serialize(async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param OuterComposite body: Input composite as post body - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: OuterComposite - If the method is called asynchronously, - returns the request thread. + + + Keyword Args: + body (OuterComposite): Input composite as post body. [optional] + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + OuterComposite: """ kwargs['_return_http_data_only'] = True - return self.fake_outer_composite_serialize_with_http_info(**kwargs) # noqa: E501 + if kwargs.get('async_req'): + return self.fake_outer_composite_serialize_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.fake_outer_composite_serialize_with_http_info(**kwargs) # noqa: E501 + return data def fake_outer_composite_serialize_with_http_info(self, **kwargs): # noqa: E501 """fake_outer_composite_serialize # noqa: E501 @@ -282,20 +305,21 @@ class FakeApi(object): >>> thread = api.fake_outer_composite_serialize_with_http_info(async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param OuterComposite body: Input composite as post body - :param _return_http_data_only: response data without head status code - and headers - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: tuple(OuterComposite, status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, - returns the request thread. + + + Keyword Args: + body (OuterComposite): Input composite as post body. [optional] + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + OuterComposite: """ local_var_params = locals() @@ -361,21 +385,28 @@ class FakeApi(object): >>> thread = api.fake_outer_number_serialize(async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param float body: Input number as post body - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: float - If the method is called asynchronously, - returns the request thread. + + + Keyword Args: + body (float): Input number as post body. [optional] + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + float: """ kwargs['_return_http_data_only'] = True - return self.fake_outer_number_serialize_with_http_info(**kwargs) # noqa: E501 + if kwargs.get('async_req'): + return self.fake_outer_number_serialize_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.fake_outer_number_serialize_with_http_info(**kwargs) # noqa: E501 + return data def fake_outer_number_serialize_with_http_info(self, **kwargs): # noqa: E501 """fake_outer_number_serialize # noqa: E501 @@ -386,20 +417,21 @@ class FakeApi(object): >>> thread = api.fake_outer_number_serialize_with_http_info(async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param float body: Input number as post body - :param _return_http_data_only: response data without head status code - and headers - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: tuple(float, status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, - returns the request thread. + + + Keyword Args: + body (float): Input number as post body. [optional] + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + float: """ local_var_params = locals() @@ -465,21 +497,28 @@ class FakeApi(object): >>> thread = api.fake_outer_string_serialize(async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param str body: Input string as post body - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: str - If the method is called asynchronously, - returns the request thread. + + + Keyword Args: + body (str): Input string as post body. [optional] + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + str: """ kwargs['_return_http_data_only'] = True - return self.fake_outer_string_serialize_with_http_info(**kwargs) # noqa: E501 + if kwargs.get('async_req'): + return self.fake_outer_string_serialize_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.fake_outer_string_serialize_with_http_info(**kwargs) # noqa: E501 + return data def fake_outer_string_serialize_with_http_info(self, **kwargs): # noqa: E501 """fake_outer_string_serialize # noqa: E501 @@ -490,20 +529,21 @@ class FakeApi(object): >>> thread = api.fake_outer_string_serialize_with_http_info(async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param str body: Input string as post body - :param _return_http_data_only: response data without head status code - and headers - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: tuple(str, status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, - returns the request thread. + + + Keyword Args: + body (str): Input string as post body. [optional] + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + str: """ local_var_params = locals() @@ -569,21 +609,28 @@ class FakeApi(object): >>> thread = api.test_body_with_file_schema(body, async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param FileSchemaTestClass body: (required) - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: None - If the method is called asynchronously, - returns the request thread. + Args: + body (FileSchemaTestClass): + + Keyword Args: + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + None: """ kwargs['_return_http_data_only'] = True - return self.test_body_with_file_schema_with_http_info(body, **kwargs) # noqa: E501 + if kwargs.get('async_req'): + return self.test_body_with_file_schema_with_http_info(body, **kwargs) # noqa: E501 + else: + (data) = self.test_body_with_file_schema_with_http_info(body, **kwargs) # noqa: E501 + return data def test_body_with_file_schema_with_http_info(self, body, **kwargs): # noqa: E501 """test_body_with_file_schema # noqa: E501 @@ -594,20 +641,21 @@ class FakeApi(object): >>> thread = api.test_body_with_file_schema_with_http_info(body, async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param FileSchemaTestClass body: (required) - :param _return_http_data_only: response data without head status code - and headers - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: None - If the method is called asynchronously, - returns the request thread. + Args: + body (FileSchemaTestClass): + + Keyword Args: + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + None: """ local_var_params = locals() @@ -676,22 +724,28 @@ class FakeApi(object): >>> thread = api.test_body_with_query_params(query, body, async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param str query: (required) - :param User body: (required) - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: None - If the method is called asynchronously, - returns the request thread. + Args: + query (str): body (User): + + Keyword Args: + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + None: """ kwargs['_return_http_data_only'] = True - return self.test_body_with_query_params_with_http_info(query, body, **kwargs) # noqa: E501 + if kwargs.get('async_req'): + return self.test_body_with_query_params_with_http_info(query, body, **kwargs) # noqa: E501 + else: + (data) = self.test_body_with_query_params_with_http_info(query, body, **kwargs) # noqa: E501 + return data def test_body_with_query_params_with_http_info(self, query, body, **kwargs): # noqa: E501 """test_body_with_query_params # noqa: E501 @@ -701,21 +755,21 @@ class FakeApi(object): >>> thread = api.test_body_with_query_params_with_http_info(query, body, async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param str query: (required) - :param User body: (required) - :param _return_http_data_only: response data without head status code - and headers - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: None - If the method is called asynchronously, - returns the request thread. + Args: + query (str): body (User): + + Keyword Args: + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + None: """ local_var_params = locals() @@ -791,21 +845,28 @@ class FakeApi(object): >>> thread = api.test_client_model(body, async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param Client body: client model (required) - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Client - If the method is called asynchronously, - returns the request thread. + Args: + body (Client): client model + + Keyword Args: + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + Client: """ kwargs['_return_http_data_only'] = True - return self.test_client_model_with_http_info(body, **kwargs) # noqa: E501 + if kwargs.get('async_req'): + return self.test_client_model_with_http_info(body, **kwargs) # noqa: E501 + else: + (data) = self.test_client_model_with_http_info(body, **kwargs) # noqa: E501 + return data def test_client_model_with_http_info(self, body, **kwargs): # noqa: E501 """To test \"client\" model # noqa: E501 @@ -816,20 +877,21 @@ class FakeApi(object): >>> thread = api.test_client_model_with_http_info(body, async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param Client body: client model (required) - :param _return_http_data_only: response data without head status code - and headers - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: tuple(Client, status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, - returns the request thread. + Args: + body (Client): client model + + Keyword Args: + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + Client: """ local_var_params = locals() @@ -894,6 +956,187 @@ class FakeApi(object): _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) + def test_endpoint_enums_length_one(self, query_integer=3, query_string='brillig', path_string='hello', path_integer=34, header_number=1.234, **kwargs): # noqa: E501 + """test_endpoint_enums_length_one # noqa: E501 + + This route has required values with enums of 1 # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.test_endpoint_enums_length_one(query_integer=3, query_string='brillig', path_string='hello', path_integer=34, header_number=1.234, async_req=True) + >>> result = thread.get() + + Args: + + query_integer (int): defaults to 3, must be one of [3] + query_string (str): defaults to 'brillig', must be one of ['brillig'] + path_string (str): defaults to 'hello', must be one of ['hello'] + path_integer (int): defaults to 34, must be one of [34] + header_number (float): defaults to 1.234, must be one of [1.234] + + Keyword Args: + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + None: + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.test_endpoint_enums_length_one_with_http_info(query_integer=query_integer, query_string=query_string, path_string=path_string, path_integer=path_integer, header_number=header_number, **kwargs) # noqa: E501 + else: + (data) = self.test_endpoint_enums_length_one_with_http_info(query_integer=query_integer, query_string=query_string, path_string=path_string, path_integer=path_integer, header_number=header_number, **kwargs) # noqa: E501 + return data + + def test_endpoint_enums_length_one_with_http_info(self, query_integer=None, query_string=None, path_string=None, path_integer=None, header_number=None, **kwargs): # noqa: E501 + """test_endpoint_enums_length_one # noqa: E501 + + This route has required values with enums of 1 # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.test_endpoint_enums_length_one_with_http_info(async_req=True) + >>> result = thread.get() + + Args: + + query_integer (int): defaults to 3, must be one of [3] + query_string (str): defaults to 'brillig', must be one of ['brillig'] + path_string (str): defaults to 'hello', must be one of ['hello'] + path_integer (int): defaults to 34, must be one of [34] + header_number (float): defaults to 1.234, must be one of [1.234] + + Keyword Args: + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + None: + """ + + local_var_params = locals() + + all_params = ['query_integer', 'query_string', 'path_string', 'path_integer', 'header_number'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + for key, val in six.iteritems(local_var_params['kwargs']): + if key not in all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method test_endpoint_enums_length_one" % key + ) + local_var_params[key] = val + del local_var_params['kwargs'] + # verify the required parameter 'query_integer' is set + if ('query_integer' not in local_var_params or + local_var_params['query_integer'] is None): + raise ApiValueError("Missing the required parameter `query_integer` when calling `test_endpoint_enums_length_one`") # noqa: E501 + # verify the required parameter 'query_string' is set + if ('query_string' not in local_var_params or + local_var_params['query_string'] is None): + raise ApiValueError("Missing the required parameter `query_string` when calling `test_endpoint_enums_length_one`") # noqa: E501 + # verify the required parameter 'path_string' is set + if ('path_string' not in local_var_params or + local_var_params['path_string'] is None): + raise ApiValueError("Missing the required parameter `path_string` when calling `test_endpoint_enums_length_one`") # noqa: E501 + # verify the required parameter 'path_integer' is set + if ('path_integer' not in local_var_params or + local_var_params['path_integer'] is None): + raise ApiValueError("Missing the required parameter `path_integer` when calling `test_endpoint_enums_length_one`") # noqa: E501 + # verify the required parameter 'header_number' is set + if ('header_number' not in local_var_params or + local_var_params['header_number'] is None): + raise ApiValueError("Missing the required parameter `header_number` when calling `test_endpoint_enums_length_one`") # noqa: E501 + allowed_values = [3] # noqa: E501 + if ('query_integer' in local_var_params and + local_var_params['query_integer'] not in allowed_values): + raise ValueError( + "Invalid value for `query_integer` ({0}), must be one of {1}" # noqa: E501 + .format(local_var_params['query_integer'], allowed_values) + ) + allowed_values = ["brillig"] # noqa: E501 + if ('query_string' in local_var_params and + local_var_params['query_string'] not in allowed_values): + raise ValueError( + "Invalid value for `query_string` ({0}), must be one of {1}" # noqa: E501 + .format(local_var_params['query_string'], allowed_values) + ) + allowed_values = ["hello"] # noqa: E501 + if ('path_string' in local_var_params and + local_var_params['path_string'] not in allowed_values): + raise ValueError( + "Invalid value for `path_string` ({0}), must be one of {1}" # noqa: E501 + .format(local_var_params['path_string'], allowed_values) + ) + allowed_values = [34] # noqa: E501 + if ('path_integer' in local_var_params and + local_var_params['path_integer'] not in allowed_values): + raise ValueError( + "Invalid value for `path_integer` ({0}), must be one of {1}" # noqa: E501 + .format(local_var_params['path_integer'], allowed_values) + ) + allowed_values = [1.234] # noqa: E501 + if ('header_number' in local_var_params and + local_var_params['header_number'] not in allowed_values): + raise ValueError( + "Invalid value for `header_number` ({0}), must be one of {1}" # noqa: E501 + .format(local_var_params['header_number'], allowed_values) + ) + + collection_formats = {} + + path_params = {} + if 'path_string' in local_var_params: + path_params['path_string'] = local_var_params['path_string'] # noqa: E501 + if 'path_integer' in local_var_params: + path_params['path_integer'] = local_var_params['path_integer'] # noqa: E501 + + query_params = [] + if 'query_integer' in local_var_params: + query_params.append(('query_integer', local_var_params['query_integer'])) # noqa: E501 + if 'query_string' in local_var_params: + query_params.append(('query_string', local_var_params['query_string'])) # noqa: E501 + + header_params = {} + if 'header_number' in local_var_params: + header_params['header_number'] = local_var_params['header_number'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/fake/enums-of-length-one/{path_string}/{path_integer}', '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_req=local_var_params.get('async_req'), + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=local_var_params.get('_preload_content', True), + _request_timeout=local_var_params.get('_request_timeout'), + collection_formats=collection_formats) + def test_endpoint_parameters(self, number, double, pattern_without_delimiter, byte, **kwargs): # noqa: E501 """Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501 @@ -903,34 +1146,38 @@ class FakeApi(object): >>> thread = api.test_endpoint_parameters(number, double, pattern_without_delimiter, byte, async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param float number: None (required) - :param float double: None (required) - :param str pattern_without_delimiter: None (required) - :param str byte: None (required) - :param int integer: None - :param int int32: None - :param int int64: None - :param float float: None - :param str string: None - :param file binary: None - :param date date: None - :param datetime date_time: None - :param str password: None - :param str param_callback: None - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: None - If the method is called asynchronously, - returns the request thread. + Args: + number (float): None double (float): None pattern_without_delimiter (str): None byte (str): None + + Keyword Args: + integer (int): None. [optional] + int32 (int): None. [optional] + int64 (int): None. [optional] + float (float): None. [optional] + string (str): None. [optional] + binary (file): None. [optional] + date (date): None. [optional] + date_time (datetime): None. [optional] + password (str): None. [optional] + param_callback (str): None. [optional] + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + None: """ kwargs['_return_http_data_only'] = True - return self.test_endpoint_parameters_with_http_info(number, double, pattern_without_delimiter, byte, **kwargs) # noqa: E501 + if kwargs.get('async_req'): + return self.test_endpoint_parameters_with_http_info(number, double, pattern_without_delimiter, byte, **kwargs) # noqa: E501 + else: + (data) = self.test_endpoint_parameters_with_http_info(number, double, pattern_without_delimiter, byte, **kwargs) # noqa: E501 + return data def test_endpoint_parameters_with_http_info(self, number, double, pattern_without_delimiter, byte, **kwargs): # noqa: E501 """Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501 @@ -941,33 +1188,31 @@ class FakeApi(object): >>> thread = api.test_endpoint_parameters_with_http_info(number, double, pattern_without_delimiter, byte, async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param float number: None (required) - :param float double: None (required) - :param str pattern_without_delimiter: None (required) - :param str byte: None (required) - :param int integer: None - :param int int32: None - :param int int64: None - :param float float: None - :param str string: None - :param file binary: None - :param date date: None - :param datetime date_time: None - :param str password: None - :param str param_callback: None - :param _return_http_data_only: response data without head status code - and headers - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: None - If the method is called asynchronously, - returns the request thread. + Args: + number (float): None double (float): None pattern_without_delimiter (str): None byte (str): None + + Keyword Args: + integer (int): None. [optional] + int32 (int): None. [optional] + int64 (int): None. [optional] + float (float): None. [optional] + string (str): None. [optional] + binary (file): None. [optional] + date (date): None. [optional] + date_time (datetime): None. [optional] + password (str): None. [optional] + param_callback (str): None. [optional] + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + None: """ local_var_params = locals() @@ -1002,7 +1247,6 @@ class FakeApi(object): if ('byte' not in local_var_params or local_var_params['byte'] is None): raise ApiValueError("Missing the required parameter `byte` when calling `test_endpoint_parameters`") # noqa: E501 - if 'number' in local_var_params and local_var_params['number'] > 543.2: # noqa: E501 raise ApiValueError("Invalid value for parameter `number` when calling `test_endpoint_parameters`, must be a value less than or equal to `543.2`") # noqa: E501 if 'number' in local_var_params and local_var_params['number'] < 32.1: # noqa: E501 @@ -1031,6 +1275,7 @@ class FakeApi(object): if ('password' in local_var_params and len(local_var_params['password']) < 10): raise ApiValueError("Invalid value for parameter `password` when calling `test_endpoint_parameters`, length must be greater than or equal to `10`") # noqa: E501 + collection_formats = {} path_params = {} @@ -1103,28 +1348,35 @@ class FakeApi(object): >>> thread = api.test_enum_parameters(async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param list[str] enum_header_string_array: Header parameter enum test (string array) - :param str enum_header_string: Header parameter enum test (string) - :param list[str] enum_query_string_array: Query parameter enum test (string array) - :param str enum_query_string: Query parameter enum test (string) - :param int enum_query_integer: Query parameter enum test (double) - :param float enum_query_double: Query parameter enum test (double) - :param list[str] enum_form_string_array: Form parameter enum test (string array) - :param str enum_form_string: Form parameter enum test (string) - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: None - If the method is called asynchronously, - returns the request thread. + + + Keyword Args: + enum_header_string_array (list[str]): Header parameter enum test (string array). [optional] + enum_header_string (str): Header parameter enum test (string). [optional] if omitted the server will use the default value of '-efg' + enum_query_string_array (list[str]): Query parameter enum test (string array). [optional] + enum_query_string (str): Query parameter enum test (string). [optional] if omitted the server will use the default value of '-efg' + enum_query_integer (int): Query parameter enum test (double). [optional] + enum_query_double (float): Query parameter enum test (double). [optional] + enum_form_string_array (list[str]): Form parameter enum test (string array). [optional] if omitted the server will use the default value of '$' + enum_form_string (str): Form parameter enum test (string). [optional] if omitted the server will use the default value of '-efg' + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + None: """ kwargs['_return_http_data_only'] = True - return self.test_enum_parameters_with_http_info(**kwargs) # noqa: E501 + if kwargs.get('async_req'): + return self.test_enum_parameters_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.test_enum_parameters_with_http_info(**kwargs) # noqa: E501 + return data def test_enum_parameters_with_http_info(self, **kwargs): # noqa: E501 """To test enum parameters # noqa: E501 @@ -1135,27 +1387,28 @@ class FakeApi(object): >>> thread = api.test_enum_parameters_with_http_info(async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param list[str] enum_header_string_array: Header parameter enum test (string array) - :param str enum_header_string: Header parameter enum test (string) - :param list[str] enum_query_string_array: Query parameter enum test (string array) - :param str enum_query_string: Query parameter enum test (string) - :param int enum_query_integer: Query parameter enum test (double) - :param float enum_query_double: Query parameter enum test (double) - :param list[str] enum_form_string_array: Form parameter enum test (string array) - :param str enum_form_string: Form parameter enum test (string) - :param _return_http_data_only: response data without head status code - and headers - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: None - If the method is called asynchronously, - returns the request thread. + + + Keyword Args: + enum_header_string_array (list[str]): Header parameter enum test (string array). [optional] + enum_header_string (str): Header parameter enum test (string). [optional] if omitted the server will use the default value of '-efg' + enum_query_string_array (list[str]): Query parameter enum test (string array). [optional] + enum_query_string (str): Query parameter enum test (string). [optional] if omitted the server will use the default value of '-efg' + enum_query_integer (int): Query parameter enum test (double). [optional] + enum_query_double (float): Query parameter enum test (double). [optional] + enum_form_string_array (list[str]): Form parameter enum test (string array). [optional] if omitted the server will use the default value of '$' + enum_form_string (str): Form parameter enum test (string). [optional] if omitted the server will use the default value of '-efg' + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + None: """ local_var_params = locals() @@ -1174,6 +1427,65 @@ class FakeApi(object): ) local_var_params[key] = val del local_var_params['kwargs'] + allowed_values = [">", "$"] # noqa: E501 + if ('enum_header_string_array' in local_var_params and + not set(local_var_params['enum_header_string_array']).issubset(set(allowed_values))): # noqa: E501 + raise ValueError( + "Invalid values for `enum_header_string_array` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(local_var_params['enum_header_string_array']) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + allowed_values = ["_abc", "-efg", "(xyz)"] # noqa: E501 + if ('enum_header_string' in local_var_params and + local_var_params['enum_header_string'] not in allowed_values): + raise ValueError( + "Invalid value for `enum_header_string` ({0}), must be one of {1}" # noqa: E501 + .format(local_var_params['enum_header_string'], allowed_values) + ) + allowed_values = [">", "$"] # noqa: E501 + if ('enum_query_string_array' in local_var_params and + not set(local_var_params['enum_query_string_array']).issubset(set(allowed_values))): # noqa: E501 + raise ValueError( + "Invalid values for `enum_query_string_array` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(local_var_params['enum_query_string_array']) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + allowed_values = ["_abc", "-efg", "(xyz)"] # noqa: E501 + if ('enum_query_string' in local_var_params and + local_var_params['enum_query_string'] not in allowed_values): + raise ValueError( + "Invalid value for `enum_query_string` ({0}), must be one of {1}" # noqa: E501 + .format(local_var_params['enum_query_string'], allowed_values) + ) + allowed_values = [1, -2] # noqa: E501 + if ('enum_query_integer' in local_var_params and + local_var_params['enum_query_integer'] not in allowed_values): + raise ValueError( + "Invalid value for `enum_query_integer` ({0}), must be one of {1}" # noqa: E501 + .format(local_var_params['enum_query_integer'], allowed_values) + ) + allowed_values = [1.1, -1.2] # noqa: E501 + if ('enum_query_double' in local_var_params and + local_var_params['enum_query_double'] not in allowed_values): + raise ValueError( + "Invalid value for `enum_query_double` ({0}), must be one of {1}" # noqa: E501 + .format(local_var_params['enum_query_double'], allowed_values) + ) + allowed_values = [">", "$"] # noqa: E501 + if ('enum_form_string_array' in local_var_params and + not set(local_var_params['enum_form_string_array']).issubset(set(allowed_values))): # noqa: E501 + raise ValueError( + "Invalid values for `enum_form_string_array` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(local_var_params['enum_form_string_array']) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + allowed_values = ["_abc", "-efg", "(xyz)"] # noqa: E501 + if ('enum_form_string' in local_var_params and + local_var_params['enum_form_string'] not in allowed_values): + raise ValueError( + "Invalid value for `enum_form_string` ({0}), must be one of {1}" # noqa: E501 + .format(local_var_params['enum_form_string'], allowed_values) + ) collection_formats = {} @@ -1238,26 +1550,31 @@ class FakeApi(object): >>> thread = api.test_group_parameters(required_string_group, required_boolean_group, required_int64_group, async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param int required_string_group: Required String in group parameters (required) - :param bool required_boolean_group: Required Boolean in group parameters (required) - :param int required_int64_group: Required Integer in group parameters (required) - :param int string_group: String in group parameters - :param bool boolean_group: Boolean in group parameters - :param int int64_group: Integer in group parameters - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: None - If the method is called asynchronously, - returns the request thread. + Args: + required_string_group (int): Required String in group parameters required_boolean_group (bool): Required Boolean in group parameters required_int64_group (int): Required Integer in group parameters + + Keyword Args: + string_group (int): String in group parameters. [optional] + boolean_group (bool): Boolean in group parameters. [optional] + int64_group (int): Integer in group parameters. [optional] + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + None: """ kwargs['_return_http_data_only'] = True - return self.test_group_parameters_with_http_info(required_string_group, required_boolean_group, required_int64_group, **kwargs) # noqa: E501 + if kwargs.get('async_req'): + return self.test_group_parameters_with_http_info(required_string_group, required_boolean_group, required_int64_group, **kwargs) # noqa: E501 + else: + (data) = self.test_group_parameters_with_http_info(required_string_group, required_boolean_group, required_int64_group, **kwargs) # noqa: E501 + return data def test_group_parameters_with_http_info(self, required_string_group, required_boolean_group, required_int64_group, **kwargs): # noqa: E501 """Fake endpoint to test group parameters (optional) # noqa: E501 @@ -1268,25 +1585,24 @@ class FakeApi(object): >>> thread = api.test_group_parameters_with_http_info(required_string_group, required_boolean_group, required_int64_group, async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param int required_string_group: Required String in group parameters (required) - :param bool required_boolean_group: Required Boolean in group parameters (required) - :param int required_int64_group: Required Integer in group parameters (required) - :param int string_group: String in group parameters - :param bool boolean_group: Boolean in group parameters - :param int int64_group: Integer in group parameters - :param _return_http_data_only: response data without head status code - and headers - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: None - If the method is called asynchronously, - returns the request thread. + Args: + required_string_group (int): Required String in group parameters required_boolean_group (bool): Required Boolean in group parameters required_int64_group (int): Required Integer in group parameters + + Keyword Args: + string_group (int): String in group parameters. [optional] + boolean_group (bool): Boolean in group parameters. [optional] + int64_group (int): Integer in group parameters. [optional] + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + None: """ local_var_params = locals() @@ -1369,21 +1685,28 @@ class FakeApi(object): >>> thread = api.test_inline_additional_properties(param, async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param dict(str, str) param: request body (required) - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: None - If the method is called asynchronously, - returns the request thread. + Args: + param (dict(str, str)): request body + + Keyword Args: + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + None: """ kwargs['_return_http_data_only'] = True - return self.test_inline_additional_properties_with_http_info(param, **kwargs) # noqa: E501 + if kwargs.get('async_req'): + return self.test_inline_additional_properties_with_http_info(param, **kwargs) # noqa: E501 + else: + (data) = self.test_inline_additional_properties_with_http_info(param, **kwargs) # noqa: E501 + return data def test_inline_additional_properties_with_http_info(self, param, **kwargs): # noqa: E501 """test inline additionalProperties # noqa: E501 @@ -1393,20 +1716,21 @@ class FakeApi(object): >>> thread = api.test_inline_additional_properties_with_http_info(param, async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param dict(str, str) param: request body (required) - :param _return_http_data_only: response data without head status code - and headers - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: None - If the method is called asynchronously, - returns the request thread. + Args: + param (dict(str, str)): request body + + Keyword Args: + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + None: """ local_var_params = locals() @@ -1475,22 +1799,28 @@ class FakeApi(object): >>> thread = api.test_json_form_data(param, param2, async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param str param: field1 (required) - :param str param2: field2 (required) - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: None - If the method is called asynchronously, - returns the request thread. + Args: + param (str): field1 param2 (str): field2 + + Keyword Args: + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + None: """ kwargs['_return_http_data_only'] = True - return self.test_json_form_data_with_http_info(param, param2, **kwargs) # noqa: E501 + if kwargs.get('async_req'): + return self.test_json_form_data_with_http_info(param, param2, **kwargs) # noqa: E501 + else: + (data) = self.test_json_form_data_with_http_info(param, param2, **kwargs) # noqa: E501 + return data def test_json_form_data_with_http_info(self, param, param2, **kwargs): # noqa: E501 """test json serialization of form data # noqa: E501 @@ -1500,21 +1830,21 @@ class FakeApi(object): >>> thread = api.test_json_form_data_with_http_info(param, param2, async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param str param: field1 (required) - :param str param2: field2 (required) - :param _return_http_data_only: response data without head status code - and headers - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: None - If the method is called asynchronously, - returns the request thread. + Args: + param (str): field1 param2 (str): field2 + + Keyword Args: + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + None: """ local_var_params = locals() diff --git a/samples/client/petstore/python-experimental/petstore_api/api/fake_classname_tags_123_api.py b/samples/client/petstore/python-experimental/petstore_api/api/fake_classname_tags_123_api.py index 3e778e92268..f054a0a8ec7 100644 --- a/samples/client/petstore/python-experimental/petstore_api/api/fake_classname_tags_123_api.py +++ b/samples/client/petstore/python-experimental/petstore_api/api/fake_classname_tags_123_api.py @@ -18,7 +18,7 @@ import re # noqa: F401 import six from petstore_api.api_client import ApiClient -from petstore_api.exceptions import ( +from petstore_api.exceptions import ( # noqa: F401 ApiTypeError, ApiValueError ) @@ -45,21 +45,28 @@ class FakeClassnameTags123Api(object): >>> thread = api.test_classname(body, async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param Client body: client model (required) - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Client - If the method is called asynchronously, - returns the request thread. + Args: + body (Client): client model + + Keyword Args: + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + Client: """ kwargs['_return_http_data_only'] = True - return self.test_classname_with_http_info(body, **kwargs) # noqa: E501 + if kwargs.get('async_req'): + return self.test_classname_with_http_info(body, **kwargs) # noqa: E501 + else: + (data) = self.test_classname_with_http_info(body, **kwargs) # noqa: E501 + return data def test_classname_with_http_info(self, body, **kwargs): # noqa: E501 """To test class name in snake case # noqa: E501 @@ -70,20 +77,21 @@ class FakeClassnameTags123Api(object): >>> thread = api.test_classname_with_http_info(body, async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param Client body: client model (required) - :param _return_http_data_only: response data without head status code - and headers - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: tuple(Client, status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, - returns the request thread. + Args: + body (Client): client model + + Keyword Args: + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + Client: """ local_var_params = locals() diff --git a/samples/client/petstore/python-experimental/petstore_api/api/pet_api.py b/samples/client/petstore/python-experimental/petstore_api/api/pet_api.py index 1deb664c43e..bd1b58aa9ee 100644 --- a/samples/client/petstore/python-experimental/petstore_api/api/pet_api.py +++ b/samples/client/petstore/python-experimental/petstore_api/api/pet_api.py @@ -18,7 +18,7 @@ import re # noqa: F401 import six from petstore_api.api_client import ApiClient -from petstore_api.exceptions import ( +from petstore_api.exceptions import ( # noqa: F401 ApiTypeError, ApiValueError ) @@ -44,21 +44,28 @@ class PetApi(object): >>> thread = api.add_pet(body, async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param Pet body: Pet object that needs to be added to the store (required) - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: None - If the method is called asynchronously, - returns the request thread. + Args: + body (Pet): Pet object that needs to be added to the store + + Keyword Args: + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + None: """ kwargs['_return_http_data_only'] = True - return self.add_pet_with_http_info(body, **kwargs) # noqa: E501 + if kwargs.get('async_req'): + return self.add_pet_with_http_info(body, **kwargs) # noqa: E501 + else: + (data) = self.add_pet_with_http_info(body, **kwargs) # noqa: E501 + return data def add_pet_with_http_info(self, body, **kwargs): # noqa: E501 """Add a new pet to the store # noqa: E501 @@ -68,20 +75,21 @@ class PetApi(object): >>> thread = api.add_pet_with_http_info(body, async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param Pet body: Pet object that needs to be added to the store (required) - :param _return_http_data_only: response data without head status code - and headers - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: None - If the method is called asynchronously, - returns the request thread. + Args: + body (Pet): Pet object that needs to be added to the store + + Keyword Args: + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + None: """ local_var_params = locals() @@ -150,22 +158,29 @@ class PetApi(object): >>> thread = api.delete_pet(pet_id, async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param int pet_id: Pet id to delete (required) - :param str api_key: - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: None - If the method is called asynchronously, - returns the request thread. + Args: + pet_id (int): Pet id to delete + + Keyword Args: + api_key (str): [optional] + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + None: """ kwargs['_return_http_data_only'] = True - return self.delete_pet_with_http_info(pet_id, **kwargs) # noqa: E501 + if kwargs.get('async_req'): + return self.delete_pet_with_http_info(pet_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_pet_with_http_info(pet_id, **kwargs) # noqa: E501 + return data def delete_pet_with_http_info(self, pet_id, **kwargs): # noqa: E501 """Deletes a pet # noqa: E501 @@ -175,21 +190,22 @@ class PetApi(object): >>> thread = api.delete_pet_with_http_info(pet_id, async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param int pet_id: Pet id to delete (required) - :param str api_key: - :param _return_http_data_only: response data without head status code - and headers - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: None - If the method is called asynchronously, - returns the request thread. + Args: + pet_id (int): Pet id to delete + + Keyword Args: + api_key (str): [optional] + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + None: """ local_var_params = locals() @@ -257,21 +273,28 @@ class PetApi(object): >>> thread = api.find_pets_by_status(status, async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param list[str] status: Status values that need to be considered for filter (required) - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: list[Pet] - If the method is called asynchronously, - returns the request thread. + Args: + status (list[str]): Status values that need to be considered for filter + + Keyword Args: + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + list[Pet]: """ kwargs['_return_http_data_only'] = True - return self.find_pets_by_status_with_http_info(status, **kwargs) # noqa: E501 + if kwargs.get('async_req'): + return self.find_pets_by_status_with_http_info(status, **kwargs) # noqa: E501 + else: + (data) = self.find_pets_by_status_with_http_info(status, **kwargs) # noqa: E501 + return data def find_pets_by_status_with_http_info(self, status, **kwargs): # noqa: E501 """Finds Pets by status # noqa: E501 @@ -282,20 +305,21 @@ class PetApi(object): >>> thread = api.find_pets_by_status_with_http_info(status, async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param list[str] status: Status values that need to be considered for filter (required) - :param _return_http_data_only: response data without head status code - and headers - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: tuple(list[Pet], status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, - returns the request thread. + Args: + status (list[str]): Status values that need to be considered for filter + + Keyword Args: + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + list[Pet]: """ local_var_params = locals() @@ -318,6 +342,14 @@ class PetApi(object): if ('status' not in local_var_params or local_var_params['status'] is None): raise ApiValueError("Missing the required parameter `status` when calling `find_pets_by_status`") # noqa: E501 + allowed_values = ["available", "pending", "sold"] # noqa: E501 + if ('status' in local_var_params and + not set(local_var_params['status']).issubset(set(allowed_values))): # noqa: E501 + raise ValueError( + "Invalid values for `status` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(local_var_params['status']) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) collection_formats = {} @@ -366,21 +398,28 @@ class PetApi(object): >>> thread = api.find_pets_by_tags(tags, async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param list[str] tags: Tags to filter by (required) - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: list[Pet] - If the method is called asynchronously, - returns the request thread. + Args: + tags (list[str]): Tags to filter by + + Keyword Args: + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + list[Pet]: """ kwargs['_return_http_data_only'] = True - return self.find_pets_by_tags_with_http_info(tags, **kwargs) # noqa: E501 + if kwargs.get('async_req'): + return self.find_pets_by_tags_with_http_info(tags, **kwargs) # noqa: E501 + else: + (data) = self.find_pets_by_tags_with_http_info(tags, **kwargs) # noqa: E501 + return data def find_pets_by_tags_with_http_info(self, tags, **kwargs): # noqa: E501 """Finds Pets by tags # noqa: E501 @@ -391,20 +430,21 @@ class PetApi(object): >>> thread = api.find_pets_by_tags_with_http_info(tags, async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param list[str] tags: Tags to filter by (required) - :param _return_http_data_only: response data without head status code - and headers - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: tuple(list[Pet], status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, - returns the request thread. + Args: + tags (list[str]): Tags to filter by + + Keyword Args: + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + list[Pet]: """ local_var_params = locals() @@ -475,21 +515,28 @@ class PetApi(object): >>> thread = api.get_pet_by_id(pet_id, async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param int pet_id: ID of pet to return (required) - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Pet - If the method is called asynchronously, - returns the request thread. + Args: + pet_id (int): ID of pet to return + + Keyword Args: + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + Pet: """ kwargs['_return_http_data_only'] = True - return self.get_pet_by_id_with_http_info(pet_id, **kwargs) # noqa: E501 + if kwargs.get('async_req'): + return self.get_pet_by_id_with_http_info(pet_id, **kwargs) # noqa: E501 + else: + (data) = self.get_pet_by_id_with_http_info(pet_id, **kwargs) # noqa: E501 + return data def get_pet_by_id_with_http_info(self, pet_id, **kwargs): # noqa: E501 """Find pet by ID # noqa: E501 @@ -500,20 +547,21 @@ class PetApi(object): >>> thread = api.get_pet_by_id_with_http_info(pet_id, async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param int pet_id: ID of pet to return (required) - :param _return_http_data_only: response data without head status code - and headers - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: tuple(Pet, status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, - returns the request thread. + Args: + pet_id (int): ID of pet to return + + Keyword Args: + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + Pet: """ local_var_params = locals() @@ -582,21 +630,28 @@ class PetApi(object): >>> thread = api.update_pet(body, async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param Pet body: Pet object that needs to be added to the store (required) - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: None - If the method is called asynchronously, - returns the request thread. + Args: + body (Pet): Pet object that needs to be added to the store + + Keyword Args: + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + None: """ kwargs['_return_http_data_only'] = True - return self.update_pet_with_http_info(body, **kwargs) # noqa: E501 + if kwargs.get('async_req'): + return self.update_pet_with_http_info(body, **kwargs) # noqa: E501 + else: + (data) = self.update_pet_with_http_info(body, **kwargs) # noqa: E501 + return data def update_pet_with_http_info(self, body, **kwargs): # noqa: E501 """Update an existing pet # noqa: E501 @@ -606,20 +661,21 @@ class PetApi(object): >>> thread = api.update_pet_with_http_info(body, async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param Pet body: Pet object that needs to be added to the store (required) - :param _return_http_data_only: response data without head status code - and headers - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: None - If the method is called asynchronously, - returns the request thread. + Args: + body (Pet): Pet object that needs to be added to the store + + Keyword Args: + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + None: """ local_var_params = locals() @@ -688,23 +744,30 @@ class PetApi(object): >>> thread = api.update_pet_with_form(pet_id, async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param int pet_id: ID of pet that needs to be updated (required) - :param str name: Updated name of the pet - :param str status: Updated status of the pet - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: None - If the method is called asynchronously, - returns the request thread. + Args: + pet_id (int): ID of pet that needs to be updated + + Keyword Args: + name (str): Updated name of the pet. [optional] + status (str): Updated status of the pet. [optional] + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + None: """ kwargs['_return_http_data_only'] = True - return self.update_pet_with_form_with_http_info(pet_id, **kwargs) # noqa: E501 + if kwargs.get('async_req'): + return self.update_pet_with_form_with_http_info(pet_id, **kwargs) # noqa: E501 + else: + (data) = self.update_pet_with_form_with_http_info(pet_id, **kwargs) # noqa: E501 + return data def update_pet_with_form_with_http_info(self, pet_id, **kwargs): # noqa: E501 """Updates a pet in the store with form data # noqa: E501 @@ -714,22 +777,23 @@ class PetApi(object): >>> thread = api.update_pet_with_form_with_http_info(pet_id, async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param int pet_id: ID of pet that needs to be updated (required) - :param str name: Updated name of the pet - :param str status: Updated status of the pet - :param _return_http_data_only: response data without head status code - and headers - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: None - If the method is called asynchronously, - returns the request thread. + Args: + pet_id (int): ID of pet that needs to be updated + + Keyword Args: + name (str): Updated name of the pet. [optional] + status (str): Updated status of the pet. [optional] + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + None: """ local_var_params = locals() @@ -802,23 +866,30 @@ class PetApi(object): >>> thread = api.upload_file(pet_id, async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param int pet_id: ID of pet to update (required) - :param str additional_metadata: Additional data to pass to server - :param file file: file to upload - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: ApiResponse - If the method is called asynchronously, - returns the request thread. + Args: + pet_id (int): ID of pet to update + + Keyword Args: + additional_metadata (str): Additional data to pass to server. [optional] + file (file): file to upload. [optional] + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + ApiResponse: """ kwargs['_return_http_data_only'] = True - return self.upload_file_with_http_info(pet_id, **kwargs) # noqa: E501 + if kwargs.get('async_req'): + return self.upload_file_with_http_info(pet_id, **kwargs) # noqa: E501 + else: + (data) = self.upload_file_with_http_info(pet_id, **kwargs) # noqa: E501 + return data def upload_file_with_http_info(self, pet_id, **kwargs): # noqa: E501 """uploads an image # noqa: E501 @@ -828,22 +899,23 @@ class PetApi(object): >>> thread = api.upload_file_with_http_info(pet_id, async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param int pet_id: ID of pet to update (required) - :param str additional_metadata: Additional data to pass to server - :param file file: file to upload - :param _return_http_data_only: response data without head status code - and headers - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: tuple(ApiResponse, status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, - returns the request thread. + Args: + pet_id (int): ID of pet to update + + Keyword Args: + additional_metadata (str): Additional data to pass to server. [optional] + file (file): file to upload. [optional] + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + ApiResponse: """ local_var_params = locals() @@ -920,23 +992,29 @@ class PetApi(object): >>> thread = api.upload_file_with_required_file(pet_id, required_file, async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param int pet_id: ID of pet to update (required) - :param file required_file: file to upload (required) - :param str additional_metadata: Additional data to pass to server - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: ApiResponse - If the method is called asynchronously, - returns the request thread. + Args: + pet_id (int): ID of pet to update required_file (file): file to upload + + Keyword Args: + additional_metadata (str): Additional data to pass to server. [optional] + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + ApiResponse: """ kwargs['_return_http_data_only'] = True - return self.upload_file_with_required_file_with_http_info(pet_id, required_file, **kwargs) # noqa: E501 + if kwargs.get('async_req'): + 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, required_file, **kwargs) # noqa: E501 + return data def upload_file_with_required_file_with_http_info(self, pet_id, required_file, **kwargs): # noqa: E501 """uploads an image (required) # noqa: E501 @@ -946,22 +1024,22 @@ class PetApi(object): >>> thread = api.upload_file_with_required_file_with_http_info(pet_id, required_file, async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param int pet_id: ID of pet to update (required) - :param file required_file: file to upload (required) - :param str additional_metadata: Additional data to pass to server - :param _return_http_data_only: response data without head status code - and headers - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: tuple(ApiResponse, status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, - returns the request thread. + Args: + pet_id (int): ID of pet to update required_file (file): file to upload + + Keyword Args: + additional_metadata (str): Additional data to pass to server. [optional] + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + ApiResponse: """ local_var_params = locals() diff --git a/samples/client/petstore/python-experimental/petstore_api/api/store_api.py b/samples/client/petstore/python-experimental/petstore_api/api/store_api.py index c3aa1c4a3d5..c80423baf48 100644 --- a/samples/client/petstore/python-experimental/petstore_api/api/store_api.py +++ b/samples/client/petstore/python-experimental/petstore_api/api/store_api.py @@ -18,7 +18,7 @@ import re # noqa: F401 import six from petstore_api.api_client import ApiClient -from petstore_api.exceptions import ( +from petstore_api.exceptions import ( # noqa: F401 ApiTypeError, ApiValueError ) @@ -45,21 +45,28 @@ class StoreApi(object): >>> thread = api.delete_order(order_id, async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param str order_id: ID of the order that needs to be deleted (required) - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: None - If the method is called asynchronously, - returns the request thread. + Args: + order_id (str): ID of the order that needs to be deleted + + Keyword Args: + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + None: """ kwargs['_return_http_data_only'] = True - return self.delete_order_with_http_info(order_id, **kwargs) # noqa: E501 + if kwargs.get('async_req'): + return self.delete_order_with_http_info(order_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_order_with_http_info(order_id, **kwargs) # noqa: E501 + return data def delete_order_with_http_info(self, order_id, **kwargs): # noqa: E501 """Delete purchase order by ID # noqa: E501 @@ -70,20 +77,21 @@ class StoreApi(object): >>> thread = api.delete_order_with_http_info(order_id, async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param str order_id: ID of the order that needs to be deleted (required) - :param _return_http_data_only: response data without head status code - and headers - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: None - If the method is called asynchronously, - returns the request thread. + Args: + order_id (str): ID of the order that needs to be deleted + + Keyword Args: + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + None: """ local_var_params = locals() @@ -149,20 +157,27 @@ class StoreApi(object): >>> thread = api.get_inventory(async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: dict(str, int) - If the method is called asynchronously, - returns the request thread. + + + Keyword Args: + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + dict(str, int): """ kwargs['_return_http_data_only'] = True - return self.get_inventory_with_http_info(**kwargs) # noqa: E501 + if kwargs.get('async_req'): + return self.get_inventory_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_inventory_with_http_info(**kwargs) # noqa: E501 + return data def get_inventory_with_http_info(self, **kwargs): # noqa: E501 """Returns pet inventories by status # noqa: E501 @@ -173,19 +188,20 @@ class StoreApi(object): >>> thread = api.get_inventory_with_http_info(async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param _return_http_data_only: response data without head status code - and headers - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: tuple(dict(str, int), status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, - returns the request thread. + + + Keyword Args: + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + dict(str, int): """ local_var_params = locals() @@ -249,21 +265,28 @@ class StoreApi(object): >>> thread = api.get_order_by_id(order_id, async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param int order_id: ID of pet that needs to be fetched (required) - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Order - If the method is called asynchronously, - returns the request thread. + Args: + order_id (int): ID of pet that needs to be fetched + + Keyword Args: + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + Order: """ kwargs['_return_http_data_only'] = True - return self.get_order_by_id_with_http_info(order_id, **kwargs) # noqa: E501 + if kwargs.get('async_req'): + return self.get_order_by_id_with_http_info(order_id, **kwargs) # noqa: E501 + else: + (data) = self.get_order_by_id_with_http_info(order_id, **kwargs) # noqa: E501 + return data def get_order_by_id_with_http_info(self, order_id, **kwargs): # noqa: E501 """Find purchase order by ID # noqa: E501 @@ -274,20 +297,21 @@ class StoreApi(object): >>> thread = api.get_order_by_id_with_http_info(order_id, async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param int order_id: ID of pet that needs to be fetched (required) - :param _return_http_data_only: response data without head status code - and headers - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: tuple(Order, status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, - returns the request thread. + Args: + order_id (int): ID of pet that needs to be fetched + + Keyword Args: + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + Order: """ local_var_params = locals() @@ -310,11 +334,11 @@ class StoreApi(object): if ('order_id' not in local_var_params or local_var_params['order_id'] is None): raise ApiValueError("Missing the required parameter `order_id` when calling `get_order_by_id`") # noqa: E501 - if 'order_id' in local_var_params and local_var_params['order_id'] > 5: # noqa: E501 raise ApiValueError("Invalid value for parameter `order_id` when calling `get_order_by_id`, must be a value less than or equal to `5`") # noqa: E501 if 'order_id' in local_var_params and local_var_params['order_id'] < 1: # noqa: E501 raise ApiValueError("Invalid value for parameter `order_id` when calling `get_order_by_id`, must be a value greater than or equal to `1`") # noqa: E501 + collection_formats = {} path_params = {} @@ -360,21 +384,28 @@ class StoreApi(object): >>> thread = api.place_order(body, async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param Order body: order placed for purchasing the pet (required) - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Order - If the method is called asynchronously, - returns the request thread. + Args: + body (Order): order placed for purchasing the pet + + Keyword Args: + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + Order: """ kwargs['_return_http_data_only'] = True - return self.place_order_with_http_info(body, **kwargs) # noqa: E501 + if kwargs.get('async_req'): + return self.place_order_with_http_info(body, **kwargs) # noqa: E501 + else: + (data) = self.place_order_with_http_info(body, **kwargs) # noqa: E501 + return data def place_order_with_http_info(self, body, **kwargs): # noqa: E501 """Place an order for a pet # noqa: E501 @@ -384,20 +415,21 @@ class StoreApi(object): >>> thread = api.place_order_with_http_info(body, async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param Order body: order placed for purchasing the pet (required) - :param _return_http_data_only: response data without head status code - and headers - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: tuple(Order, status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, - returns the request thread. + Args: + body (Order): order placed for purchasing the pet + + Keyword Args: + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + Order: """ local_var_params = locals() diff --git a/samples/client/petstore/python-experimental/petstore_api/api/user_api.py b/samples/client/petstore/python-experimental/petstore_api/api/user_api.py index d3674f5ba5c..c8de4c6c277 100644 --- a/samples/client/petstore/python-experimental/petstore_api/api/user_api.py +++ b/samples/client/petstore/python-experimental/petstore_api/api/user_api.py @@ -18,7 +18,7 @@ import re # noqa: F401 import six from petstore_api.api_client import ApiClient -from petstore_api.exceptions import ( +from petstore_api.exceptions import ( # noqa: F401 ApiTypeError, ApiValueError ) @@ -45,21 +45,28 @@ class UserApi(object): >>> thread = api.create_user(body, async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param User body: Created user object (required) - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: None - If the method is called asynchronously, - returns the request thread. + Args: + body (User): Created user object + + Keyword Args: + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + None: """ kwargs['_return_http_data_only'] = True - return self.create_user_with_http_info(body, **kwargs) # noqa: E501 + if kwargs.get('async_req'): + return self.create_user_with_http_info(body, **kwargs) # noqa: E501 + else: + (data) = self.create_user_with_http_info(body, **kwargs) # noqa: E501 + return data def create_user_with_http_info(self, body, **kwargs): # noqa: E501 """Create user # noqa: E501 @@ -70,20 +77,21 @@ class UserApi(object): >>> thread = api.create_user_with_http_info(body, async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param User body: Created user object (required) - :param _return_http_data_only: response data without head status code - and headers - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: None - If the method is called asynchronously, - returns the request thread. + Args: + body (User): Created user object + + Keyword Args: + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + None: """ local_var_params = locals() @@ -148,21 +156,28 @@ class UserApi(object): >>> thread = api.create_users_with_array_input(body, async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param list[User] body: List of user object (required) - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: None - If the method is called asynchronously, - returns the request thread. + Args: + body (list[User]): List of user object + + Keyword Args: + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + None: """ kwargs['_return_http_data_only'] = True - return self.create_users_with_array_input_with_http_info(body, **kwargs) # noqa: E501 + if kwargs.get('async_req'): + return self.create_users_with_array_input_with_http_info(body, **kwargs) # noqa: E501 + else: + (data) = self.create_users_with_array_input_with_http_info(body, **kwargs) # noqa: E501 + return data def create_users_with_array_input_with_http_info(self, body, **kwargs): # noqa: E501 """Creates list of users with given input array # noqa: E501 @@ -172,20 +187,21 @@ class UserApi(object): >>> thread = api.create_users_with_array_input_with_http_info(body, async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param list[User] body: List of user object (required) - :param _return_http_data_only: response data without head status code - and headers - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: None - If the method is called asynchronously, - returns the request thread. + Args: + body (list[User]): List of user object + + Keyword Args: + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + None: """ local_var_params = locals() @@ -250,21 +266,28 @@ class UserApi(object): >>> thread = api.create_users_with_list_input(body, async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param list[User] body: List of user object (required) - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: None - If the method is called asynchronously, - returns the request thread. + Args: + body (list[User]): List of user object + + Keyword Args: + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + None: """ kwargs['_return_http_data_only'] = True - return self.create_users_with_list_input_with_http_info(body, **kwargs) # noqa: E501 + if kwargs.get('async_req'): + return self.create_users_with_list_input_with_http_info(body, **kwargs) # noqa: E501 + else: + (data) = self.create_users_with_list_input_with_http_info(body, **kwargs) # noqa: E501 + return data def create_users_with_list_input_with_http_info(self, body, **kwargs): # noqa: E501 """Creates list of users with given input array # noqa: E501 @@ -274,20 +297,21 @@ class UserApi(object): >>> thread = api.create_users_with_list_input_with_http_info(body, async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param list[User] body: List of user object (required) - :param _return_http_data_only: response data without head status code - and headers - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: None - If the method is called asynchronously, - returns the request thread. + Args: + body (list[User]): List of user object + + Keyword Args: + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + None: """ local_var_params = locals() @@ -353,21 +377,28 @@ class UserApi(object): >>> thread = api.delete_user(username, async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param str username: The name that needs to be deleted (required) - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: None - If the method is called asynchronously, - returns the request thread. + Args: + username (str): The name that needs to be deleted + + Keyword Args: + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + None: """ kwargs['_return_http_data_only'] = True - return self.delete_user_with_http_info(username, **kwargs) # noqa: E501 + if kwargs.get('async_req'): + return self.delete_user_with_http_info(username, **kwargs) # noqa: E501 + else: + (data) = self.delete_user_with_http_info(username, **kwargs) # noqa: E501 + return data def delete_user_with_http_info(self, username, **kwargs): # noqa: E501 """Delete user # noqa: E501 @@ -378,20 +409,21 @@ class UserApi(object): >>> thread = api.delete_user_with_http_info(username, async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param str username: The name that needs to be deleted (required) - :param _return_http_data_only: response data without head status code - and headers - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: None - If the method is called asynchronously, - returns the request thread. + Args: + username (str): The name that needs to be deleted + + Keyword Args: + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + None: """ local_var_params = locals() @@ -456,21 +488,28 @@ class UserApi(object): >>> thread = api.get_user_by_name(username, async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param str username: The name that needs to be fetched. Use user1 for testing. (required) - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: User - If the method is called asynchronously, - returns the request thread. + Args: + username (str): The name that needs to be fetched. Use user1 for testing. + + Keyword Args: + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + User: """ kwargs['_return_http_data_only'] = True - return self.get_user_by_name_with_http_info(username, **kwargs) # noqa: E501 + if kwargs.get('async_req'): + return self.get_user_by_name_with_http_info(username, **kwargs) # noqa: E501 + else: + (data) = self.get_user_by_name_with_http_info(username, **kwargs) # noqa: E501 + return data def get_user_by_name_with_http_info(self, username, **kwargs): # noqa: E501 """Get user by user name # noqa: E501 @@ -480,20 +519,21 @@ class UserApi(object): >>> thread = api.get_user_by_name_with_http_info(username, async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param str username: The name that needs to be fetched. Use user1 for testing. (required) - :param _return_http_data_only: response data without head status code - and headers - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: tuple(User, status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, - returns the request thread. + Args: + username (str): The name that needs to be fetched. Use user1 for testing. + + Keyword Args: + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + User: """ local_var_params = locals() @@ -562,22 +602,28 @@ class UserApi(object): >>> thread = api.login_user(username, password, async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param str username: The user name for login (required) - :param str password: The password for login in clear text (required) - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: str - If the method is called asynchronously, - returns the request thread. + Args: + username (str): The user name for login password (str): The password for login in clear text + + Keyword Args: + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + str: """ kwargs['_return_http_data_only'] = True - return self.login_user_with_http_info(username, password, **kwargs) # noqa: E501 + if kwargs.get('async_req'): + return self.login_user_with_http_info(username, password, **kwargs) # noqa: E501 + else: + (data) = self.login_user_with_http_info(username, password, **kwargs) # noqa: E501 + return data def login_user_with_http_info(self, username, password, **kwargs): # noqa: E501 """Logs user into the system # noqa: E501 @@ -587,21 +633,21 @@ class UserApi(object): >>> thread = api.login_user_with_http_info(username, password, async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param str username: The user name for login (required) - :param str password: The password for login in clear text (required) - :param _return_http_data_only: response data without head status code - and headers - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: tuple(str, status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, - returns the request thread. + Args: + username (str): The user name for login password (str): The password for login in clear text + + Keyword Args: + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + str: """ local_var_params = locals() @@ -676,20 +722,27 @@ class UserApi(object): >>> thread = api.logout_user(async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: None - If the method is called asynchronously, - returns the request thread. + + + Keyword Args: + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + None: """ kwargs['_return_http_data_only'] = True - return self.logout_user_with_http_info(**kwargs) # noqa: E501 + if kwargs.get('async_req'): + return self.logout_user_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.logout_user_with_http_info(**kwargs) # noqa: E501 + return data def logout_user_with_http_info(self, **kwargs): # noqa: E501 """Logs out current logged in user session # noqa: E501 @@ -699,19 +752,20 @@ class UserApi(object): >>> thread = api.logout_user_with_http_info(async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param _return_http_data_only: response data without head status code - and headers - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: None - If the method is called asynchronously, - returns the request thread. + + + Keyword Args: + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + None: """ local_var_params = locals() @@ -771,22 +825,28 @@ class UserApi(object): >>> thread = api.update_user(username, body, async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param str username: name that need to be deleted (required) - :param User body: Updated user object (required) - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: None - If the method is called asynchronously, - returns the request thread. + Args: + username (str): name that need to be deleted body (User): Updated user object + + Keyword Args: + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + None: """ kwargs['_return_http_data_only'] = True - return self.update_user_with_http_info(username, body, **kwargs) # noqa: E501 + if kwargs.get('async_req'): + return self.update_user_with_http_info(username, body, **kwargs) # noqa: E501 + else: + (data) = self.update_user_with_http_info(username, body, **kwargs) # noqa: E501 + return data def update_user_with_http_info(self, username, body, **kwargs): # noqa: E501 """Updated user # noqa: E501 @@ -797,21 +857,21 @@ class UserApi(object): >>> thread = api.update_user_with_http_info(username, body, async_req=True) >>> result = thread.get() - :param async_req bool: execute request asynchronously - :param str username: name that need to be deleted (required) - :param User body: Updated user object (required) - :param _return_http_data_only: response data without head status code - and headers - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: None - If the method is called asynchronously, - returns the request thread. + Args: + username (str): name that need to be deleted body (User): Updated user object + + Keyword Args: + async_req (bool): execute request asynchronously + param _preload_content (bool): if False, the urllib3.HTTPResponse + object will be returned without reading/decoding response data. + Default is True. + param _request_timeout (float/tuple): timeout setting for this + request. If one number provided, it will be total request + timeout. It can also be a pair (tuple) of (connection, read) + timeouts. + + Returns: + None: """ local_var_params = locals() diff --git a/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_any_type.py b/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_any_type.py index ed4f40068bf..ec5fa2a9a28 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_any_type.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_any_type.py @@ -31,21 +31,27 @@ class AdditionalPropertiesAnyType(object): and the value is json key in definition. """ openapi_types = { - 'name': 'str' + 'name': 'str', } attribute_map = { - 'name': 'name' + 'name': 'name', # noqa: E501 } def __init__(self, name=None): # noqa: E501 - """AdditionalPropertiesAnyType - a model defined in OpenAPI""" # noqa: E501 + """AdditionalPropertiesAnyType - a model defined in OpenAPI + + + + Keyword Args: + name (str): [optional] # noqa: E501 + """ self._name = None self.discriminator = None if name is not None: - self.name = name + self.name = name # noqa: E501 @property def name(self): @@ -58,7 +64,9 @@ class AdditionalPropertiesAnyType(object): return self._name @name.setter - def name(self, name): + def name( + self, + name): """Sets the name of this AdditionalPropertiesAnyType. @@ -66,7 +74,8 @@ class AdditionalPropertiesAnyType(object): :type: str """ - self._name = name + self._name = ( + name) def to_dict(self): """Returns the model properties as a dict""" diff --git a/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_array.py b/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_array.py index 22b4133f367..e04ae6f4c04 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_array.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_array.py @@ -31,21 +31,27 @@ class AdditionalPropertiesArray(object): and the value is json key in definition. """ openapi_types = { - 'name': 'str' + 'name': 'str', } attribute_map = { - 'name': 'name' + 'name': 'name', # noqa: E501 } def __init__(self, name=None): # noqa: E501 - """AdditionalPropertiesArray - a model defined in OpenAPI""" # noqa: E501 + """AdditionalPropertiesArray - a model defined in OpenAPI + + + + Keyword Args: + name (str): [optional] # noqa: E501 + """ self._name = None self.discriminator = None if name is not None: - self.name = name + self.name = name # noqa: E501 @property def name(self): @@ -58,7 +64,9 @@ class AdditionalPropertiesArray(object): return self._name @name.setter - def name(self, name): + def name( + self, + name): """Sets the name of this AdditionalPropertiesArray. @@ -66,7 +74,8 @@ class AdditionalPropertiesArray(object): :type: str """ - self._name = name + self._name = ( + name) def to_dict(self): """Returns the model properties as a dict""" diff --git a/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_boolean.py b/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_boolean.py index 24e2fc178ab..f5e7dc23d23 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_boolean.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_boolean.py @@ -31,21 +31,27 @@ class AdditionalPropertiesBoolean(object): and the value is json key in definition. """ openapi_types = { - 'name': 'str' + 'name': 'str', } attribute_map = { - 'name': 'name' + 'name': 'name', # noqa: E501 } def __init__(self, name=None): # noqa: E501 - """AdditionalPropertiesBoolean - a model defined in OpenAPI""" # noqa: E501 + """AdditionalPropertiesBoolean - a model defined in OpenAPI + + + + Keyword Args: + name (str): [optional] # noqa: E501 + """ self._name = None self.discriminator = None if name is not None: - self.name = name + self.name = name # noqa: E501 @property def name(self): @@ -58,7 +64,9 @@ class AdditionalPropertiesBoolean(object): return self._name @name.setter - def name(self, name): + def name( + self, + name): """Sets the name of this AdditionalPropertiesBoolean. @@ -66,7 +74,8 @@ class AdditionalPropertiesBoolean(object): :type: str """ - self._name = name + self._name = ( + name) def to_dict(self): """Returns the model properties as a dict""" diff --git a/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_class.py b/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_class.py index e9e9307d1b7..d5082c17ce4 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_class.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_class.py @@ -41,25 +41,41 @@ class AdditionalPropertiesClass(object): 'map_map_anytype': 'dict(str, dict(str, object))', 'anytype_1': 'object', 'anytype_2': 'object', - 'anytype_3': 'object' + 'anytype_3': 'object', } attribute_map = { - 'map_string': 'map_string', - 'map_number': 'map_number', - 'map_integer': 'map_integer', - 'map_boolean': 'map_boolean', - 'map_array_integer': 'map_array_integer', - 'map_array_anytype': 'map_array_anytype', - 'map_map_string': 'map_map_string', - 'map_map_anytype': 'map_map_anytype', - 'anytype_1': 'anytype_1', - 'anytype_2': 'anytype_2', - 'anytype_3': 'anytype_3' + 'map_string': 'map_string', # noqa: E501 + 'map_number': 'map_number', # noqa: E501 + 'map_integer': 'map_integer', # noqa: E501 + 'map_boolean': 'map_boolean', # noqa: E501 + 'map_array_integer': 'map_array_integer', # noqa: E501 + 'map_array_anytype': 'map_array_anytype', # noqa: E501 + 'map_map_string': 'map_map_string', # noqa: E501 + 'map_map_anytype': 'map_map_anytype', # noqa: E501 + 'anytype_1': 'anytype_1', # noqa: E501 + 'anytype_2': 'anytype_2', # noqa: E501 + 'anytype_3': 'anytype_3', # noqa: E501 } def __init__(self, map_string=None, map_number=None, map_integer=None, map_boolean=None, map_array_integer=None, map_array_anytype=None, map_map_string=None, map_map_anytype=None, anytype_1=None, anytype_2=None, anytype_3=None): # noqa: E501 - """AdditionalPropertiesClass - a model defined in OpenAPI""" # noqa: E501 + """AdditionalPropertiesClass - a model defined in OpenAPI + + + + Keyword Args: + map_string (dict(str, str)): [optional] # noqa: E501 + map_number (dict(str, float)): [optional] # noqa: E501 + map_integer (dict(str, int)): [optional] # noqa: E501 + map_boolean (dict(str, bool)): [optional] # noqa: E501 + map_array_integer (dict(str, list[int])): [optional] # noqa: E501 + map_array_anytype (dict(str, list[object])): [optional] # noqa: E501 + map_map_string (dict(str, dict(str, str))): [optional] # noqa: E501 + map_map_anytype (dict(str, dict(str, object))): [optional] # noqa: E501 + anytype_1 (object): [optional] # noqa: E501 + anytype_2 (object): [optional] # noqa: E501 + anytype_3 (object): [optional] # noqa: E501 + """ self._map_string = None self._map_number = None @@ -75,27 +91,27 @@ class AdditionalPropertiesClass(object): self.discriminator = None if map_string is not None: - self.map_string = map_string + self.map_string = map_string # noqa: E501 if map_number is not None: - self.map_number = map_number + self.map_number = map_number # noqa: E501 if map_integer is not None: - self.map_integer = map_integer + self.map_integer = map_integer # noqa: E501 if map_boolean is not None: - self.map_boolean = map_boolean + self.map_boolean = map_boolean # noqa: E501 if map_array_integer is not None: - self.map_array_integer = map_array_integer + self.map_array_integer = map_array_integer # noqa: E501 if map_array_anytype is not None: - self.map_array_anytype = map_array_anytype + self.map_array_anytype = map_array_anytype # noqa: E501 if map_map_string is not None: - self.map_map_string = map_map_string + self.map_map_string = map_map_string # noqa: E501 if map_map_anytype is not None: - self.map_map_anytype = map_map_anytype + self.map_map_anytype = map_map_anytype # noqa: E501 if anytype_1 is not None: - self.anytype_1 = anytype_1 + self.anytype_1 = anytype_1 # noqa: E501 if anytype_2 is not None: - self.anytype_2 = anytype_2 + self.anytype_2 = anytype_2 # noqa: E501 if anytype_3 is not None: - self.anytype_3 = anytype_3 + self.anytype_3 = anytype_3 # noqa: E501 @property def map_string(self): @@ -108,7 +124,9 @@ class AdditionalPropertiesClass(object): return self._map_string @map_string.setter - def map_string(self, map_string): + def map_string( + self, + map_string): """Sets the map_string of this AdditionalPropertiesClass. @@ -116,7 +134,8 @@ class AdditionalPropertiesClass(object): :type: dict(str, str) """ - self._map_string = map_string + self._map_string = ( + map_string) @property def map_number(self): @@ -129,7 +148,9 @@ class AdditionalPropertiesClass(object): return self._map_number @map_number.setter - def map_number(self, map_number): + def map_number( + self, + map_number): """Sets the map_number of this AdditionalPropertiesClass. @@ -137,7 +158,8 @@ class AdditionalPropertiesClass(object): :type: dict(str, float) """ - self._map_number = map_number + self._map_number = ( + map_number) @property def map_integer(self): @@ -150,7 +172,9 @@ class AdditionalPropertiesClass(object): return self._map_integer @map_integer.setter - def map_integer(self, map_integer): + def map_integer( + self, + map_integer): """Sets the map_integer of this AdditionalPropertiesClass. @@ -158,7 +182,8 @@ class AdditionalPropertiesClass(object): :type: dict(str, int) """ - self._map_integer = map_integer + self._map_integer = ( + map_integer) @property def map_boolean(self): @@ -171,7 +196,9 @@ class AdditionalPropertiesClass(object): return self._map_boolean @map_boolean.setter - def map_boolean(self, map_boolean): + def map_boolean( + self, + map_boolean): """Sets the map_boolean of this AdditionalPropertiesClass. @@ -179,7 +206,8 @@ class AdditionalPropertiesClass(object): :type: dict(str, bool) """ - self._map_boolean = map_boolean + self._map_boolean = ( + map_boolean) @property def map_array_integer(self): @@ -192,7 +220,9 @@ class AdditionalPropertiesClass(object): return self._map_array_integer @map_array_integer.setter - def map_array_integer(self, map_array_integer): + def map_array_integer( + self, + map_array_integer): """Sets the map_array_integer of this AdditionalPropertiesClass. @@ -200,7 +230,8 @@ class AdditionalPropertiesClass(object): :type: dict(str, list[int]) """ - self._map_array_integer = map_array_integer + self._map_array_integer = ( + map_array_integer) @property def map_array_anytype(self): @@ -213,7 +244,9 @@ class AdditionalPropertiesClass(object): return self._map_array_anytype @map_array_anytype.setter - def map_array_anytype(self, map_array_anytype): + def map_array_anytype( + self, + map_array_anytype): """Sets the map_array_anytype of this AdditionalPropertiesClass. @@ -221,7 +254,8 @@ class AdditionalPropertiesClass(object): :type: dict(str, list[object]) """ - self._map_array_anytype = map_array_anytype + self._map_array_anytype = ( + map_array_anytype) @property def map_map_string(self): @@ -234,7 +268,9 @@ class AdditionalPropertiesClass(object): return self._map_map_string @map_map_string.setter - def map_map_string(self, map_map_string): + def map_map_string( + self, + map_map_string): """Sets the map_map_string of this AdditionalPropertiesClass. @@ -242,7 +278,8 @@ class AdditionalPropertiesClass(object): :type: dict(str, dict(str, str)) """ - self._map_map_string = map_map_string + self._map_map_string = ( + map_map_string) @property def map_map_anytype(self): @@ -255,7 +292,9 @@ class AdditionalPropertiesClass(object): return self._map_map_anytype @map_map_anytype.setter - def map_map_anytype(self, map_map_anytype): + def map_map_anytype( + self, + map_map_anytype): """Sets the map_map_anytype of this AdditionalPropertiesClass. @@ -263,7 +302,8 @@ class AdditionalPropertiesClass(object): :type: dict(str, dict(str, object)) """ - self._map_map_anytype = map_map_anytype + self._map_map_anytype = ( + map_map_anytype) @property def anytype_1(self): @@ -276,7 +316,9 @@ class AdditionalPropertiesClass(object): return self._anytype_1 @anytype_1.setter - def anytype_1(self, anytype_1): + def anytype_1( + self, + anytype_1): """Sets the anytype_1 of this AdditionalPropertiesClass. @@ -284,7 +326,8 @@ class AdditionalPropertiesClass(object): :type: object """ - self._anytype_1 = anytype_1 + self._anytype_1 = ( + anytype_1) @property def anytype_2(self): @@ -297,7 +340,9 @@ class AdditionalPropertiesClass(object): return self._anytype_2 @anytype_2.setter - def anytype_2(self, anytype_2): + def anytype_2( + self, + anytype_2): """Sets the anytype_2 of this AdditionalPropertiesClass. @@ -305,7 +350,8 @@ class AdditionalPropertiesClass(object): :type: object """ - self._anytype_2 = anytype_2 + self._anytype_2 = ( + anytype_2) @property def anytype_3(self): @@ -318,7 +364,9 @@ class AdditionalPropertiesClass(object): return self._anytype_3 @anytype_3.setter - def anytype_3(self, anytype_3): + def anytype_3( + self, + anytype_3): """Sets the anytype_3 of this AdditionalPropertiesClass. @@ -326,7 +374,8 @@ class AdditionalPropertiesClass(object): :type: object """ - self._anytype_3 = anytype_3 + self._anytype_3 = ( + anytype_3) def to_dict(self): """Returns the model properties as a dict""" diff --git a/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_integer.py b/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_integer.py index 43bcf425a7b..9b3715f8f26 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_integer.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_integer.py @@ -31,21 +31,27 @@ class AdditionalPropertiesInteger(object): and the value is json key in definition. """ openapi_types = { - 'name': 'str' + 'name': 'str', } attribute_map = { - 'name': 'name' + 'name': 'name', # noqa: E501 } def __init__(self, name=None): # noqa: E501 - """AdditionalPropertiesInteger - a model defined in OpenAPI""" # noqa: E501 + """AdditionalPropertiesInteger - a model defined in OpenAPI + + + + Keyword Args: + name (str): [optional] # noqa: E501 + """ self._name = None self.discriminator = None if name is not None: - self.name = name + self.name = name # noqa: E501 @property def name(self): @@ -58,7 +64,9 @@ class AdditionalPropertiesInteger(object): return self._name @name.setter - def name(self, name): + def name( + self, + name): """Sets the name of this AdditionalPropertiesInteger. @@ -66,7 +74,8 @@ class AdditionalPropertiesInteger(object): :type: str """ - self._name = name + self._name = ( + name) def to_dict(self): """Returns the model properties as a dict""" diff --git a/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_number.py b/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_number.py index b3e034035a8..1d4e26e8733 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_number.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_number.py @@ -31,21 +31,27 @@ class AdditionalPropertiesNumber(object): and the value is json key in definition. """ openapi_types = { - 'name': 'str' + 'name': 'str', } attribute_map = { - 'name': 'name' + 'name': 'name', # noqa: E501 } def __init__(self, name=None): # noqa: E501 - """AdditionalPropertiesNumber - a model defined in OpenAPI""" # noqa: E501 + """AdditionalPropertiesNumber - a model defined in OpenAPI + + + + Keyword Args: + name (str): [optional] # noqa: E501 + """ self._name = None self.discriminator = None if name is not None: - self.name = name + self.name = name # noqa: E501 @property def name(self): @@ -58,7 +64,9 @@ class AdditionalPropertiesNumber(object): return self._name @name.setter - def name(self, name): + def name( + self, + name): """Sets the name of this AdditionalPropertiesNumber. @@ -66,7 +74,8 @@ class AdditionalPropertiesNumber(object): :type: str """ - self._name = name + self._name = ( + name) def to_dict(self): """Returns the model properties as a dict""" diff --git a/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_object.py b/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_object.py index 9ab56a4e553..96b92ade018 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_object.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_object.py @@ -31,21 +31,27 @@ class AdditionalPropertiesObject(object): and the value is json key in definition. """ openapi_types = { - 'name': 'str' + 'name': 'str', } attribute_map = { - 'name': 'name' + 'name': 'name', # noqa: E501 } def __init__(self, name=None): # noqa: E501 - """AdditionalPropertiesObject - a model defined in OpenAPI""" # noqa: E501 + """AdditionalPropertiesObject - a model defined in OpenAPI + + + + Keyword Args: + name (str): [optional] # noqa: E501 + """ self._name = None self.discriminator = None if name is not None: - self.name = name + self.name = name # noqa: E501 @property def name(self): @@ -58,7 +64,9 @@ class AdditionalPropertiesObject(object): return self._name @name.setter - def name(self, name): + def name( + self, + name): """Sets the name of this AdditionalPropertiesObject. @@ -66,7 +74,8 @@ class AdditionalPropertiesObject(object): :type: str """ - self._name = name + self._name = ( + name) def to_dict(self): """Returns the model properties as a dict""" diff --git a/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_string.py b/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_string.py index 4667186bdc4..a61c1fb70e8 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_string.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_string.py @@ -31,21 +31,27 @@ class AdditionalPropertiesString(object): and the value is json key in definition. """ openapi_types = { - 'name': 'str' + 'name': 'str', } attribute_map = { - 'name': 'name' + 'name': 'name', # noqa: E501 } def __init__(self, name=None): # noqa: E501 - """AdditionalPropertiesString - a model defined in OpenAPI""" # noqa: E501 + """AdditionalPropertiesString - a model defined in OpenAPI + + + + Keyword Args: + name (str): [optional] # noqa: E501 + """ self._name = None self.discriminator = None if name is not None: - self.name = name + self.name = name # noqa: E501 @property def name(self): @@ -58,7 +64,9 @@ class AdditionalPropertiesString(object): return self._name @name.setter - def name(self, name): + def name( + self, + name): """Sets the name of this AdditionalPropertiesString. @@ -66,7 +74,8 @@ class AdditionalPropertiesString(object): :type: str """ - self._name = name + self._name = ( + name) def to_dict(self): """Returns the model properties as a dict""" diff --git a/samples/client/petstore/python-experimental/petstore_api/models/animal.py b/samples/client/petstore/python-experimental/petstore_api/models/animal.py index 552ef0e8326..d5c0162b088 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/animal.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/animal.py @@ -32,12 +32,12 @@ class Animal(object): """ openapi_types = { 'class_name': 'str', - 'color': 'str' + 'color': 'str', } attribute_map = { - 'class_name': 'className', - 'color': 'color' + 'class_name': 'className', # noqa: E501 + 'color': 'color', # noqa: E501 } discriminator_value_class_map = { @@ -45,8 +45,15 @@ class Animal(object): 'Cat': 'Cat' } - def __init__(self, class_name=None, color='red'): # noqa: E501 - """Animal - a model defined in OpenAPI""" # noqa: E501 + def __init__(self, class_name, color=None): # noqa: E501 + """Animal - a model defined in OpenAPI + + Args: + class_name (str): + + Keyword Args: # noqa: E501 + color (str): [optional] if omitted the server will use the default value of 'red' # noqa: E501 + """ self._class_name = None self._color = None @@ -54,7 +61,7 @@ class Animal(object): self.class_name = class_name if color is not None: - self.color = color + self.color = color # noqa: E501 @property def class_name(self): @@ -67,7 +74,9 @@ class Animal(object): return self._class_name @class_name.setter - def class_name(self, class_name): + def class_name( + self, + class_name): """Sets the class_name of this Animal. @@ -77,7 +86,8 @@ class Animal(object): if class_name is None: raise ValueError("Invalid value for `class_name`, must not be `None`") # noqa: E501 - self._class_name = class_name + self._class_name = ( + class_name) @property def color(self): @@ -90,7 +100,9 @@ class Animal(object): return self._color @color.setter - def color(self, color): + def color( + self, + color): """Sets the color of this Animal. @@ -98,7 +110,8 @@ class Animal(object): :type: str """ - self._color = color + self._color = ( + color) def get_real_child_model(self, data): """Returns the real base class specified by the discriminator""" diff --git a/samples/client/petstore/python-experimental/petstore_api/models/api_response.py b/samples/client/petstore/python-experimental/petstore_api/models/api_response.py index 190c3df3452..43181962714 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/api_response.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/api_response.py @@ -33,17 +33,25 @@ class ApiResponse(object): openapi_types = { 'code': 'int', 'type': 'str', - 'message': 'str' + 'message': 'str', } attribute_map = { - 'code': 'code', - 'type': 'type', - 'message': 'message' + 'code': 'code', # noqa: E501 + 'type': 'type', # noqa: E501 + 'message': 'message', # noqa: E501 } def __init__(self, code=None, type=None, message=None): # noqa: E501 - """ApiResponse - a model defined in OpenAPI""" # noqa: E501 + """ApiResponse - a model defined in OpenAPI + + + + Keyword Args: + code (int): [optional] # noqa: E501 + type (str): [optional] # noqa: E501 + message (str): [optional] # noqa: E501 + """ self._code = None self._type = None @@ -51,11 +59,11 @@ class ApiResponse(object): self.discriminator = None if code is not None: - self.code = code + self.code = code # noqa: E501 if type is not None: - self.type = type + self.type = type # noqa: E501 if message is not None: - self.message = message + self.message = message # noqa: E501 @property def code(self): @@ -68,7 +76,9 @@ class ApiResponse(object): return self._code @code.setter - def code(self, code): + def code( + self, + code): """Sets the code of this ApiResponse. @@ -76,7 +86,8 @@ class ApiResponse(object): :type: int """ - self._code = code + self._code = ( + code) @property def type(self): @@ -89,7 +100,9 @@ class ApiResponse(object): return self._type @type.setter - def type(self, type): + def type( + self, + type): """Sets the type of this ApiResponse. @@ -97,7 +110,8 @@ class ApiResponse(object): :type: str """ - self._type = type + self._type = ( + type) @property def message(self): @@ -110,7 +124,9 @@ class ApiResponse(object): return self._message @message.setter - def message(self, message): + def message( + self, + message): """Sets the message of this ApiResponse. @@ -118,7 +134,8 @@ class ApiResponse(object): :type: str """ - self._message = message + self._message = ( + message) def to_dict(self): """Returns the model properties as a dict""" diff --git a/samples/client/petstore/python-experimental/petstore_api/models/array_of_array_of_number_only.py b/samples/client/petstore/python-experimental/petstore_api/models/array_of_array_of_number_only.py index ebf96429801..d49c620abc1 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/array_of_array_of_number_only.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/array_of_array_of_number_only.py @@ -31,21 +31,27 @@ class ArrayOfArrayOfNumberOnly(object): and the value is json key in definition. """ openapi_types = { - 'array_array_number': 'list[list[float]]' + 'array_array_number': 'list[list[float]]', } attribute_map = { - 'array_array_number': 'ArrayArrayNumber' + 'array_array_number': 'ArrayArrayNumber', # noqa: E501 } def __init__(self, array_array_number=None): # noqa: E501 - """ArrayOfArrayOfNumberOnly - a model defined in OpenAPI""" # noqa: E501 + """ArrayOfArrayOfNumberOnly - a model defined in OpenAPI + + + + Keyword Args: + array_array_number (list[list[float]]): [optional] # noqa: E501 + """ self._array_array_number = None self.discriminator = None if array_array_number is not None: - self.array_array_number = array_array_number + self.array_array_number = array_array_number # noqa: E501 @property def array_array_number(self): @@ -58,7 +64,9 @@ class ArrayOfArrayOfNumberOnly(object): return self._array_array_number @array_array_number.setter - def array_array_number(self, array_array_number): + def array_array_number( + self, + array_array_number): """Sets the array_array_number of this ArrayOfArrayOfNumberOnly. @@ -66,7 +74,8 @@ class ArrayOfArrayOfNumberOnly(object): :type: list[list[float]] """ - self._array_array_number = array_array_number + self._array_array_number = ( + array_array_number) def to_dict(self): """Returns the model properties as a dict""" diff --git a/samples/client/petstore/python-experimental/petstore_api/models/array_of_number_only.py b/samples/client/petstore/python-experimental/petstore_api/models/array_of_number_only.py index 8e1837c46bd..f87d00b168a 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/array_of_number_only.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/array_of_number_only.py @@ -31,21 +31,27 @@ class ArrayOfNumberOnly(object): and the value is json key in definition. """ openapi_types = { - 'array_number': 'list[float]' + 'array_number': 'list[float]', } attribute_map = { - 'array_number': 'ArrayNumber' + 'array_number': 'ArrayNumber', # noqa: E501 } def __init__(self, array_number=None): # noqa: E501 - """ArrayOfNumberOnly - a model defined in OpenAPI""" # noqa: E501 + """ArrayOfNumberOnly - a model defined in OpenAPI + + + + Keyword Args: + array_number (list[float]): [optional] # noqa: E501 + """ self._array_number = None self.discriminator = None if array_number is not None: - self.array_number = array_number + self.array_number = array_number # noqa: E501 @property def array_number(self): @@ -58,7 +64,9 @@ class ArrayOfNumberOnly(object): return self._array_number @array_number.setter - def array_number(self, array_number): + def array_number( + self, + array_number): """Sets the array_number of this ArrayOfNumberOnly. @@ -66,7 +74,8 @@ class ArrayOfNumberOnly(object): :type: list[float] """ - self._array_number = array_number + self._array_number = ( + array_number) def to_dict(self): """Returns the model properties as a dict""" diff --git a/samples/client/petstore/python-experimental/petstore_api/models/array_test.py b/samples/client/petstore/python-experimental/petstore_api/models/array_test.py index f548fef3ee8..5098375a2f0 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/array_test.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/array_test.py @@ -33,17 +33,25 @@ class ArrayTest(object): openapi_types = { 'array_of_string': 'list[str]', 'array_array_of_integer': 'list[list[int]]', - 'array_array_of_model': 'list[list[ReadOnlyFirst]]' + 'array_array_of_model': 'list[list[ReadOnlyFirst]]', } attribute_map = { - 'array_of_string': 'array_of_string', - 'array_array_of_integer': 'array_array_of_integer', - 'array_array_of_model': 'array_array_of_model' + 'array_of_string': 'array_of_string', # noqa: E501 + 'array_array_of_integer': 'array_array_of_integer', # noqa: E501 + 'array_array_of_model': 'array_array_of_model', # noqa: E501 } def __init__(self, array_of_string=None, array_array_of_integer=None, array_array_of_model=None): # noqa: E501 - """ArrayTest - a model defined in OpenAPI""" # noqa: E501 + """ArrayTest - a model defined in OpenAPI + + + + Keyword Args: + array_of_string (list[str]): [optional] # noqa: E501 + array_array_of_integer (list[list[int]]): [optional] # noqa: E501 + array_array_of_model (list[list[ReadOnlyFirst]]): [optional] # noqa: E501 + """ self._array_of_string = None self._array_array_of_integer = None @@ -51,11 +59,11 @@ class ArrayTest(object): self.discriminator = None if array_of_string is not None: - self.array_of_string = array_of_string + self.array_of_string = array_of_string # noqa: E501 if array_array_of_integer is not None: - self.array_array_of_integer = array_array_of_integer + self.array_array_of_integer = array_array_of_integer # noqa: E501 if array_array_of_model is not None: - self.array_array_of_model = array_array_of_model + self.array_array_of_model = array_array_of_model # noqa: E501 @property def array_of_string(self): @@ -68,7 +76,9 @@ class ArrayTest(object): return self._array_of_string @array_of_string.setter - def array_of_string(self, array_of_string): + def array_of_string( + self, + array_of_string): """Sets the array_of_string of this ArrayTest. @@ -76,7 +86,8 @@ class ArrayTest(object): :type: list[str] """ - self._array_of_string = array_of_string + self._array_of_string = ( + array_of_string) @property def array_array_of_integer(self): @@ -89,7 +100,9 @@ class ArrayTest(object): return self._array_array_of_integer @array_array_of_integer.setter - def array_array_of_integer(self, array_array_of_integer): + def array_array_of_integer( + self, + array_array_of_integer): """Sets the array_array_of_integer of this ArrayTest. @@ -97,7 +110,8 @@ class ArrayTest(object): :type: list[list[int]] """ - self._array_array_of_integer = array_array_of_integer + self._array_array_of_integer = ( + array_array_of_integer) @property def array_array_of_model(self): @@ -110,7 +124,9 @@ class ArrayTest(object): return self._array_array_of_model @array_array_of_model.setter - def array_array_of_model(self, array_array_of_model): + def array_array_of_model( + self, + array_array_of_model): """Sets the array_array_of_model of this ArrayTest. @@ -118,7 +134,8 @@ class ArrayTest(object): :type: list[list[ReadOnlyFirst]] """ - self._array_array_of_model = array_array_of_model + self._array_array_of_model = ( + array_array_of_model) def to_dict(self): """Returns the model properties as a dict""" diff --git a/samples/client/petstore/python-experimental/petstore_api/models/capitalization.py b/samples/client/petstore/python-experimental/petstore_api/models/capitalization.py index 0da6b77e84d..e94eca3e402 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/capitalization.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/capitalization.py @@ -36,20 +36,31 @@ class Capitalization(object): 'small_snake': 'str', 'capital_snake': 'str', 'sca_eth_flow_points': 'str', - 'att_name': 'str' + 'att_name': 'str', } attribute_map = { - 'small_camel': 'smallCamel', - 'capital_camel': 'CapitalCamel', - 'small_snake': 'small_Snake', - 'capital_snake': 'Capital_Snake', - 'sca_eth_flow_points': 'SCA_ETH_Flow_Points', - 'att_name': 'ATT_NAME' + 'small_camel': 'smallCamel', # noqa: E501 + 'capital_camel': 'CapitalCamel', # noqa: E501 + 'small_snake': 'small_Snake', # noqa: E501 + 'capital_snake': 'Capital_Snake', # noqa: E501 + 'sca_eth_flow_points': 'SCA_ETH_Flow_Points', # noqa: E501 + 'att_name': 'ATT_NAME', # noqa: E501 } def __init__(self, small_camel=None, capital_camel=None, small_snake=None, capital_snake=None, sca_eth_flow_points=None, att_name=None): # noqa: E501 - """Capitalization - a model defined in OpenAPI""" # noqa: E501 + """Capitalization - a model defined in OpenAPI + + + + Keyword Args: + small_camel (str): [optional] # noqa: E501 + capital_camel (str): [optional] # noqa: E501 + small_snake (str): [optional] # noqa: E501 + capital_snake (str): [optional] # noqa: E501 + sca_eth_flow_points (str): [optional] # noqa: E501 + att_name (str): Name of the pet . [optional] # noqa: E501 + """ self._small_camel = None self._capital_camel = None @@ -60,17 +71,17 @@ class Capitalization(object): self.discriminator = None if small_camel is not None: - self.small_camel = small_camel + self.small_camel = small_camel # noqa: E501 if capital_camel is not None: - self.capital_camel = capital_camel + self.capital_camel = capital_camel # noqa: E501 if small_snake is not None: - self.small_snake = small_snake + self.small_snake = small_snake # noqa: E501 if capital_snake is not None: - self.capital_snake = capital_snake + self.capital_snake = capital_snake # noqa: E501 if sca_eth_flow_points is not None: - self.sca_eth_flow_points = sca_eth_flow_points + self.sca_eth_flow_points = sca_eth_flow_points # noqa: E501 if att_name is not None: - self.att_name = att_name + self.att_name = att_name # noqa: E501 @property def small_camel(self): @@ -83,7 +94,9 @@ class Capitalization(object): return self._small_camel @small_camel.setter - def small_camel(self, small_camel): + def small_camel( + self, + small_camel): """Sets the small_camel of this Capitalization. @@ -91,7 +104,8 @@ class Capitalization(object): :type: str """ - self._small_camel = small_camel + self._small_camel = ( + small_camel) @property def capital_camel(self): @@ -104,7 +118,9 @@ class Capitalization(object): return self._capital_camel @capital_camel.setter - def capital_camel(self, capital_camel): + def capital_camel( + self, + capital_camel): """Sets the capital_camel of this Capitalization. @@ -112,7 +128,8 @@ class Capitalization(object): :type: str """ - self._capital_camel = capital_camel + self._capital_camel = ( + capital_camel) @property def small_snake(self): @@ -125,7 +142,9 @@ class Capitalization(object): return self._small_snake @small_snake.setter - def small_snake(self, small_snake): + def small_snake( + self, + small_snake): """Sets the small_snake of this Capitalization. @@ -133,7 +152,8 @@ class Capitalization(object): :type: str """ - self._small_snake = small_snake + self._small_snake = ( + small_snake) @property def capital_snake(self): @@ -146,7 +166,9 @@ class Capitalization(object): return self._capital_snake @capital_snake.setter - def capital_snake(self, capital_snake): + def capital_snake( + self, + capital_snake): """Sets the capital_snake of this Capitalization. @@ -154,7 +176,8 @@ class Capitalization(object): :type: str """ - self._capital_snake = capital_snake + self._capital_snake = ( + capital_snake) @property def sca_eth_flow_points(self): @@ -167,7 +190,9 @@ class Capitalization(object): return self._sca_eth_flow_points @sca_eth_flow_points.setter - def sca_eth_flow_points(self, sca_eth_flow_points): + def sca_eth_flow_points( + self, + sca_eth_flow_points): """Sets the sca_eth_flow_points of this Capitalization. @@ -175,7 +200,8 @@ class Capitalization(object): :type: str """ - self._sca_eth_flow_points = sca_eth_flow_points + self._sca_eth_flow_points = ( + sca_eth_flow_points) @property def att_name(self): @@ -189,7 +215,9 @@ class Capitalization(object): return self._att_name @att_name.setter - def att_name(self, att_name): + def att_name( + self, + att_name): """Sets the att_name of this Capitalization. Name of the pet # noqa: E501 @@ -198,7 +226,8 @@ class Capitalization(object): :type: str """ - self._att_name = att_name + self._att_name = ( + att_name) def to_dict(self): """Returns the model properties as a dict""" diff --git a/samples/client/petstore/python-experimental/petstore_api/models/cat.py b/samples/client/petstore/python-experimental/petstore_api/models/cat.py index 216e5123538..2a19eddd5ed 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/cat.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/cat.py @@ -31,21 +31,33 @@ class Cat(object): and the value is json key in definition. """ openapi_types = { - 'declawed': 'bool' + 'class_name': 'str', + 'declawed': 'bool', + 'color': 'str', } attribute_map = { - 'declawed': 'declawed' + 'class_name': 'className', # noqa: E501 + 'declawed': 'declawed', # noqa: E501 + 'color': 'color', # noqa: E501 } - def __init__(self, declawed=None): # noqa: E501 - """Cat - a model defined in OpenAPI""" # noqa: E501 + def __init__(self, class_name, declawed=None, color=None): # noqa: E501 + """Cat - a model defined in OpenAPI + + Args: + class_name (str): + + Keyword Args: # noqa: E501 + declawed (bool): [optional] # noqa: E501 + color (str): [optional] if omitted the server will use the default value of 'red' # noqa: E501 + """ self._declawed = None self.discriminator = None if declawed is not None: - self.declawed = declawed + self.declawed = declawed # noqa: E501 @property def declawed(self): @@ -58,7 +70,9 @@ class Cat(object): return self._declawed @declawed.setter - def declawed(self, declawed): + def declawed( + self, + declawed): """Sets the declawed of this Cat. @@ -66,7 +80,8 @@ class Cat(object): :type: bool """ - self._declawed = declawed + self._declawed = ( + declawed) def to_dict(self): """Returns the model properties as a dict""" diff --git a/samples/client/petstore/python-experimental/petstore_api/models/cat_all_of.py b/samples/client/petstore/python-experimental/petstore_api/models/cat_all_of.py index 3c90df84ec3..88260a5e3d9 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/cat_all_of.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/cat_all_of.py @@ -31,21 +31,27 @@ class CatAllOf(object): and the value is json key in definition. """ openapi_types = { - 'declawed': 'bool' + 'declawed': 'bool', } attribute_map = { - 'declawed': 'declawed' + 'declawed': 'declawed', # noqa: E501 } def __init__(self, declawed=None): # noqa: E501 - """CatAllOf - a model defined in OpenAPI""" # noqa: E501 + """CatAllOf - a model defined in OpenAPI + + + + Keyword Args: + declawed (bool): [optional] # noqa: E501 + """ self._declawed = None self.discriminator = None if declawed is not None: - self.declawed = declawed + self.declawed = declawed # noqa: E501 @property def declawed(self): @@ -58,7 +64,9 @@ class CatAllOf(object): return self._declawed @declawed.setter - def declawed(self, declawed): + def declawed( + self, + declawed): """Sets the declawed of this CatAllOf. @@ -66,7 +74,8 @@ class CatAllOf(object): :type: bool """ - self._declawed = declawed + self._declawed = ( + declawed) def to_dict(self): """Returns the model properties as a dict""" diff --git a/samples/client/petstore/python-experimental/petstore_api/models/category.py b/samples/client/petstore/python-experimental/petstore_api/models/category.py index 0e23c409e50..347ed14927e 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/category.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/category.py @@ -31,24 +31,31 @@ class Category(object): and the value is json key in definition. """ openapi_types = { + 'name': 'str', 'id': 'int', - 'name': 'str' } attribute_map = { - 'id': 'id', - 'name': 'name' + 'name': 'name', # noqa: E501 + 'id': 'id', # noqa: E501 } - def __init__(self, id=None, name='default-name'): # noqa: E501 - """Category - a model defined in OpenAPI""" # noqa: E501 + def __init__(self, name='default-name', id=None): # noqa: E501 + """Category - a model defined in OpenAPI + + Args: + + Keyword Args: + name (str): defaults to 'default-name', must be one of ['default-name'] # noqa: E501 + id (int): [optional] # noqa: E501 + """ self._id = None self._name = None self.discriminator = None if id is not None: - self.id = id + self.id = id # noqa: E501 self.name = name @property @@ -62,7 +69,9 @@ class Category(object): return self._id @id.setter - def id(self, id): + def id( + self, + id): """Sets the id of this Category. @@ -70,7 +79,8 @@ class Category(object): :type: int """ - self._id = id + self._id = ( + id) @property def name(self): @@ -83,7 +93,9 @@ class Category(object): return self._name @name.setter - def name(self, name): + def name( + self, + name): """Sets the name of this Category. @@ -93,7 +105,8 @@ class Category(object): if name is None: raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 - self._name = name + self._name = ( + name) def to_dict(self): """Returns the model properties as a dict""" diff --git a/samples/client/petstore/python-experimental/petstore_api/models/class_model.py b/samples/client/petstore/python-experimental/petstore_api/models/class_model.py index 88562beff8b..bac11b0e138 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/class_model.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/class_model.py @@ -31,21 +31,27 @@ class ClassModel(object): and the value is json key in definition. """ openapi_types = { - '_class': 'str' + '_class': 'str', } attribute_map = { - '_class': '_class' + '_class': '_class', # noqa: E501 } def __init__(self, _class=None): # noqa: E501 - """ClassModel - a model defined in OpenAPI""" # noqa: E501 + """ClassModel - a model defined in OpenAPI + + + + Keyword Args: + _class (str): [optional] # noqa: E501 + """ self.__class = None self.discriminator = None if _class is not None: - self._class = _class + self._class = _class # noqa: E501 @property def _class(self): @@ -58,7 +64,9 @@ class ClassModel(object): return self.__class @_class.setter - def _class(self, _class): + def _class( + self, + _class): """Sets the _class of this ClassModel. @@ -66,7 +74,8 @@ class ClassModel(object): :type: str """ - self.__class = _class + self.__class = ( + _class) def to_dict(self): """Returns the model properties as a dict""" diff --git a/samples/client/petstore/python-experimental/petstore_api/models/client.py b/samples/client/petstore/python-experimental/petstore_api/models/client.py index b7083fd9bd7..4cde17963c5 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/client.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/client.py @@ -31,21 +31,27 @@ class Client(object): and the value is json key in definition. """ openapi_types = { - 'client': 'str' + 'client': 'str', } attribute_map = { - 'client': 'client' + 'client': 'client', # noqa: E501 } def __init__(self, client=None): # noqa: E501 - """Client - a model defined in OpenAPI""" # noqa: E501 + """Client - a model defined in OpenAPI + + + + Keyword Args: + client (str): [optional] # noqa: E501 + """ self._client = None self.discriminator = None if client is not None: - self.client = client + self.client = client # noqa: E501 @property def client(self): @@ -58,7 +64,9 @@ class Client(object): return self._client @client.setter - def client(self, client): + def client( + self, + client): """Sets the client of this Client. @@ -66,7 +74,8 @@ class Client(object): :type: str """ - self._client = client + self._client = ( + client) def to_dict(self): """Returns the model properties as a dict""" diff --git a/samples/client/petstore/python-experimental/petstore_api/models/dog.py b/samples/client/petstore/python-experimental/petstore_api/models/dog.py index c325cb252c3..14c4eedcc59 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/dog.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/dog.py @@ -31,21 +31,33 @@ class Dog(object): and the value is json key in definition. """ openapi_types = { - 'breed': 'str' + 'class_name': 'str', + 'breed': 'str', + 'color': 'str', } attribute_map = { - 'breed': 'breed' + 'class_name': 'className', # noqa: E501 + 'breed': 'breed', # noqa: E501 + 'color': 'color', # noqa: E501 } - def __init__(self, breed=None): # noqa: E501 - """Dog - a model defined in OpenAPI""" # noqa: E501 + def __init__(self, class_name, breed=None, color=None): # noqa: E501 + """Dog - a model defined in OpenAPI + + Args: + class_name (str): + + Keyword Args: # noqa: E501 + breed (str): [optional] # noqa: E501 + color (str): [optional] if omitted the server will use the default value of 'red' # noqa: E501 + """ self._breed = None self.discriminator = None if breed is not None: - self.breed = breed + self.breed = breed # noqa: E501 @property def breed(self): @@ -58,7 +70,9 @@ class Dog(object): return self._breed @breed.setter - def breed(self, breed): + def breed( + self, + breed): """Sets the breed of this Dog. @@ -66,7 +80,8 @@ class Dog(object): :type: str """ - self._breed = breed + self._breed = ( + breed) def to_dict(self): """Returns the model properties as a dict""" diff --git a/samples/client/petstore/python-experimental/petstore_api/models/dog_all_of.py b/samples/client/petstore/python-experimental/petstore_api/models/dog_all_of.py index b6328b05589..7940637ce5e 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/dog_all_of.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/dog_all_of.py @@ -31,21 +31,27 @@ class DogAllOf(object): and the value is json key in definition. """ openapi_types = { - 'breed': 'str' + 'breed': 'str', } attribute_map = { - 'breed': 'breed' + 'breed': 'breed', # noqa: E501 } def __init__(self, breed=None): # noqa: E501 - """DogAllOf - a model defined in OpenAPI""" # noqa: E501 + """DogAllOf - a model defined in OpenAPI + + + + Keyword Args: + breed (str): [optional] # noqa: E501 + """ self._breed = None self.discriminator = None if breed is not None: - self.breed = breed + self.breed = breed # noqa: E501 @property def breed(self): @@ -58,7 +64,9 @@ class DogAllOf(object): return self._breed @breed.setter - def breed(self, breed): + def breed( + self, + breed): """Sets the breed of this DogAllOf. @@ -66,7 +74,8 @@ class DogAllOf(object): :type: str """ - self._breed = breed + self._breed = ( + breed) def to_dict(self): """Returns the model properties as a dict""" diff --git a/samples/client/petstore/python-experimental/petstore_api/models/enum_arrays.py b/samples/client/petstore/python-experimental/petstore_api/models/enum_arrays.py index 00aa21d04da..ad0e8c3d9b6 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/enum_arrays.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/enum_arrays.py @@ -32,25 +32,32 @@ class EnumArrays(object): """ openapi_types = { 'just_symbol': 'str', - 'array_enum': 'list[str]' + 'array_enum': 'list[str]', } attribute_map = { - 'just_symbol': 'just_symbol', - 'array_enum': 'array_enum' + 'just_symbol': 'just_symbol', # noqa: E501 + 'array_enum': 'array_enum', # noqa: E501 } def __init__(self, just_symbol=None, array_enum=None): # noqa: E501 - """EnumArrays - a model defined in OpenAPI""" # noqa: E501 + """EnumArrays - a model defined in OpenAPI + + + + Keyword Args: + just_symbol (str): [optional] # noqa: E501 + array_enum (list[str]): [optional] # noqa: E501 + """ self._just_symbol = None self._array_enum = None self.discriminator = None if just_symbol is not None: - self.just_symbol = just_symbol + self.just_symbol = just_symbol # noqa: E501 if array_enum is not None: - self.array_enum = array_enum + self.array_enum = array_enum # noqa: E501 @property def just_symbol(self): @@ -63,7 +70,9 @@ class EnumArrays(object): return self._just_symbol @just_symbol.setter - def just_symbol(self, just_symbol): + def just_symbol( + self, + just_symbol): """Sets the just_symbol of this EnumArrays. @@ -77,7 +86,8 @@ class EnumArrays(object): .format(just_symbol, allowed_values) ) - self._just_symbol = just_symbol + self._just_symbol = ( + just_symbol) @property def array_enum(self): @@ -90,7 +100,9 @@ class EnumArrays(object): return self._array_enum @array_enum.setter - def array_enum(self, array_enum): + def array_enum( + self, + array_enum): """Sets the array_enum of this EnumArrays. @@ -105,7 +117,8 @@ class EnumArrays(object): ", ".join(map(str, allowed_values))) ) - self._array_enum = array_enum + self._array_enum = ( + array_enum) def to_dict(self): """Returns the model properties as a dict""" diff --git a/samples/client/petstore/python-experimental/petstore_api/models/enum_class.py b/samples/client/petstore/python-experimental/petstore_api/models/enum_class.py index 3c1aa279755..a2f3a3e4a78 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/enum_class.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/enum_class.py @@ -44,7 +44,12 @@ class EnumClass(object): } def __init__(self): # noqa: E501 - """EnumClass - a model defined in OpenAPI""" # noqa: E501 + """EnumClass - a model defined in OpenAPI + + + + Keyword Args: + """ self.discriminator = None def to_dict(self): diff --git a/samples/client/petstore/python-experimental/petstore_api/models/enum_test.py b/samples/client/petstore/python-experimental/petstore_api/models/enum_test.py index 11e5020363e..4ea9e777f68 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/enum_test.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/enum_test.py @@ -31,23 +31,33 @@ class EnumTest(object): and the value is json key in definition. """ openapi_types = { - 'enum_string': 'str', 'enum_string_required': 'str', + 'enum_string': 'str', 'enum_integer': 'int', 'enum_number': 'float', - 'outer_enum': 'OuterEnum' + 'outer_enum': 'OuterEnum', } attribute_map = { - 'enum_string': 'enum_string', - 'enum_string_required': 'enum_string_required', - 'enum_integer': 'enum_integer', - 'enum_number': 'enum_number', - 'outer_enum': 'outerEnum' + 'enum_string_required': 'enum_string_required', # noqa: E501 + 'enum_string': 'enum_string', # noqa: E501 + 'enum_integer': 'enum_integer', # noqa: E501 + 'enum_number': 'enum_number', # noqa: E501 + 'outer_enum': 'outerEnum', # noqa: E501 } - def __init__(self, enum_string=None, enum_string_required=None, enum_integer=None, enum_number=None, outer_enum=None): # noqa: E501 - """EnumTest - a model defined in OpenAPI""" # noqa: E501 + def __init__(self, enum_string_required, enum_string=None, enum_integer=None, enum_number=None, outer_enum=None): # noqa: E501 + """EnumTest - a model defined in OpenAPI + + Args: + enum_string_required (str): + + Keyword Args: # noqa: E501 + enum_string (str): [optional] # noqa: E501 + enum_integer (int): [optional] # noqa: E501 + enum_number (float): [optional] # noqa: E501 + outer_enum (OuterEnum): [optional] # noqa: E501 + """ self._enum_string = None self._enum_string_required = None @@ -57,14 +67,14 @@ class EnumTest(object): self.discriminator = None if enum_string is not None: - self.enum_string = enum_string + self.enum_string = enum_string # noqa: E501 self.enum_string_required = enum_string_required if enum_integer is not None: - self.enum_integer = enum_integer + self.enum_integer = enum_integer # noqa: E501 if enum_number is not None: - self.enum_number = enum_number + self.enum_number = enum_number # noqa: E501 if outer_enum is not None: - self.outer_enum = outer_enum + self.outer_enum = outer_enum # noqa: E501 @property def enum_string(self): @@ -77,7 +87,9 @@ class EnumTest(object): return self._enum_string @enum_string.setter - def enum_string(self, enum_string): + def enum_string( + self, + enum_string): """Sets the enum_string of this EnumTest. @@ -91,7 +103,8 @@ class EnumTest(object): .format(enum_string, allowed_values) ) - self._enum_string = enum_string + self._enum_string = ( + enum_string) @property def enum_string_required(self): @@ -104,7 +117,9 @@ class EnumTest(object): return self._enum_string_required @enum_string_required.setter - def enum_string_required(self, enum_string_required): + def enum_string_required( + self, + enum_string_required): """Sets the enum_string_required of this EnumTest. @@ -120,7 +135,8 @@ class EnumTest(object): .format(enum_string_required, allowed_values) ) - self._enum_string_required = enum_string_required + self._enum_string_required = ( + enum_string_required) @property def enum_integer(self): @@ -133,7 +149,9 @@ class EnumTest(object): return self._enum_integer @enum_integer.setter - def enum_integer(self, enum_integer): + def enum_integer( + self, + enum_integer): """Sets the enum_integer of this EnumTest. @@ -147,7 +165,8 @@ class EnumTest(object): .format(enum_integer, allowed_values) ) - self._enum_integer = enum_integer + self._enum_integer = ( + enum_integer) @property def enum_number(self): @@ -160,7 +179,9 @@ class EnumTest(object): return self._enum_number @enum_number.setter - def enum_number(self, enum_number): + def enum_number( + self, + enum_number): """Sets the enum_number of this EnumTest. @@ -174,7 +195,8 @@ class EnumTest(object): .format(enum_number, allowed_values) ) - self._enum_number = enum_number + self._enum_number = ( + enum_number) @property def outer_enum(self): @@ -187,7 +209,9 @@ class EnumTest(object): return self._outer_enum @outer_enum.setter - def outer_enum(self, outer_enum): + def outer_enum( + self, + outer_enum): """Sets the outer_enum of this EnumTest. @@ -195,7 +219,8 @@ class EnumTest(object): :type: OuterEnum """ - self._outer_enum = outer_enum + self._outer_enum = ( + outer_enum) def to_dict(self): """Returns the model properties as a dict""" diff --git a/samples/client/petstore/python-experimental/petstore_api/models/file.py b/samples/client/petstore/python-experimental/petstore_api/models/file.py index 475f86b799f..70e1611a237 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/file.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/file.py @@ -31,21 +31,27 @@ class File(object): and the value is json key in definition. """ openapi_types = { - 'source_uri': 'str' + 'source_uri': 'str', } attribute_map = { - 'source_uri': 'sourceURI' + 'source_uri': 'sourceURI', # noqa: E501 } def __init__(self, source_uri=None): # noqa: E501 - """File - a model defined in OpenAPI""" # noqa: E501 + """File - a model defined in OpenAPI + + + + Keyword Args: + source_uri (str): Test capitalization. [optional] # noqa: E501 + """ self._source_uri = None self.discriminator = None if source_uri is not None: - self.source_uri = source_uri + self.source_uri = source_uri # noqa: E501 @property def source_uri(self): @@ -59,7 +65,9 @@ class File(object): return self._source_uri @source_uri.setter - def source_uri(self, source_uri): + def source_uri( + self, + source_uri): """Sets the source_uri of this File. Test capitalization # noqa: E501 @@ -68,7 +76,8 @@ class File(object): :type: str """ - self._source_uri = source_uri + self._source_uri = ( + source_uri) def to_dict(self): """Returns the model properties as a dict""" diff --git a/samples/client/petstore/python-experimental/petstore_api/models/file_schema_test_class.py b/samples/client/petstore/python-experimental/petstore_api/models/file_schema_test_class.py index 9f3b5bdc179..86e926ca153 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/file_schema_test_class.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/file_schema_test_class.py @@ -32,25 +32,32 @@ class FileSchemaTestClass(object): """ openapi_types = { 'file': 'File', - 'files': 'list[File]' + 'files': 'list[File]', } attribute_map = { - 'file': 'file', - 'files': 'files' + 'file': 'file', # noqa: E501 + 'files': 'files', # noqa: E501 } def __init__(self, file=None, files=None): # noqa: E501 - """FileSchemaTestClass - a model defined in OpenAPI""" # noqa: E501 + """FileSchemaTestClass - a model defined in OpenAPI + + + + Keyword Args: + file (File): [optional] # noqa: E501 + files (list[File]): [optional] # noqa: E501 + """ self._file = None self._files = None self.discriminator = None if file is not None: - self.file = file + self.file = file # noqa: E501 if files is not None: - self.files = files + self.files = files # noqa: E501 @property def file(self): @@ -63,7 +70,9 @@ class FileSchemaTestClass(object): return self._file @file.setter - def file(self, file): + def file( + self, + file): """Sets the file of this FileSchemaTestClass. @@ -71,7 +80,8 @@ class FileSchemaTestClass(object): :type: File """ - self._file = file + self._file = ( + file) @property def files(self): @@ -84,7 +94,9 @@ class FileSchemaTestClass(object): return self._files @files.setter - def files(self, files): + def files( + self, + files): """Sets the files of this FileSchemaTestClass. @@ -92,7 +104,8 @@ class FileSchemaTestClass(object): :type: list[File] """ - self._files = files + self._files = ( + files) def to_dict(self): """Returns the model properties as a dict""" diff --git a/samples/client/petstore/python-experimental/petstore_api/models/format_test.py b/samples/client/petstore/python-experimental/petstore_api/models/format_test.py index c27d6394dbe..a7936dc37ec 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/format_test.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/format_test.py @@ -31,39 +31,57 @@ class FormatTest(object): and the value is json key in definition. """ openapi_types = { + 'number': 'float', + 'byte': 'str', + 'date': 'date', + 'password': 'str', 'integer': 'int', 'int32': 'int', 'int64': 'int', - 'number': 'float', 'float': 'float', 'double': 'float', 'string': 'str', - 'byte': 'str', 'binary': 'file', - 'date': 'date', 'date_time': 'datetime', 'uuid': 'str', - 'password': 'str' } attribute_map = { - 'integer': 'integer', - 'int32': 'int32', - 'int64': 'int64', - 'number': 'number', - 'float': 'float', - 'double': 'double', - 'string': 'string', - 'byte': 'byte', - 'binary': 'binary', - 'date': 'date', - 'date_time': 'dateTime', - 'uuid': 'uuid', - 'password': 'password' + 'number': 'number', # noqa: E501 + 'byte': 'byte', # noqa: E501 + 'date': 'date', # noqa: E501 + 'password': 'password', # noqa: E501 + 'integer': 'integer', # noqa: E501 + 'int32': 'int32', # noqa: E501 + 'int64': 'int64', # noqa: E501 + 'float': 'float', # noqa: E501 + 'double': 'double', # noqa: E501 + 'string': 'string', # noqa: E501 + 'binary': 'binary', # noqa: E501 + 'date_time': 'dateTime', # noqa: E501 + 'uuid': 'uuid', # noqa: E501 } - def __init__(self, integer=None, int32=None, int64=None, number=None, float=None, double=None, string=None, byte=None, binary=None, date=None, date_time=None, uuid=None, password=None): # noqa: E501 - """FormatTest - a model defined in OpenAPI""" # noqa: E501 + def __init__(self, number, byte, date, password, integer=None, int32=None, int64=None, float=None, double=None, string=None, binary=None, date_time=None, uuid=None): # noqa: E501 + """FormatTest - a model defined in OpenAPI + + Args: + number (float): + byte (str): + date (date): + password (str): + + Keyword Args: # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 + integer (int): [optional] # noqa: E501 + int32 (int): [optional] # noqa: E501 + int64 (int): [optional] # noqa: E501 + float (float): [optional] # noqa: E501 + double (float): [optional] # noqa: E501 + string (str): [optional] # noqa: E501 + binary (file): [optional] # noqa: E501 + date_time (datetime): [optional] # noqa: E501 + uuid (str): [optional] # noqa: E501 + """ self._integer = None self._int32 = None @@ -81,26 +99,26 @@ class FormatTest(object): self.discriminator = None if integer is not None: - self.integer = integer + self.integer = integer # noqa: E501 if int32 is not None: - self.int32 = int32 + self.int32 = int32 # noqa: E501 if int64 is not None: - self.int64 = int64 + self.int64 = int64 # noqa: E501 self.number = number if float is not None: - self.float = float + self.float = float # noqa: E501 if double is not None: - self.double = double + self.double = double # noqa: E501 if string is not None: - self.string = string + self.string = string # noqa: E501 self.byte = byte if binary is not None: - self.binary = binary + self.binary = binary # noqa: E501 self.date = date if date_time is not None: - self.date_time = date_time + self.date_time = date_time # noqa: E501 if uuid is not None: - self.uuid = uuid + self.uuid = uuid # noqa: E501 self.password = password @property @@ -114,7 +132,9 @@ class FormatTest(object): return self._integer @integer.setter - def integer(self, integer): + def integer( + self, + integer): """Sets the integer of this FormatTest. @@ -126,7 +146,8 @@ class FormatTest(object): if integer is not None and integer < 10: # noqa: E501 raise ValueError("Invalid value for `integer`, must be a value greater than or equal to `10`") # noqa: E501 - self._integer = integer + self._integer = ( + integer) @property def int32(self): @@ -139,7 +160,9 @@ class FormatTest(object): return self._int32 @int32.setter - def int32(self, int32): + def int32( + self, + int32): """Sets the int32 of this FormatTest. @@ -151,7 +174,8 @@ class FormatTest(object): if int32 is not None and int32 < 20: # noqa: E501 raise ValueError("Invalid value for `int32`, must be a value greater than or equal to `20`") # noqa: E501 - self._int32 = int32 + self._int32 = ( + int32) @property def int64(self): @@ -164,7 +188,9 @@ class FormatTest(object): return self._int64 @int64.setter - def int64(self, int64): + def int64( + self, + int64): """Sets the int64 of this FormatTest. @@ -172,7 +198,8 @@ class FormatTest(object): :type: int """ - self._int64 = int64 + self._int64 = ( + int64) @property def number(self): @@ -185,7 +212,9 @@ class FormatTest(object): return self._number @number.setter - def number(self, number): + def number( + self, + number): """Sets the number of this FormatTest. @@ -199,7 +228,8 @@ class FormatTest(object): if number is not None and number < 32.1: # noqa: E501 raise ValueError("Invalid value for `number`, must be a value greater than or equal to `32.1`") # noqa: E501 - self._number = number + self._number = ( + number) @property def float(self): @@ -212,7 +242,9 @@ class FormatTest(object): return self._float @float.setter - def float(self, float): + def float( + self, + float): """Sets the float of this FormatTest. @@ -224,7 +256,8 @@ class FormatTest(object): if float is not None and float < 54.3: # noqa: E501 raise ValueError("Invalid value for `float`, must be a value greater than or equal to `54.3`") # noqa: E501 - self._float = float + self._float = ( + float) @property def double(self): @@ -237,7 +270,9 @@ class FormatTest(object): return self._double @double.setter - def double(self, double): + def double( + self, + double): """Sets the double of this FormatTest. @@ -249,7 +284,8 @@ class FormatTest(object): if double is not None and double < 67.8: # noqa: E501 raise ValueError("Invalid value for `double`, must be a value greater than or equal to `67.8`") # noqa: E501 - self._double = double + self._double = ( + double) @property def string(self): @@ -262,7 +298,9 @@ class FormatTest(object): return self._string @string.setter - def string(self, string): + def string( + self, + string): """Sets the string of this FormatTest. @@ -272,7 +310,8 @@ class FormatTest(object): if string is not None and not re.search(r'[a-z]', string, flags=re.IGNORECASE): # noqa: E501 raise ValueError(r"Invalid value for `string`, must be a follow pattern or equal to `/[a-z]/i`") # noqa: E501 - self._string = string + self._string = ( + string) @property def byte(self): @@ -285,7 +324,9 @@ class FormatTest(object): return self._byte @byte.setter - def byte(self, byte): + def byte( + self, + byte): """Sets the byte of this FormatTest. @@ -297,7 +338,8 @@ class FormatTest(object): if byte is not None and not re.search(r'^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$', byte): # noqa: E501 raise ValueError(r"Invalid value for `byte`, must be a follow pattern or equal to `/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/`") # noqa: E501 - self._byte = byte + self._byte = ( + byte) @property def binary(self): @@ -310,7 +352,9 @@ class FormatTest(object): return self._binary @binary.setter - def binary(self, binary): + def binary( + self, + binary): """Sets the binary of this FormatTest. @@ -318,7 +362,8 @@ class FormatTest(object): :type: file """ - self._binary = binary + self._binary = ( + binary) @property def date(self): @@ -331,7 +376,9 @@ class FormatTest(object): return self._date @date.setter - def date(self, date): + def date( + self, + date): """Sets the date of this FormatTest. @@ -341,7 +388,8 @@ class FormatTest(object): if date is None: raise ValueError("Invalid value for `date`, must not be `None`") # noqa: E501 - self._date = date + self._date = ( + date) @property def date_time(self): @@ -354,7 +402,9 @@ class FormatTest(object): return self._date_time @date_time.setter - def date_time(self, date_time): + def date_time( + self, + date_time): """Sets the date_time of this FormatTest. @@ -362,7 +412,8 @@ class FormatTest(object): :type: datetime """ - self._date_time = date_time + self._date_time = ( + date_time) @property def uuid(self): @@ -375,7 +426,9 @@ class FormatTest(object): return self._uuid @uuid.setter - def uuid(self, uuid): + def uuid( + self, + uuid): """Sets the uuid of this FormatTest. @@ -383,7 +436,8 @@ class FormatTest(object): :type: str """ - self._uuid = uuid + self._uuid = ( + uuid) @property def password(self): @@ -396,7 +450,9 @@ class FormatTest(object): return self._password @password.setter - def password(self, password): + def password( + self, + password): """Sets the password of this FormatTest. @@ -410,7 +466,8 @@ class FormatTest(object): if password is not None and len(password) < 10: raise ValueError("Invalid value for `password`, length must be greater than or equal to `10`") # noqa: E501 - self._password = password + self._password = ( + password) def to_dict(self): """Returns the model properties as a dict""" diff --git a/samples/client/petstore/python-experimental/petstore_api/models/has_only_read_only.py b/samples/client/petstore/python-experimental/petstore_api/models/has_only_read_only.py index 7c8d921a2d8..8744de38344 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/has_only_read_only.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/has_only_read_only.py @@ -32,25 +32,32 @@ class HasOnlyReadOnly(object): """ openapi_types = { 'bar': 'str', - 'foo': 'str' + 'foo': 'str', } attribute_map = { - 'bar': 'bar', - 'foo': 'foo' + 'bar': 'bar', # noqa: E501 + 'foo': 'foo', # noqa: E501 } def __init__(self, bar=None, foo=None): # noqa: E501 - """HasOnlyReadOnly - a model defined in OpenAPI""" # noqa: E501 + """HasOnlyReadOnly - a model defined in OpenAPI + + + + Keyword Args: + bar (str): [optional] # noqa: E501 + foo (str): [optional] # noqa: E501 + """ self._bar = None self._foo = None self.discriminator = None if bar is not None: - self.bar = bar + self.bar = bar # noqa: E501 if foo is not None: - self.foo = foo + self.foo = foo # noqa: E501 @property def bar(self): @@ -63,7 +70,9 @@ class HasOnlyReadOnly(object): return self._bar @bar.setter - def bar(self, bar): + def bar( + self, + bar): """Sets the bar of this HasOnlyReadOnly. @@ -71,7 +80,8 @@ class HasOnlyReadOnly(object): :type: str """ - self._bar = bar + self._bar = ( + bar) @property def foo(self): @@ -84,7 +94,9 @@ class HasOnlyReadOnly(object): return self._foo @foo.setter - def foo(self, foo): + def foo( + self, + foo): """Sets the foo of this HasOnlyReadOnly. @@ -92,7 +104,8 @@ class HasOnlyReadOnly(object): :type: str """ - self._foo = foo + self._foo = ( + foo) def to_dict(self): """Returns the model properties as a dict""" diff --git a/samples/client/petstore/python-experimental/petstore_api/models/list.py b/samples/client/petstore/python-experimental/petstore_api/models/list.py index 74fc3719aa0..14b9a656175 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/list.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/list.py @@ -31,21 +31,27 @@ class List(object): and the value is json key in definition. """ openapi_types = { - '_123_list': 'str' + '_123_list': 'str', } attribute_map = { - '_123_list': '123-list' + '_123_list': '123-list', # noqa: E501 } def __init__(self, _123_list=None): # noqa: E501 - """List - a model defined in OpenAPI""" # noqa: E501 + """List - a model defined in OpenAPI + + + + Keyword Args: + _123_list (str): [optional] # noqa: E501 + """ self.__123_list = None self.discriminator = None if _123_list is not None: - self._123_list = _123_list + self._123_list = _123_list # noqa: E501 @property def _123_list(self): @@ -58,7 +64,9 @@ class List(object): return self.__123_list @_123_list.setter - def _123_list(self, _123_list): + def _123_list( + self, + _123_list): """Sets the _123_list of this List. @@ -66,7 +74,8 @@ class List(object): :type: str """ - self.__123_list = _123_list + self.__123_list = ( + _123_list) def to_dict(self): """Returns the model properties as a dict""" diff --git a/samples/client/petstore/python-experimental/petstore_api/models/map_test.py b/samples/client/petstore/python-experimental/petstore_api/models/map_test.py index cdfb9365297..d6d975f16e6 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/map_test.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/map_test.py @@ -34,18 +34,27 @@ class MapTest(object): 'map_map_of_string': 'dict(str, dict(str, str))', 'map_of_enum_string': 'dict(str, str)', 'direct_map': 'dict(str, bool)', - 'indirect_map': 'dict(str, bool)' + 'indirect_map': 'dict(str, bool)', } attribute_map = { - 'map_map_of_string': 'map_map_of_string', - 'map_of_enum_string': 'map_of_enum_string', - 'direct_map': 'direct_map', - 'indirect_map': 'indirect_map' + 'map_map_of_string': 'map_map_of_string', # noqa: E501 + 'map_of_enum_string': 'map_of_enum_string', # noqa: E501 + 'direct_map': 'direct_map', # noqa: E501 + 'indirect_map': 'indirect_map', # 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 + """MapTest - a model defined in OpenAPI + + + + Keyword Args: + map_map_of_string (dict(str, dict(str, str))): [optional] # noqa: E501 + map_of_enum_string (dict(str, str)): [optional] # noqa: E501 + direct_map (dict(str, bool)): [optional] # noqa: E501 + indirect_map (dict(str, bool)): [optional] # noqa: E501 + """ self._map_map_of_string = None self._map_of_enum_string = None @@ -54,13 +63,13 @@ class MapTest(object): self.discriminator = None if map_map_of_string is not None: - self.map_map_of_string = map_map_of_string + self.map_map_of_string = map_map_of_string # noqa: E501 if map_of_enum_string is not None: - self.map_of_enum_string = map_of_enum_string + self.map_of_enum_string = map_of_enum_string # noqa: E501 if direct_map is not None: - self.direct_map = direct_map + self.direct_map = direct_map # noqa: E501 if indirect_map is not None: - self.indirect_map = indirect_map + self.indirect_map = indirect_map # noqa: E501 @property def map_map_of_string(self): @@ -73,7 +82,9 @@ class MapTest(object): return self._map_map_of_string @map_map_of_string.setter - def map_map_of_string(self, map_map_of_string): + def map_map_of_string( + self, + map_map_of_string): """Sets the map_map_of_string of this MapTest. @@ -81,7 +92,8 @@ class MapTest(object): :type: dict(str, dict(str, str)) """ - self._map_map_of_string = map_map_of_string + self._map_map_of_string = ( + map_map_of_string) @property def map_of_enum_string(self): @@ -94,7 +106,9 @@ class MapTest(object): return self._map_of_enum_string @map_of_enum_string.setter - def map_of_enum_string(self, map_of_enum_string): + def map_of_enum_string( + self, + map_of_enum_string): """Sets the map_of_enum_string of this MapTest. @@ -109,7 +123,8 @@ class MapTest(object): ", ".join(map(str, allowed_values))) ) - self._map_of_enum_string = map_of_enum_string + self._map_of_enum_string = ( + map_of_enum_string) @property def direct_map(self): @@ -122,7 +137,9 @@ class MapTest(object): return self._direct_map @direct_map.setter - def direct_map(self, direct_map): + def direct_map( + self, + direct_map): """Sets the direct_map of this MapTest. @@ -130,7 +147,8 @@ class MapTest(object): :type: dict(str, bool) """ - self._direct_map = direct_map + self._direct_map = ( + direct_map) @property def indirect_map(self): @@ -143,7 +161,9 @@ class MapTest(object): return self._indirect_map @indirect_map.setter - def indirect_map(self, indirect_map): + def indirect_map( + self, + indirect_map): """Sets the indirect_map of this MapTest. @@ -151,7 +171,8 @@ class MapTest(object): :type: dict(str, bool) """ - self._indirect_map = indirect_map + self._indirect_map = ( + indirect_map) def to_dict(self): """Returns the model properties as a dict""" diff --git a/samples/client/petstore/python-experimental/petstore_api/models/mixed_properties_and_additional_properties_class.py b/samples/client/petstore/python-experimental/petstore_api/models/mixed_properties_and_additional_properties_class.py index 41a916eac10..ac8d5626fbf 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/mixed_properties_and_additional_properties_class.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/mixed_properties_and_additional_properties_class.py @@ -33,17 +33,25 @@ class MixedPropertiesAndAdditionalPropertiesClass(object): openapi_types = { 'uuid': 'str', 'date_time': 'datetime', - 'map': 'dict(str, Animal)' + 'map': 'dict(str, Animal)', } attribute_map = { - 'uuid': 'uuid', - 'date_time': 'dateTime', - 'map': 'map' + 'uuid': 'uuid', # noqa: E501 + 'date_time': 'dateTime', # noqa: E501 + 'map': 'map', # noqa: E501 } def __init__(self, uuid=None, date_time=None, map=None): # noqa: E501 - """MixedPropertiesAndAdditionalPropertiesClass - a model defined in OpenAPI""" # noqa: E501 + """MixedPropertiesAndAdditionalPropertiesClass - a model defined in OpenAPI + + + + Keyword Args: + uuid (str): [optional] # noqa: E501 + date_time (datetime): [optional] # noqa: E501 + map (dict(str, Animal)): [optional] # noqa: E501 + """ self._uuid = None self._date_time = None @@ -51,11 +59,11 @@ class MixedPropertiesAndAdditionalPropertiesClass(object): self.discriminator = None if uuid is not None: - self.uuid = uuid + self.uuid = uuid # noqa: E501 if date_time is not None: - self.date_time = date_time + self.date_time = date_time # noqa: E501 if map is not None: - self.map = map + self.map = map # noqa: E501 @property def uuid(self): @@ -68,7 +76,9 @@ class MixedPropertiesAndAdditionalPropertiesClass(object): return self._uuid @uuid.setter - def uuid(self, uuid): + def uuid( + self, + uuid): """Sets the uuid of this MixedPropertiesAndAdditionalPropertiesClass. @@ -76,7 +86,8 @@ class MixedPropertiesAndAdditionalPropertiesClass(object): :type: str """ - self._uuid = uuid + self._uuid = ( + uuid) @property def date_time(self): @@ -89,7 +100,9 @@ class MixedPropertiesAndAdditionalPropertiesClass(object): return self._date_time @date_time.setter - def date_time(self, date_time): + def date_time( + self, + date_time): """Sets the date_time of this MixedPropertiesAndAdditionalPropertiesClass. @@ -97,7 +110,8 @@ class MixedPropertiesAndAdditionalPropertiesClass(object): :type: datetime """ - self._date_time = date_time + self._date_time = ( + date_time) @property def map(self): @@ -110,7 +124,9 @@ class MixedPropertiesAndAdditionalPropertiesClass(object): return self._map @map.setter - def map(self, map): + def map( + self, + map): """Sets the map of this MixedPropertiesAndAdditionalPropertiesClass. @@ -118,7 +134,8 @@ class MixedPropertiesAndAdditionalPropertiesClass(object): :type: dict(str, Animal) """ - self._map = map + self._map = ( + map) def to_dict(self): """Returns the model properties as a dict""" diff --git a/samples/client/petstore/python-experimental/petstore_api/models/model200_response.py b/samples/client/petstore/python-experimental/petstore_api/models/model200_response.py index 563b82b5939..cec843833ad 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/model200_response.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/model200_response.py @@ -32,25 +32,32 @@ class Model200Response(object): """ openapi_types = { 'name': 'int', - '_class': 'str' + '_class': 'str', } attribute_map = { - 'name': 'name', - '_class': 'class' + 'name': 'name', # noqa: E501 + '_class': 'class', # noqa: E501 } def __init__(self, name=None, _class=None): # noqa: E501 - """Model200Response - a model defined in OpenAPI""" # noqa: E501 + """Model200Response - a model defined in OpenAPI + + + + Keyword Args: + name (int): [optional] # noqa: E501 + _class (str): [optional] # noqa: E501 + """ self._name = None self.__class = None self.discriminator = None if name is not None: - self.name = name + self.name = name # noqa: E501 if _class is not None: - self._class = _class + self._class = _class # noqa: E501 @property def name(self): @@ -63,7 +70,9 @@ class Model200Response(object): return self._name @name.setter - def name(self, name): + def name( + self, + name): """Sets the name of this Model200Response. @@ -71,7 +80,8 @@ class Model200Response(object): :type: int """ - self._name = name + self._name = ( + name) @property def _class(self): @@ -84,7 +94,9 @@ class Model200Response(object): return self.__class @_class.setter - def _class(self, _class): + def _class( + self, + _class): """Sets the _class of this Model200Response. @@ -92,7 +104,8 @@ class Model200Response(object): :type: str """ - self.__class = _class + self.__class = ( + _class) def to_dict(self): """Returns the model properties as a dict""" diff --git a/samples/client/petstore/python-experimental/petstore_api/models/model_return.py b/samples/client/petstore/python-experimental/petstore_api/models/model_return.py index 09801201598..3c8096b7c45 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/model_return.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/model_return.py @@ -31,21 +31,27 @@ class ModelReturn(object): and the value is json key in definition. """ openapi_types = { - '_return': 'int' + '_return': 'int', } attribute_map = { - '_return': 'return' + '_return': 'return', # noqa: E501 } def __init__(self, _return=None): # noqa: E501 - """ModelReturn - a model defined in OpenAPI""" # noqa: E501 + """ModelReturn - a model defined in OpenAPI + + + + Keyword Args: + _return (int): [optional] # noqa: E501 + """ self.__return = None self.discriminator = None if _return is not None: - self._return = _return + self._return = _return # noqa: E501 @property def _return(self): @@ -58,7 +64,9 @@ class ModelReturn(object): return self.__return @_return.setter - def _return(self, _return): + def _return( + self, + _return): """Sets the _return of this ModelReturn. @@ -66,7 +74,8 @@ class ModelReturn(object): :type: int """ - self.__return = _return + self.__return = ( + _return) def to_dict(self): """Returns the model properties as a dict""" diff --git a/samples/client/petstore/python-experimental/petstore_api/models/name.py b/samples/client/petstore/python-experimental/petstore_api/models/name.py index 43014d0fb64..9d1814c670f 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/name.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/name.py @@ -34,18 +34,27 @@ class Name(object): 'name': 'int', 'snake_case': 'int', '_property': 'str', - '_123_number': 'int' + '_123_number': 'int', } attribute_map = { - 'name': 'name', - 'snake_case': 'snake_case', - '_property': 'property', - '_123_number': '123Number' + 'name': 'name', # noqa: E501 + 'snake_case': 'snake_case', # noqa: E501 + '_property': 'property', # noqa: E501 + '_123_number': '123Number', # noqa: E501 } - def __init__(self, name=None, snake_case=None, _property=None, _123_number=None): # noqa: E501 - """Name - a model defined in OpenAPI""" # noqa: E501 + def __init__(self, name, snake_case=None, _property=None, _123_number=None): # noqa: E501 + """Name - a model defined in OpenAPI + + Args: + name (int): + + Keyword Args: # noqa: E501 + snake_case (int): [optional] # noqa: E501 + _property (str): [optional] # noqa: E501 + _123_number (int): [optional] # noqa: E501 + """ self._name = None self._snake_case = None @@ -55,11 +64,11 @@ class Name(object): self.name = name if snake_case is not None: - self.snake_case = snake_case + self.snake_case = snake_case # noqa: E501 if _property is not None: - self._property = _property + self._property = _property # noqa: E501 if _123_number is not None: - self._123_number = _123_number + self._123_number = _123_number # noqa: E501 @property def name(self): @@ -72,7 +81,9 @@ class Name(object): return self._name @name.setter - def name(self, name): + def name( + self, + name): """Sets the name of this Name. @@ -82,7 +93,8 @@ class Name(object): if name is None: raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 - self._name = name + self._name = ( + name) @property def snake_case(self): @@ -95,7 +107,9 @@ class Name(object): return self._snake_case @snake_case.setter - def snake_case(self, snake_case): + def snake_case( + self, + snake_case): """Sets the snake_case of this Name. @@ -103,7 +117,8 @@ class Name(object): :type: int """ - self._snake_case = snake_case + self._snake_case = ( + snake_case) @property def _property(self): @@ -116,7 +131,9 @@ class Name(object): return self.__property @_property.setter - def _property(self, _property): + def _property( + self, + _property): """Sets the _property of this Name. @@ -124,7 +141,8 @@ class Name(object): :type: str """ - self.__property = _property + self.__property = ( + _property) @property def _123_number(self): @@ -137,7 +155,9 @@ class Name(object): return self.__123_number @_123_number.setter - def _123_number(self, _123_number): + def _123_number( + self, + _123_number): """Sets the _123_number of this Name. @@ -145,7 +165,8 @@ class Name(object): :type: int """ - self.__123_number = _123_number + self.__123_number = ( + _123_number) def to_dict(self): """Returns the model properties as a dict""" diff --git a/samples/client/petstore/python-experimental/petstore_api/models/number_only.py b/samples/client/petstore/python-experimental/petstore_api/models/number_only.py index b6f3d1c1b65..70741767c49 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/number_only.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/number_only.py @@ -31,21 +31,27 @@ class NumberOnly(object): and the value is json key in definition. """ openapi_types = { - 'just_number': 'float' + 'just_number': 'float', } attribute_map = { - 'just_number': 'JustNumber' + 'just_number': 'JustNumber', # noqa: E501 } def __init__(self, just_number=None): # noqa: E501 - """NumberOnly - a model defined in OpenAPI""" # noqa: E501 + """NumberOnly - a model defined in OpenAPI + + + + Keyword Args: + just_number (float): [optional] # noqa: E501 + """ self._just_number = None self.discriminator = None if just_number is not None: - self.just_number = just_number + self.just_number = just_number # noqa: E501 @property def just_number(self): @@ -58,7 +64,9 @@ class NumberOnly(object): return self._just_number @just_number.setter - def just_number(self, just_number): + def just_number( + self, + just_number): """Sets the just_number of this NumberOnly. @@ -66,7 +74,8 @@ class NumberOnly(object): :type: float """ - self._just_number = just_number + self._just_number = ( + just_number) def to_dict(self): """Returns the model properties as a dict""" diff --git a/samples/client/petstore/python-experimental/petstore_api/models/order.py b/samples/client/petstore/python-experimental/petstore_api/models/order.py index 8b64e3a3583..f1c8220033c 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/order.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/order.py @@ -36,20 +36,31 @@ class Order(object): 'quantity': 'int', 'ship_date': 'datetime', 'status': 'str', - 'complete': 'bool' + 'complete': 'bool', } attribute_map = { - 'id': 'id', - 'pet_id': 'petId', - 'quantity': 'quantity', - 'ship_date': 'shipDate', - 'status': 'status', - 'complete': 'complete' + 'id': 'id', # noqa: E501 + 'pet_id': 'petId', # noqa: E501 + 'quantity': 'quantity', # noqa: E501 + 'ship_date': 'shipDate', # noqa: E501 + 'status': 'status', # noqa: E501 + 'complete': 'complete', # noqa: E501 } - def __init__(self, id=None, pet_id=None, quantity=None, ship_date=None, status=None, complete=False): # noqa: E501 - """Order - a model defined in OpenAPI""" # noqa: E501 + def __init__(self, id=None, pet_id=None, quantity=None, ship_date=None, status=None, complete=None): # noqa: E501 + """Order - a model defined in OpenAPI + + + + Keyword Args: + id (int): [optional] # noqa: E501 + pet_id (int): [optional] # noqa: E501 + quantity (int): [optional] # noqa: E501 + ship_date (datetime): [optional] # noqa: E501 + status (str): Order Status. [optional] # noqa: E501 + complete (bool): [optional] if omitted the server will use the default value of False # noqa: E501 + """ self._id = None self._pet_id = None @@ -60,17 +71,17 @@ class Order(object): self.discriminator = None if id is not None: - self.id = id + self.id = id # noqa: E501 if pet_id is not None: - self.pet_id = pet_id + self.pet_id = pet_id # noqa: E501 if quantity is not None: - self.quantity = quantity + self.quantity = quantity # noqa: E501 if ship_date is not None: - self.ship_date = ship_date + self.ship_date = ship_date # noqa: E501 if status is not None: - self.status = status + self.status = status # noqa: E501 if complete is not None: - self.complete = complete + self.complete = complete # noqa: E501 @property def id(self): @@ -83,7 +94,9 @@ class Order(object): return self._id @id.setter - def id(self, id): + def id( + self, + id): """Sets the id of this Order. @@ -91,7 +104,8 @@ class Order(object): :type: int """ - self._id = id + self._id = ( + id) @property def pet_id(self): @@ -104,7 +118,9 @@ class Order(object): return self._pet_id @pet_id.setter - def pet_id(self, pet_id): + def pet_id( + self, + pet_id): """Sets the pet_id of this Order. @@ -112,7 +128,8 @@ class Order(object): :type: int """ - self._pet_id = pet_id + self._pet_id = ( + pet_id) @property def quantity(self): @@ -125,7 +142,9 @@ class Order(object): return self._quantity @quantity.setter - def quantity(self, quantity): + def quantity( + self, + quantity): """Sets the quantity of this Order. @@ -133,7 +152,8 @@ class Order(object): :type: int """ - self._quantity = quantity + self._quantity = ( + quantity) @property def ship_date(self): @@ -146,7 +166,9 @@ class Order(object): return self._ship_date @ship_date.setter - def ship_date(self, ship_date): + def ship_date( + self, + ship_date): """Sets the ship_date of this Order. @@ -154,7 +176,8 @@ class Order(object): :type: datetime """ - self._ship_date = ship_date + self._ship_date = ( + ship_date) @property def status(self): @@ -168,7 +191,9 @@ class Order(object): return self._status @status.setter - def status(self, status): + def status( + self, + status): """Sets the status of this Order. Order Status # noqa: E501 @@ -183,7 +208,8 @@ class Order(object): .format(status, allowed_values) ) - self._status = status + self._status = ( + status) @property def complete(self): @@ -196,7 +222,9 @@ class Order(object): return self._complete @complete.setter - def complete(self, complete): + def complete( + self, + complete): """Sets the complete of this Order. @@ -204,7 +232,8 @@ class Order(object): :type: bool """ - self._complete = complete + self._complete = ( + complete) def to_dict(self): """Returns the model properties as a dict""" diff --git a/samples/client/petstore/python-experimental/petstore_api/models/outer_composite.py b/samples/client/petstore/python-experimental/petstore_api/models/outer_composite.py index dccd67055be..f3887c8a326 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/outer_composite.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/outer_composite.py @@ -33,17 +33,25 @@ class OuterComposite(object): openapi_types = { 'my_number': 'float', 'my_string': 'str', - 'my_boolean': 'bool' + 'my_boolean': 'bool', } attribute_map = { - 'my_number': 'my_number', - 'my_string': 'my_string', - 'my_boolean': 'my_boolean' + 'my_number': 'my_number', # noqa: E501 + 'my_string': 'my_string', # noqa: E501 + 'my_boolean': 'my_boolean', # noqa: E501 } def __init__(self, my_number=None, my_string=None, my_boolean=None): # noqa: E501 - """OuterComposite - a model defined in OpenAPI""" # noqa: E501 + """OuterComposite - a model defined in OpenAPI + + + + Keyword Args: + my_number (float): [optional] # noqa: E501 + my_string (str): [optional] # noqa: E501 + my_boolean (bool): [optional] # noqa: E501 + """ self._my_number = None self._my_string = None @@ -51,11 +59,11 @@ class OuterComposite(object): self.discriminator = None if my_number is not None: - self.my_number = my_number + self.my_number = my_number # noqa: E501 if my_string is not None: - self.my_string = my_string + self.my_string = my_string # noqa: E501 if my_boolean is not None: - self.my_boolean = my_boolean + self.my_boolean = my_boolean # noqa: E501 @property def my_number(self): @@ -68,7 +76,9 @@ class OuterComposite(object): return self._my_number @my_number.setter - def my_number(self, my_number): + def my_number( + self, + my_number): """Sets the my_number of this OuterComposite. @@ -76,7 +86,8 @@ class OuterComposite(object): :type: float """ - self._my_number = my_number + self._my_number = ( + my_number) @property def my_string(self): @@ -89,7 +100,9 @@ class OuterComposite(object): return self._my_string @my_string.setter - def my_string(self, my_string): + def my_string( + self, + my_string): """Sets the my_string of this OuterComposite. @@ -97,7 +110,8 @@ class OuterComposite(object): :type: str """ - self._my_string = my_string + self._my_string = ( + my_string) @property def my_boolean(self): @@ -110,7 +124,9 @@ class OuterComposite(object): return self._my_boolean @my_boolean.setter - def my_boolean(self, my_boolean): + def my_boolean( + self, + my_boolean): """Sets the my_boolean of this OuterComposite. @@ -118,7 +134,8 @@ class OuterComposite(object): :type: bool """ - self._my_boolean = my_boolean + self._my_boolean = ( + my_boolean) def to_dict(self): """Returns the model properties as a dict""" diff --git a/samples/client/petstore/python-experimental/petstore_api/models/outer_enum.py b/samples/client/petstore/python-experimental/petstore_api/models/outer_enum.py index a6697a0b152..d042dbe3ceb 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/outer_enum.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/outer_enum.py @@ -44,7 +44,12 @@ class OuterEnum(object): } def __init__(self): # noqa: E501 - """OuterEnum - a model defined in OpenAPI""" # noqa: E501 + """OuterEnum - a model defined in OpenAPI + + + + Keyword Args: + """ self.discriminator = None def to_dict(self): diff --git a/samples/client/petstore/python-experimental/petstore_api/models/pet.py b/samples/client/petstore/python-experimental/petstore_api/models/pet.py index 870608e17ac..a3b12d20c6c 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/pet.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/pet.py @@ -31,25 +31,36 @@ class Pet(object): and the value is json key in definition. """ openapi_types = { - 'id': 'int', - 'category': 'Category', 'name': 'str', 'photo_urls': 'list[str]', + 'id': 'int', + 'category': 'Category', 'tags': 'list[Tag]', - 'status': 'str' + 'status': 'str', } attribute_map = { - 'id': 'id', - 'category': 'category', - 'name': 'name', - 'photo_urls': 'photoUrls', - 'tags': 'tags', - 'status': 'status' + 'name': 'name', # noqa: E501 + 'photo_urls': 'photoUrls', # noqa: E501 + 'id': 'id', # noqa: E501 + 'category': 'category', # noqa: E501 + 'tags': 'tags', # noqa: E501 + 'status': 'status', # noqa: E501 } - def __init__(self, id=None, category=None, name=None, photo_urls=None, tags=None, status=None): # noqa: E501 - """Pet - a model defined in OpenAPI""" # noqa: E501 + def __init__(self, name, photo_urls, id=None, category=None, tags=None, status=None): # noqa: E501 + """Pet - a model defined in OpenAPI + + Args: + name (str): + photo_urls (list[str]): + + Keyword Args: # noqa: E501 # noqa: E501 + id (int): [optional] # noqa: E501 + category (Category): [optional] # noqa: E501 + tags (list[Tag]): [optional] # noqa: E501 + status (str): pet status in the store. [optional] # noqa: E501 + """ self._id = None self._category = None @@ -60,15 +71,15 @@ class Pet(object): self.discriminator = None if id is not None: - self.id = id + self.id = id # noqa: E501 if category is not None: - self.category = category + self.category = category # noqa: E501 self.name = name self.photo_urls = photo_urls if tags is not None: - self.tags = tags + self.tags = tags # noqa: E501 if status is not None: - self.status = status + self.status = status # noqa: E501 @property def id(self): @@ -81,7 +92,9 @@ class Pet(object): return self._id @id.setter - def id(self, id): + def id( + self, + id): """Sets the id of this Pet. @@ -89,7 +102,8 @@ class Pet(object): :type: int """ - self._id = id + self._id = ( + id) @property def category(self): @@ -102,7 +116,9 @@ class Pet(object): return self._category @category.setter - def category(self, category): + def category( + self, + category): """Sets the category of this Pet. @@ -110,7 +126,8 @@ class Pet(object): :type: Category """ - self._category = category + self._category = ( + category) @property def name(self): @@ -123,7 +140,9 @@ class Pet(object): return self._name @name.setter - def name(self, name): + def name( + self, + name): """Sets the name of this Pet. @@ -133,7 +152,8 @@ class Pet(object): if name is None: raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 - self._name = name + self._name = ( + name) @property def photo_urls(self): @@ -146,7 +166,9 @@ class Pet(object): return self._photo_urls @photo_urls.setter - def photo_urls(self, photo_urls): + def photo_urls( + self, + photo_urls): """Sets the photo_urls of this Pet. @@ -156,7 +178,8 @@ class Pet(object): if photo_urls is None: raise ValueError("Invalid value for `photo_urls`, must not be `None`") # noqa: E501 - self._photo_urls = photo_urls + self._photo_urls = ( + photo_urls) @property def tags(self): @@ -169,7 +192,9 @@ class Pet(object): return self._tags @tags.setter - def tags(self, tags): + def tags( + self, + tags): """Sets the tags of this Pet. @@ -177,7 +202,8 @@ class Pet(object): :type: list[Tag] """ - self._tags = tags + self._tags = ( + tags) @property def status(self): @@ -191,7 +217,9 @@ class Pet(object): return self._status @status.setter - def status(self, status): + def status( + self, + status): """Sets the status of this Pet. pet status in the store # noqa: E501 @@ -206,7 +234,8 @@ class Pet(object): .format(status, allowed_values) ) - self._status = status + self._status = ( + status) def to_dict(self): """Returns the model properties as a dict""" diff --git a/samples/client/petstore/python-experimental/petstore_api/models/read_only_first.py b/samples/client/petstore/python-experimental/petstore_api/models/read_only_first.py index 3dfb7c7f626..93f2be29861 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/read_only_first.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/read_only_first.py @@ -32,25 +32,32 @@ class ReadOnlyFirst(object): """ openapi_types = { 'bar': 'str', - 'baz': 'str' + 'baz': 'str', } attribute_map = { - 'bar': 'bar', - 'baz': 'baz' + 'bar': 'bar', # noqa: E501 + 'baz': 'baz', # noqa: E501 } def __init__(self, bar=None, baz=None): # noqa: E501 - """ReadOnlyFirst - a model defined in OpenAPI""" # noqa: E501 + """ReadOnlyFirst - a model defined in OpenAPI + + + + Keyword Args: + bar (str): [optional] # noqa: E501 + baz (str): [optional] # noqa: E501 + """ self._bar = None self._baz = None self.discriminator = None if bar is not None: - self.bar = bar + self.bar = bar # noqa: E501 if baz is not None: - self.baz = baz + self.baz = baz # noqa: E501 @property def bar(self): @@ -63,7 +70,9 @@ class ReadOnlyFirst(object): return self._bar @bar.setter - def bar(self, bar): + def bar( + self, + bar): """Sets the bar of this ReadOnlyFirst. @@ -71,7 +80,8 @@ class ReadOnlyFirst(object): :type: str """ - self._bar = bar + self._bar = ( + bar) @property def baz(self): @@ -84,7 +94,9 @@ class ReadOnlyFirst(object): return self._baz @baz.setter - def baz(self, baz): + def baz( + self, + baz): """Sets the baz of this ReadOnlyFirst. @@ -92,7 +104,8 @@ class ReadOnlyFirst(object): :type: str """ - self._baz = baz + self._baz = ( + baz) def to_dict(self): """Returns the model properties as a dict""" diff --git a/samples/client/petstore/python-experimental/petstore_api/models/special_model_name.py b/samples/client/petstore/python-experimental/petstore_api/models/special_model_name.py index 2fd6378fcdc..9eb9757a1d2 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/special_model_name.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/special_model_name.py @@ -31,21 +31,27 @@ class SpecialModelName(object): and the value is json key in definition. """ openapi_types = { - 'special_property_name': 'int' + 'special_property_name': 'int', } attribute_map = { - 'special_property_name': '$special[property.name]' + 'special_property_name': '$special[property.name]', # noqa: E501 } def __init__(self, special_property_name=None): # noqa: E501 - """SpecialModelName - a model defined in OpenAPI""" # noqa: E501 + """SpecialModelName - a model defined in OpenAPI + + + + Keyword Args: + special_property_name (int): [optional] # noqa: E501 + """ self._special_property_name = None self.discriminator = None if special_property_name is not None: - self.special_property_name = special_property_name + self.special_property_name = special_property_name # noqa: E501 @property def special_property_name(self): @@ -58,7 +64,9 @@ class SpecialModelName(object): return self._special_property_name @special_property_name.setter - def special_property_name(self, special_property_name): + def special_property_name( + self, + special_property_name): """Sets the special_property_name of this SpecialModelName. @@ -66,7 +74,8 @@ class SpecialModelName(object): :type: int """ - self._special_property_name = special_property_name + self._special_property_name = ( + special_property_name) def to_dict(self): """Returns the model properties as a dict""" diff --git a/samples/client/petstore/python-experimental/petstore_api/models/tag.py b/samples/client/petstore/python-experimental/petstore_api/models/tag.py index cb9c22d9f53..2fbb5adb76b 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/tag.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/tag.py @@ -32,25 +32,32 @@ class Tag(object): """ openapi_types = { 'id': 'int', - 'name': 'str' + 'name': 'str', } attribute_map = { - 'id': 'id', - 'name': 'name' + 'id': 'id', # noqa: E501 + 'name': 'name', # noqa: E501 } def __init__(self, id=None, name=None): # noqa: E501 - """Tag - a model defined in OpenAPI""" # noqa: E501 + """Tag - a model defined in OpenAPI + + + + Keyword Args: + id (int): [optional] # noqa: E501 + name (str): [optional] # noqa: E501 + """ self._id = None self._name = None self.discriminator = None if id is not None: - self.id = id + self.id = id # noqa: E501 if name is not None: - self.name = name + self.name = name # noqa: E501 @property def id(self): @@ -63,7 +70,9 @@ class Tag(object): return self._id @id.setter - def id(self, id): + def id( + self, + id): """Sets the id of this Tag. @@ -71,7 +80,8 @@ class Tag(object): :type: int """ - self._id = id + self._id = ( + id) @property def name(self): @@ -84,7 +94,9 @@ class Tag(object): return self._name @name.setter - def name(self, name): + def name( + self, + name): """Sets the name of this Tag. @@ -92,7 +104,8 @@ class Tag(object): :type: str """ - self._name = name + self._name = ( + name) def to_dict(self): """Returns the model properties as a dict""" diff --git a/samples/client/petstore/python-experimental/petstore_api/models/type_holder_default.py b/samples/client/petstore/python-experimental/petstore_api/models/type_holder_default.py index d7c207cb5f6..08d1ac6432b 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/type_holder_default.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/type_holder_default.py @@ -35,24 +35,42 @@ class TypeHolderDefault(object): 'number_item': 'float', 'integer_item': 'int', 'bool_item': 'bool', - 'array_item': 'list[int]' + 'array_item': 'list[int]', + 'date_item': 'date', + 'datetime_item': 'datetime', } attribute_map = { - 'string_item': 'string_item', - 'number_item': 'number_item', - 'integer_item': 'integer_item', - 'bool_item': 'bool_item', - 'array_item': 'array_item' + 'string_item': 'string_item', # noqa: E501 + 'number_item': 'number_item', # noqa: E501 + 'integer_item': 'integer_item', # noqa: E501 + 'bool_item': 'bool_item', # noqa: E501 + 'array_item': 'array_item', # noqa: E501 + 'date_item': 'date_item', # noqa: E501 + 'datetime_item': 'datetime_item', # noqa: E501 } - def __init__(self, string_item='what', number_item=None, integer_item=None, bool_item=True, array_item=None): # noqa: E501 - """TypeHolderDefault - a model defined in OpenAPI""" # noqa: E501 + def __init__(self, array_item, string_item='what', number_item=1.234, integer_item=-2, bool_item=True, date_item=None, datetime_item=None): # noqa: E501 + """TypeHolderDefault - a model defined in OpenAPI + + Args: + array_item (list[int]): + + Keyword Args: + string_item (str): defaults to 'what', must be one of ['what'] # noqa: E501 + number_item (float): defaults to 1.234, must be one of [1.234] # noqa: E501 + integer_item (int): defaults to -2, must be one of [-2] # noqa: E501 + bool_item (bool): defaults to True, must be one of [True] # noqa: E501 # noqa: E501 + date_item (date): [optional] # noqa: E501 + datetime_item (datetime): [optional] # noqa: E501 + """ self._string_item = None self._number_item = None self._integer_item = None self._bool_item = None + self._date_item = None + self._datetime_item = None self._array_item = None self.discriminator = None @@ -60,6 +78,10 @@ class TypeHolderDefault(object): self.number_item = number_item self.integer_item = integer_item self.bool_item = bool_item + if date_item is not None: + self.date_item = date_item # noqa: E501 + if datetime_item is not None: + self.datetime_item = datetime_item # noqa: E501 self.array_item = array_item @property @@ -73,7 +95,9 @@ class TypeHolderDefault(object): return self._string_item @string_item.setter - def string_item(self, string_item): + def string_item( + self, + string_item): """Sets the string_item of this TypeHolderDefault. @@ -83,7 +107,8 @@ class TypeHolderDefault(object): if string_item is None: raise ValueError("Invalid value for `string_item`, must not be `None`") # noqa: E501 - self._string_item = string_item + self._string_item = ( + string_item) @property def number_item(self): @@ -96,7 +121,9 @@ class TypeHolderDefault(object): return self._number_item @number_item.setter - def number_item(self, number_item): + def number_item( + self, + number_item): """Sets the number_item of this TypeHolderDefault. @@ -106,7 +133,8 @@ class TypeHolderDefault(object): if number_item is None: raise ValueError("Invalid value for `number_item`, must not be `None`") # noqa: E501 - self._number_item = number_item + self._number_item = ( + number_item) @property def integer_item(self): @@ -119,7 +147,9 @@ class TypeHolderDefault(object): return self._integer_item @integer_item.setter - def integer_item(self, integer_item): + def integer_item( + self, + integer_item): """Sets the integer_item of this TypeHolderDefault. @@ -129,7 +159,8 @@ class TypeHolderDefault(object): if integer_item is None: raise ValueError("Invalid value for `integer_item`, must not be `None`") # noqa: E501 - self._integer_item = integer_item + self._integer_item = ( + integer_item) @property def bool_item(self): @@ -142,7 +173,9 @@ class TypeHolderDefault(object): return self._bool_item @bool_item.setter - def bool_item(self, bool_item): + def bool_item( + self, + bool_item): """Sets the bool_item of this TypeHolderDefault. @@ -152,7 +185,56 @@ class TypeHolderDefault(object): if bool_item is None: raise ValueError("Invalid value for `bool_item`, must not be `None`") # noqa: E501 - self._bool_item = bool_item + self._bool_item = ( + bool_item) + + @property + def date_item(self): + """Gets the date_item of this TypeHolderDefault. # noqa: E501 + + + :return: The date_item of this TypeHolderDefault. # noqa: E501 + :rtype: date + """ + return self._date_item + + @date_item.setter + def date_item( + self, + date_item): + """Sets the date_item of this TypeHolderDefault. + + + :param date_item: The date_item of this TypeHolderDefault. # noqa: E501 + :type: date + """ + + self._date_item = ( + date_item) + + @property + def datetime_item(self): + """Gets the datetime_item of this TypeHolderDefault. # noqa: E501 + + + :return: The datetime_item of this TypeHolderDefault. # noqa: E501 + :rtype: datetime + """ + return self._datetime_item + + @datetime_item.setter + def datetime_item( + self, + datetime_item): + """Sets the datetime_item of this TypeHolderDefault. + + + :param datetime_item: The datetime_item of this TypeHolderDefault. # noqa: E501 + :type: datetime + """ + + self._datetime_item = ( + datetime_item) @property def array_item(self): @@ -165,7 +247,9 @@ class TypeHolderDefault(object): return self._array_item @array_item.setter - def array_item(self, array_item): + def array_item( + self, + array_item): """Sets the array_item of this TypeHolderDefault. @@ -175,7 +259,8 @@ class TypeHolderDefault(object): if array_item is None: raise ValueError("Invalid value for `array_item`, must not be `None`") # noqa: E501 - self._array_item = array_item + self._array_item = ( + array_item) def to_dict(self): """Returns the model properties as a dict""" diff --git a/samples/client/petstore/python-experimental/petstore_api/models/type_holder_example.py b/samples/client/petstore/python-experimental/petstore_api/models/type_holder_example.py index 8f2b5d6b7d3..96620b8b549 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/type_holder_example.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/type_holder_example.py @@ -35,19 +35,29 @@ class TypeHolderExample(object): 'number_item': 'float', 'integer_item': 'int', 'bool_item': 'bool', - 'array_item': 'list[int]' + 'array_item': 'list[int]', } attribute_map = { - 'string_item': 'string_item', - 'number_item': 'number_item', - 'integer_item': 'integer_item', - 'bool_item': 'bool_item', - 'array_item': 'array_item' + 'string_item': 'string_item', # noqa: E501 + 'number_item': 'number_item', # noqa: E501 + 'integer_item': 'integer_item', # noqa: E501 + 'bool_item': 'bool_item', # noqa: E501 + 'array_item': 'array_item', # noqa: E501 } - def __init__(self, string_item=None, number_item=None, integer_item=None, bool_item=None, array_item=None): # noqa: E501 - """TypeHolderExample - a model defined in OpenAPI""" # noqa: E501 + def __init__(self, bool_item, array_item, string_item='what', number_item=1.234, integer_item=-2): # noqa: E501 + """TypeHolderExample - a model defined in OpenAPI + + Args: + bool_item (bool): + array_item (list[int]): + + Keyword Args: + string_item (str): defaults to 'what', must be one of ['what'] # noqa: E501 + number_item (float): defaults to 1.234, must be one of [1.234] # noqa: E501 + integer_item (int): defaults to -2, must be one of [-2] # noqa: E501 # noqa: E501 # noqa: E501 + """ self._string_item = None self._number_item = None @@ -73,7 +83,9 @@ class TypeHolderExample(object): return self._string_item @string_item.setter - def string_item(self, string_item): + def string_item( + self, + string_item): """Sets the string_item of this TypeHolderExample. @@ -82,8 +94,15 @@ class TypeHolderExample(object): """ if string_item is None: raise ValueError("Invalid value for `string_item`, must not be `None`") # noqa: E501 + allowed_values = ["what"] # noqa: E501 + if string_item not in allowed_values: + raise ValueError( + "Invalid value for `string_item` ({0}), must be one of {1}" # noqa: E501 + .format(string_item, allowed_values) + ) - self._string_item = string_item + self._string_item = ( + string_item) @property def number_item(self): @@ -96,7 +115,9 @@ class TypeHolderExample(object): return self._number_item @number_item.setter - def number_item(self, number_item): + def number_item( + self, + number_item): """Sets the number_item of this TypeHolderExample. @@ -105,8 +126,15 @@ class TypeHolderExample(object): """ if number_item is None: raise ValueError("Invalid value for `number_item`, must not be `None`") # noqa: E501 + allowed_values = [1.234] # noqa: E501 + if number_item not in allowed_values: + raise ValueError( + "Invalid value for `number_item` ({0}), must be one of {1}" # noqa: E501 + .format(number_item, allowed_values) + ) - self._number_item = number_item + self._number_item = ( + number_item) @property def integer_item(self): @@ -119,7 +147,9 @@ class TypeHolderExample(object): return self._integer_item @integer_item.setter - def integer_item(self, integer_item): + def integer_item( + self, + integer_item): """Sets the integer_item of this TypeHolderExample. @@ -128,8 +158,15 @@ class TypeHolderExample(object): """ if integer_item is None: raise ValueError("Invalid value for `integer_item`, must not be `None`") # noqa: E501 + allowed_values = [-2] # noqa: E501 + if integer_item not in allowed_values: + raise ValueError( + "Invalid value for `integer_item` ({0}), must be one of {1}" # noqa: E501 + .format(integer_item, allowed_values) + ) - self._integer_item = integer_item + self._integer_item = ( + integer_item) @property def bool_item(self): @@ -142,7 +179,9 @@ class TypeHolderExample(object): return self._bool_item @bool_item.setter - def bool_item(self, bool_item): + def bool_item( + self, + bool_item): """Sets the bool_item of this TypeHolderExample. @@ -152,7 +191,8 @@ class TypeHolderExample(object): if bool_item is None: raise ValueError("Invalid value for `bool_item`, must not be `None`") # noqa: E501 - self._bool_item = bool_item + self._bool_item = ( + bool_item) @property def array_item(self): @@ -165,7 +205,9 @@ class TypeHolderExample(object): return self._array_item @array_item.setter - def array_item(self, array_item): + def array_item( + self, + array_item): """Sets the array_item of this TypeHolderExample. @@ -175,7 +217,8 @@ class TypeHolderExample(object): if array_item is None: raise ValueError("Invalid value for `array_item`, must not be `None`") # noqa: E501 - self._array_item = array_item + self._array_item = ( + array_item) def to_dict(self): """Returns the model properties as a dict""" diff --git a/samples/client/petstore/python-experimental/petstore_api/models/user.py b/samples/client/petstore/python-experimental/petstore_api/models/user.py index f46f5165dfd..382f0cc5fc5 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/user.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/user.py @@ -38,22 +38,35 @@ class User(object): 'email': 'str', 'password': 'str', 'phone': 'str', - 'user_status': 'int' + 'user_status': 'int', } attribute_map = { - 'id': 'id', - 'username': 'username', - 'first_name': 'firstName', - 'last_name': 'lastName', - 'email': 'email', - 'password': 'password', - 'phone': 'phone', - 'user_status': 'userStatus' + 'id': 'id', # noqa: E501 + 'username': 'username', # noqa: E501 + 'first_name': 'firstName', # noqa: E501 + 'last_name': 'lastName', # noqa: E501 + 'email': 'email', # noqa: E501 + 'password': 'password', # noqa: E501 + 'phone': 'phone', # noqa: E501 + 'user_status': 'userStatus', # noqa: E501 } def __init__(self, id=None, username=None, first_name=None, last_name=None, email=None, password=None, phone=None, user_status=None): # noqa: E501 - """User - a model defined in OpenAPI""" # noqa: E501 + """User - a model defined in OpenAPI + + + + Keyword Args: + id (int): [optional] # noqa: E501 + username (str): [optional] # noqa: E501 + first_name (str): [optional] # noqa: E501 + last_name (str): [optional] # noqa: E501 + email (str): [optional] # noqa: E501 + password (str): [optional] # noqa: E501 + phone (str): [optional] # noqa: E501 + user_status (int): User Status. [optional] # noqa: E501 + """ self._id = None self._username = None @@ -66,21 +79,21 @@ class User(object): self.discriminator = None if id is not None: - self.id = id + self.id = id # noqa: E501 if username is not None: - self.username = username + self.username = username # noqa: E501 if first_name is not None: - self.first_name = first_name + self.first_name = first_name # noqa: E501 if last_name is not None: - self.last_name = last_name + self.last_name = last_name # noqa: E501 if email is not None: - self.email = email + self.email = email # noqa: E501 if password is not None: - self.password = password + self.password = password # noqa: E501 if phone is not None: - self.phone = phone + self.phone = phone # noqa: E501 if user_status is not None: - self.user_status = user_status + self.user_status = user_status # noqa: E501 @property def id(self): @@ -93,7 +106,9 @@ class User(object): return self._id @id.setter - def id(self, id): + def id( + self, + id): """Sets the id of this User. @@ -101,7 +116,8 @@ class User(object): :type: int """ - self._id = id + self._id = ( + id) @property def username(self): @@ -114,7 +130,9 @@ class User(object): return self._username @username.setter - def username(self, username): + def username( + self, + username): """Sets the username of this User. @@ -122,7 +140,8 @@ class User(object): :type: str """ - self._username = username + self._username = ( + username) @property def first_name(self): @@ -135,7 +154,9 @@ class User(object): return self._first_name @first_name.setter - def first_name(self, first_name): + def first_name( + self, + first_name): """Sets the first_name of this User. @@ -143,7 +164,8 @@ class User(object): :type: str """ - self._first_name = first_name + self._first_name = ( + first_name) @property def last_name(self): @@ -156,7 +178,9 @@ class User(object): return self._last_name @last_name.setter - def last_name(self, last_name): + def last_name( + self, + last_name): """Sets the last_name of this User. @@ -164,7 +188,8 @@ class User(object): :type: str """ - self._last_name = last_name + self._last_name = ( + last_name) @property def email(self): @@ -177,7 +202,9 @@ class User(object): return self._email @email.setter - def email(self, email): + def email( + self, + email): """Sets the email of this User. @@ -185,7 +212,8 @@ class User(object): :type: str """ - self._email = email + self._email = ( + email) @property def password(self): @@ -198,7 +226,9 @@ class User(object): return self._password @password.setter - def password(self, password): + def password( + self, + password): """Sets the password of this User. @@ -206,7 +236,8 @@ class User(object): :type: str """ - self._password = password + self._password = ( + password) @property def phone(self): @@ -219,7 +250,9 @@ class User(object): return self._phone @phone.setter - def phone(self, phone): + def phone( + self, + phone): """Sets the phone of this User. @@ -227,7 +260,8 @@ class User(object): :type: str """ - self._phone = phone + self._phone = ( + phone) @property def user_status(self): @@ -241,7 +275,9 @@ class User(object): return self._user_status @user_status.setter - def user_status(self, user_status): + def user_status( + self, + user_status): """Sets the user_status of this User. User Status # noqa: E501 @@ -250,7 +286,8 @@ class User(object): :type: int """ - self._user_status = user_status + self._user_status = ( + user_status) def to_dict(self): """Returns the model properties as a dict""" diff --git a/samples/client/petstore/python-experimental/petstore_api/models/xml_item.py b/samples/client/petstore/python-experimental/petstore_api/models/xml_item.py index eaceeb5ef45..4d9c57350be 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/xml_item.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/xml_item.py @@ -59,43 +59,77 @@ class XmlItem(object): 'prefix_ns_integer': 'int', 'prefix_ns_boolean': 'bool', 'prefix_ns_array': 'list[int]', - 'prefix_ns_wrapped_array': 'list[int]' + 'prefix_ns_wrapped_array': 'list[int]', } attribute_map = { - 'attribute_string': 'attribute_string', - 'attribute_number': 'attribute_number', - 'attribute_integer': 'attribute_integer', - 'attribute_boolean': 'attribute_boolean', - 'wrapped_array': 'wrapped_array', - 'name_string': 'name_string', - 'name_number': 'name_number', - 'name_integer': 'name_integer', - 'name_boolean': 'name_boolean', - 'name_array': 'name_array', - 'name_wrapped_array': 'name_wrapped_array', - 'prefix_string': 'prefix_string', - 'prefix_number': 'prefix_number', - 'prefix_integer': 'prefix_integer', - 'prefix_boolean': 'prefix_boolean', - 'prefix_array': 'prefix_array', - 'prefix_wrapped_array': 'prefix_wrapped_array', - 'namespace_string': 'namespace_string', - 'namespace_number': 'namespace_number', - 'namespace_integer': 'namespace_integer', - 'namespace_boolean': 'namespace_boolean', - 'namespace_array': 'namespace_array', - 'namespace_wrapped_array': 'namespace_wrapped_array', - 'prefix_ns_string': 'prefix_ns_string', - 'prefix_ns_number': 'prefix_ns_number', - 'prefix_ns_integer': 'prefix_ns_integer', - 'prefix_ns_boolean': 'prefix_ns_boolean', - 'prefix_ns_array': 'prefix_ns_array', - 'prefix_ns_wrapped_array': 'prefix_ns_wrapped_array' + 'attribute_string': 'attribute_string', # noqa: E501 + 'attribute_number': 'attribute_number', # noqa: E501 + 'attribute_integer': 'attribute_integer', # noqa: E501 + 'attribute_boolean': 'attribute_boolean', # noqa: E501 + 'wrapped_array': 'wrapped_array', # noqa: E501 + 'name_string': 'name_string', # noqa: E501 + 'name_number': 'name_number', # noqa: E501 + 'name_integer': 'name_integer', # noqa: E501 + 'name_boolean': 'name_boolean', # noqa: E501 + 'name_array': 'name_array', # noqa: E501 + 'name_wrapped_array': 'name_wrapped_array', # noqa: E501 + 'prefix_string': 'prefix_string', # noqa: E501 + 'prefix_number': 'prefix_number', # noqa: E501 + 'prefix_integer': 'prefix_integer', # noqa: E501 + 'prefix_boolean': 'prefix_boolean', # noqa: E501 + 'prefix_array': 'prefix_array', # noqa: E501 + 'prefix_wrapped_array': 'prefix_wrapped_array', # noqa: E501 + 'namespace_string': 'namespace_string', # noqa: E501 + 'namespace_number': 'namespace_number', # noqa: E501 + 'namespace_integer': 'namespace_integer', # noqa: E501 + 'namespace_boolean': 'namespace_boolean', # noqa: E501 + 'namespace_array': 'namespace_array', # noqa: E501 + 'namespace_wrapped_array': 'namespace_wrapped_array', # noqa: E501 + 'prefix_ns_string': 'prefix_ns_string', # noqa: E501 + 'prefix_ns_number': 'prefix_ns_number', # noqa: E501 + 'prefix_ns_integer': 'prefix_ns_integer', # noqa: E501 + 'prefix_ns_boolean': 'prefix_ns_boolean', # noqa: E501 + 'prefix_ns_array': 'prefix_ns_array', # noqa: E501 + 'prefix_ns_wrapped_array': 'prefix_ns_wrapped_array', # noqa: E501 } def __init__(self, attribute_string=None, attribute_number=None, attribute_integer=None, attribute_boolean=None, wrapped_array=None, name_string=None, name_number=None, name_integer=None, name_boolean=None, name_array=None, name_wrapped_array=None, prefix_string=None, prefix_number=None, prefix_integer=None, prefix_boolean=None, prefix_array=None, prefix_wrapped_array=None, namespace_string=None, namespace_number=None, namespace_integer=None, namespace_boolean=None, namespace_array=None, namespace_wrapped_array=None, prefix_ns_string=None, prefix_ns_number=None, prefix_ns_integer=None, prefix_ns_boolean=None, prefix_ns_array=None, prefix_ns_wrapped_array=None): # noqa: E501 - """XmlItem - a model defined in OpenAPI""" # noqa: E501 + """XmlItem - a model defined in OpenAPI + + + + Keyword Args: + attribute_string (str): [optional] # noqa: E501 + attribute_number (float): [optional] # noqa: E501 + attribute_integer (int): [optional] # noqa: E501 + attribute_boolean (bool): [optional] # noqa: E501 + wrapped_array (list[int]): [optional] # noqa: E501 + name_string (str): [optional] # noqa: E501 + name_number (float): [optional] # noqa: E501 + name_integer (int): [optional] # noqa: E501 + name_boolean (bool): [optional] # noqa: E501 + name_array (list[int]): [optional] # noqa: E501 + name_wrapped_array (list[int]): [optional] # noqa: E501 + prefix_string (str): [optional] # noqa: E501 + prefix_number (float): [optional] # noqa: E501 + prefix_integer (int): [optional] # noqa: E501 + prefix_boolean (bool): [optional] # noqa: E501 + prefix_array (list[int]): [optional] # noqa: E501 + prefix_wrapped_array (list[int]): [optional] # noqa: E501 + namespace_string (str): [optional] # noqa: E501 + namespace_number (float): [optional] # noqa: E501 + namespace_integer (int): [optional] # noqa: E501 + namespace_boolean (bool): [optional] # noqa: E501 + namespace_array (list[int]): [optional] # noqa: E501 + namespace_wrapped_array (list[int]): [optional] # noqa: E501 + prefix_ns_string (str): [optional] # noqa: E501 + prefix_ns_number (float): [optional] # noqa: E501 + prefix_ns_integer (int): [optional] # noqa: E501 + prefix_ns_boolean (bool): [optional] # noqa: E501 + prefix_ns_array (list[int]): [optional] # noqa: E501 + prefix_ns_wrapped_array (list[int]): [optional] # noqa: E501 + """ self._attribute_string = None self._attribute_number = None @@ -129,63 +163,63 @@ class XmlItem(object): self.discriminator = None if attribute_string is not None: - self.attribute_string = attribute_string + self.attribute_string = attribute_string # noqa: E501 if attribute_number is not None: - self.attribute_number = attribute_number + self.attribute_number = attribute_number # noqa: E501 if attribute_integer is not None: - self.attribute_integer = attribute_integer + self.attribute_integer = attribute_integer # noqa: E501 if attribute_boolean is not None: - self.attribute_boolean = attribute_boolean + self.attribute_boolean = attribute_boolean # noqa: E501 if wrapped_array is not None: - self.wrapped_array = wrapped_array + self.wrapped_array = wrapped_array # noqa: E501 if name_string is not None: - self.name_string = name_string + self.name_string = name_string # noqa: E501 if name_number is not None: - self.name_number = name_number + self.name_number = name_number # noqa: E501 if name_integer is not None: - self.name_integer = name_integer + self.name_integer = name_integer # noqa: E501 if name_boolean is not None: - self.name_boolean = name_boolean + self.name_boolean = name_boolean # noqa: E501 if name_array is not None: - self.name_array = name_array + self.name_array = name_array # noqa: E501 if name_wrapped_array is not None: - self.name_wrapped_array = name_wrapped_array + self.name_wrapped_array = name_wrapped_array # noqa: E501 if prefix_string is not None: - self.prefix_string = prefix_string + self.prefix_string = prefix_string # noqa: E501 if prefix_number is not None: - self.prefix_number = prefix_number + self.prefix_number = prefix_number # noqa: E501 if prefix_integer is not None: - self.prefix_integer = prefix_integer + self.prefix_integer = prefix_integer # noqa: E501 if prefix_boolean is not None: - self.prefix_boolean = prefix_boolean + self.prefix_boolean = prefix_boolean # noqa: E501 if prefix_array is not None: - self.prefix_array = prefix_array + self.prefix_array = prefix_array # noqa: E501 if prefix_wrapped_array is not None: - self.prefix_wrapped_array = prefix_wrapped_array + self.prefix_wrapped_array = prefix_wrapped_array # noqa: E501 if namespace_string is not None: - self.namespace_string = namespace_string + self.namespace_string = namespace_string # noqa: E501 if namespace_number is not None: - self.namespace_number = namespace_number + self.namespace_number = namespace_number # noqa: E501 if namespace_integer is not None: - self.namespace_integer = namespace_integer + self.namespace_integer = namespace_integer # noqa: E501 if namespace_boolean is not None: - self.namespace_boolean = namespace_boolean + self.namespace_boolean = namespace_boolean # noqa: E501 if namespace_array is not None: - self.namespace_array = namespace_array + self.namespace_array = namespace_array # noqa: E501 if namespace_wrapped_array is not None: - self.namespace_wrapped_array = namespace_wrapped_array + self.namespace_wrapped_array = namespace_wrapped_array # noqa: E501 if prefix_ns_string is not None: - self.prefix_ns_string = prefix_ns_string + self.prefix_ns_string = prefix_ns_string # noqa: E501 if prefix_ns_number is not None: - self.prefix_ns_number = prefix_ns_number + self.prefix_ns_number = prefix_ns_number # noqa: E501 if prefix_ns_integer is not None: - self.prefix_ns_integer = prefix_ns_integer + self.prefix_ns_integer = prefix_ns_integer # noqa: E501 if prefix_ns_boolean is not None: - self.prefix_ns_boolean = prefix_ns_boolean + self.prefix_ns_boolean = prefix_ns_boolean # noqa: E501 if prefix_ns_array is not None: - self.prefix_ns_array = prefix_ns_array + self.prefix_ns_array = prefix_ns_array # noqa: E501 if prefix_ns_wrapped_array is not None: - self.prefix_ns_wrapped_array = prefix_ns_wrapped_array + self.prefix_ns_wrapped_array = prefix_ns_wrapped_array # noqa: E501 @property def attribute_string(self): @@ -198,7 +232,9 @@ class XmlItem(object): return self._attribute_string @attribute_string.setter - def attribute_string(self, attribute_string): + def attribute_string( + self, + attribute_string): """Sets the attribute_string of this XmlItem. @@ -206,7 +242,8 @@ class XmlItem(object): :type: str """ - self._attribute_string = attribute_string + self._attribute_string = ( + attribute_string) @property def attribute_number(self): @@ -219,7 +256,9 @@ class XmlItem(object): return self._attribute_number @attribute_number.setter - def attribute_number(self, attribute_number): + def attribute_number( + self, + attribute_number): """Sets the attribute_number of this XmlItem. @@ -227,7 +266,8 @@ class XmlItem(object): :type: float """ - self._attribute_number = attribute_number + self._attribute_number = ( + attribute_number) @property def attribute_integer(self): @@ -240,7 +280,9 @@ class XmlItem(object): return self._attribute_integer @attribute_integer.setter - def attribute_integer(self, attribute_integer): + def attribute_integer( + self, + attribute_integer): """Sets the attribute_integer of this XmlItem. @@ -248,7 +290,8 @@ class XmlItem(object): :type: int """ - self._attribute_integer = attribute_integer + self._attribute_integer = ( + attribute_integer) @property def attribute_boolean(self): @@ -261,7 +304,9 @@ class XmlItem(object): return self._attribute_boolean @attribute_boolean.setter - def attribute_boolean(self, attribute_boolean): + def attribute_boolean( + self, + attribute_boolean): """Sets the attribute_boolean of this XmlItem. @@ -269,7 +314,8 @@ class XmlItem(object): :type: bool """ - self._attribute_boolean = attribute_boolean + self._attribute_boolean = ( + attribute_boolean) @property def wrapped_array(self): @@ -282,7 +328,9 @@ class XmlItem(object): return self._wrapped_array @wrapped_array.setter - def wrapped_array(self, wrapped_array): + def wrapped_array( + self, + wrapped_array): """Sets the wrapped_array of this XmlItem. @@ -290,7 +338,8 @@ class XmlItem(object): :type: list[int] """ - self._wrapped_array = wrapped_array + self._wrapped_array = ( + wrapped_array) @property def name_string(self): @@ -303,7 +352,9 @@ class XmlItem(object): return self._name_string @name_string.setter - def name_string(self, name_string): + def name_string( + self, + name_string): """Sets the name_string of this XmlItem. @@ -311,7 +362,8 @@ class XmlItem(object): :type: str """ - self._name_string = name_string + self._name_string = ( + name_string) @property def name_number(self): @@ -324,7 +376,9 @@ class XmlItem(object): return self._name_number @name_number.setter - def name_number(self, name_number): + def name_number( + self, + name_number): """Sets the name_number of this XmlItem. @@ -332,7 +386,8 @@ class XmlItem(object): :type: float """ - self._name_number = name_number + self._name_number = ( + name_number) @property def name_integer(self): @@ -345,7 +400,9 @@ class XmlItem(object): return self._name_integer @name_integer.setter - def name_integer(self, name_integer): + def name_integer( + self, + name_integer): """Sets the name_integer of this XmlItem. @@ -353,7 +410,8 @@ class XmlItem(object): :type: int """ - self._name_integer = name_integer + self._name_integer = ( + name_integer) @property def name_boolean(self): @@ -366,7 +424,9 @@ class XmlItem(object): return self._name_boolean @name_boolean.setter - def name_boolean(self, name_boolean): + def name_boolean( + self, + name_boolean): """Sets the name_boolean of this XmlItem. @@ -374,7 +434,8 @@ class XmlItem(object): :type: bool """ - self._name_boolean = name_boolean + self._name_boolean = ( + name_boolean) @property def name_array(self): @@ -387,7 +448,9 @@ class XmlItem(object): return self._name_array @name_array.setter - def name_array(self, name_array): + def name_array( + self, + name_array): """Sets the name_array of this XmlItem. @@ -395,7 +458,8 @@ class XmlItem(object): :type: list[int] """ - self._name_array = name_array + self._name_array = ( + name_array) @property def name_wrapped_array(self): @@ -408,7 +472,9 @@ class XmlItem(object): return self._name_wrapped_array @name_wrapped_array.setter - def name_wrapped_array(self, name_wrapped_array): + def name_wrapped_array( + self, + name_wrapped_array): """Sets the name_wrapped_array of this XmlItem. @@ -416,7 +482,8 @@ class XmlItem(object): :type: list[int] """ - self._name_wrapped_array = name_wrapped_array + self._name_wrapped_array = ( + name_wrapped_array) @property def prefix_string(self): @@ -429,7 +496,9 @@ class XmlItem(object): return self._prefix_string @prefix_string.setter - def prefix_string(self, prefix_string): + def prefix_string( + self, + prefix_string): """Sets the prefix_string of this XmlItem. @@ -437,7 +506,8 @@ class XmlItem(object): :type: str """ - self._prefix_string = prefix_string + self._prefix_string = ( + prefix_string) @property def prefix_number(self): @@ -450,7 +520,9 @@ class XmlItem(object): return self._prefix_number @prefix_number.setter - def prefix_number(self, prefix_number): + def prefix_number( + self, + prefix_number): """Sets the prefix_number of this XmlItem. @@ -458,7 +530,8 @@ class XmlItem(object): :type: float """ - self._prefix_number = prefix_number + self._prefix_number = ( + prefix_number) @property def prefix_integer(self): @@ -471,7 +544,9 @@ class XmlItem(object): return self._prefix_integer @prefix_integer.setter - def prefix_integer(self, prefix_integer): + def prefix_integer( + self, + prefix_integer): """Sets the prefix_integer of this XmlItem. @@ -479,7 +554,8 @@ class XmlItem(object): :type: int """ - self._prefix_integer = prefix_integer + self._prefix_integer = ( + prefix_integer) @property def prefix_boolean(self): @@ -492,7 +568,9 @@ class XmlItem(object): return self._prefix_boolean @prefix_boolean.setter - def prefix_boolean(self, prefix_boolean): + def prefix_boolean( + self, + prefix_boolean): """Sets the prefix_boolean of this XmlItem. @@ -500,7 +578,8 @@ class XmlItem(object): :type: bool """ - self._prefix_boolean = prefix_boolean + self._prefix_boolean = ( + prefix_boolean) @property def prefix_array(self): @@ -513,7 +592,9 @@ class XmlItem(object): return self._prefix_array @prefix_array.setter - def prefix_array(self, prefix_array): + def prefix_array( + self, + prefix_array): """Sets the prefix_array of this XmlItem. @@ -521,7 +602,8 @@ class XmlItem(object): :type: list[int] """ - self._prefix_array = prefix_array + self._prefix_array = ( + prefix_array) @property def prefix_wrapped_array(self): @@ -534,7 +616,9 @@ class XmlItem(object): return self._prefix_wrapped_array @prefix_wrapped_array.setter - def prefix_wrapped_array(self, prefix_wrapped_array): + def prefix_wrapped_array( + self, + prefix_wrapped_array): """Sets the prefix_wrapped_array of this XmlItem. @@ -542,7 +626,8 @@ class XmlItem(object): :type: list[int] """ - self._prefix_wrapped_array = prefix_wrapped_array + self._prefix_wrapped_array = ( + prefix_wrapped_array) @property def namespace_string(self): @@ -555,7 +640,9 @@ class XmlItem(object): return self._namespace_string @namespace_string.setter - def namespace_string(self, namespace_string): + def namespace_string( + self, + namespace_string): """Sets the namespace_string of this XmlItem. @@ -563,7 +650,8 @@ class XmlItem(object): :type: str """ - self._namespace_string = namespace_string + self._namespace_string = ( + namespace_string) @property def namespace_number(self): @@ -576,7 +664,9 @@ class XmlItem(object): return self._namespace_number @namespace_number.setter - def namespace_number(self, namespace_number): + def namespace_number( + self, + namespace_number): """Sets the namespace_number of this XmlItem. @@ -584,7 +674,8 @@ class XmlItem(object): :type: float """ - self._namespace_number = namespace_number + self._namespace_number = ( + namespace_number) @property def namespace_integer(self): @@ -597,7 +688,9 @@ class XmlItem(object): return self._namespace_integer @namespace_integer.setter - def namespace_integer(self, namespace_integer): + def namespace_integer( + self, + namespace_integer): """Sets the namespace_integer of this XmlItem. @@ -605,7 +698,8 @@ class XmlItem(object): :type: int """ - self._namespace_integer = namespace_integer + self._namespace_integer = ( + namespace_integer) @property def namespace_boolean(self): @@ -618,7 +712,9 @@ class XmlItem(object): return self._namespace_boolean @namespace_boolean.setter - def namespace_boolean(self, namespace_boolean): + def namespace_boolean( + self, + namespace_boolean): """Sets the namespace_boolean of this XmlItem. @@ -626,7 +722,8 @@ class XmlItem(object): :type: bool """ - self._namespace_boolean = namespace_boolean + self._namespace_boolean = ( + namespace_boolean) @property def namespace_array(self): @@ -639,7 +736,9 @@ class XmlItem(object): return self._namespace_array @namespace_array.setter - def namespace_array(self, namespace_array): + def namespace_array( + self, + namespace_array): """Sets the namespace_array of this XmlItem. @@ -647,7 +746,8 @@ class XmlItem(object): :type: list[int] """ - self._namespace_array = namespace_array + self._namespace_array = ( + namespace_array) @property def namespace_wrapped_array(self): @@ -660,7 +760,9 @@ class XmlItem(object): return self._namespace_wrapped_array @namespace_wrapped_array.setter - def namespace_wrapped_array(self, namespace_wrapped_array): + def namespace_wrapped_array( + self, + namespace_wrapped_array): """Sets the namespace_wrapped_array of this XmlItem. @@ -668,7 +770,8 @@ class XmlItem(object): :type: list[int] """ - self._namespace_wrapped_array = namespace_wrapped_array + self._namespace_wrapped_array = ( + namespace_wrapped_array) @property def prefix_ns_string(self): @@ -681,7 +784,9 @@ class XmlItem(object): return self._prefix_ns_string @prefix_ns_string.setter - def prefix_ns_string(self, prefix_ns_string): + def prefix_ns_string( + self, + prefix_ns_string): """Sets the prefix_ns_string of this XmlItem. @@ -689,7 +794,8 @@ class XmlItem(object): :type: str """ - self._prefix_ns_string = prefix_ns_string + self._prefix_ns_string = ( + prefix_ns_string) @property def prefix_ns_number(self): @@ -702,7 +808,9 @@ class XmlItem(object): return self._prefix_ns_number @prefix_ns_number.setter - def prefix_ns_number(self, prefix_ns_number): + def prefix_ns_number( + self, + prefix_ns_number): """Sets the prefix_ns_number of this XmlItem. @@ -710,7 +818,8 @@ class XmlItem(object): :type: float """ - self._prefix_ns_number = prefix_ns_number + self._prefix_ns_number = ( + prefix_ns_number) @property def prefix_ns_integer(self): @@ -723,7 +832,9 @@ class XmlItem(object): return self._prefix_ns_integer @prefix_ns_integer.setter - def prefix_ns_integer(self, prefix_ns_integer): + def prefix_ns_integer( + self, + prefix_ns_integer): """Sets the prefix_ns_integer of this XmlItem. @@ -731,7 +842,8 @@ class XmlItem(object): :type: int """ - self._prefix_ns_integer = prefix_ns_integer + self._prefix_ns_integer = ( + prefix_ns_integer) @property def prefix_ns_boolean(self): @@ -744,7 +856,9 @@ class XmlItem(object): return self._prefix_ns_boolean @prefix_ns_boolean.setter - def prefix_ns_boolean(self, prefix_ns_boolean): + def prefix_ns_boolean( + self, + prefix_ns_boolean): """Sets the prefix_ns_boolean of this XmlItem. @@ -752,7 +866,8 @@ class XmlItem(object): :type: bool """ - self._prefix_ns_boolean = prefix_ns_boolean + self._prefix_ns_boolean = ( + prefix_ns_boolean) @property def prefix_ns_array(self): @@ -765,7 +880,9 @@ class XmlItem(object): return self._prefix_ns_array @prefix_ns_array.setter - def prefix_ns_array(self, prefix_ns_array): + def prefix_ns_array( + self, + prefix_ns_array): """Sets the prefix_ns_array of this XmlItem. @@ -773,7 +890,8 @@ class XmlItem(object): :type: list[int] """ - self._prefix_ns_array = prefix_ns_array + self._prefix_ns_array = ( + prefix_ns_array) @property def prefix_ns_wrapped_array(self): @@ -786,7 +904,9 @@ class XmlItem(object): return self._prefix_ns_wrapped_array @prefix_ns_wrapped_array.setter - def prefix_ns_wrapped_array(self, prefix_ns_wrapped_array): + def prefix_ns_wrapped_array( + self, + prefix_ns_wrapped_array): """Sets the prefix_ns_wrapped_array of this XmlItem. @@ -794,7 +914,8 @@ class XmlItem(object): :type: list[int] """ - self._prefix_ns_wrapped_array = prefix_ns_wrapped_array + self._prefix_ns_wrapped_array = ( + prefix_ns_wrapped_array) def to_dict(self): """Returns the model properties as a dict""" diff --git a/samples/client/petstore/python-experimental/test/test_type_holder_default.py b/samples/client/petstore/python-experimental/test/test_type_holder_default.py index e23ab2a32fc..4cb90d0ed92 100644 --- a/samples/client/petstore/python-experimental/test/test_type_holder_default.py +++ b/samples/client/petstore/python-experimental/test/test_type_holder_default.py @@ -32,15 +32,10 @@ class TestTypeHolderDefault(unittest.TestCase): """Test TypeHolderDefault""" # required_vars are set to None now until swagger-parser/swagger-core fixes # https://github.com/swagger-api/swagger-parser/issues/971 - required_vars = ['number_item', 'integer_item', 'array_item'] - sample_values = [5.67, 4, [-5, 2, -6]] - assigned_variables = {} - for index, required_var in enumerate(required_vars): - with self.assertRaises(ValueError): - model = TypeHolderDefault(**assigned_variables) - assigned_variables[required_var] = sample_values[index] - # assigned_variables is fully set, all required variables passed in - model = TypeHolderDefault(**assigned_variables) + with self.assertRaises(TypeError): + model = TypeHolderDefault() + array_item = [1, 2, 3] + model = TypeHolderDefault(array_item) self.assertEqual(model.string_item, 'what') self.assertEqual(model.bool_item, True)