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 5b7138c0686c..384960012385 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 @@ -97,6 +97,9 @@ public PythonClientExperimentalCodegen() { apiDocTemplateFiles.remove("api_doc.mustache"); apiDocTemplateFiles.put("python-experimental/api_doc.mustache", ".md"); + apiTestTemplateFiles.remove("api_test.mustache", ".py"); + apiTestTemplateFiles.put("python-experimental/api_test.mustache", ".py"); + modelDocTemplateFiles.remove("model_doc.mustache"); modelDocTemplateFiles.put("python-experimental/model_doc.mustache", ".md"); @@ -123,6 +126,7 @@ public void processOpts() { this.setLegacyDiscriminatorBehavior(false); super.processOpts(); + modelPackage = packageName + "." + "model"; supportingFiles.remove(new SupportingFile("api_client.mustache", packagePath(), "api_client.py")); supportingFiles.add(new SupportingFile("python-experimental/api_client.mustache", packagePath(), "api_client.py")); @@ -130,11 +134,14 @@ public void processOpts() { supportingFiles.add(new SupportingFile("python-experimental/model_utils.mustache", packagePath(), "model_utils.py")); supportingFiles.remove(new SupportingFile("__init__model.mustache", packagePath() + File.separatorChar + "models", "__init__.py")); - supportingFiles.add(new SupportingFile("python-experimental/__init__model.mustache", packagePath() + File.separatorChar + "models", "__init__.py")); + supportingFiles.add(new SupportingFile("python-experimental/__init__model.mustache", packagePath() + File.separatorChar + "model", "__init__.py")); supportingFiles.remove(new SupportingFile("__init__package.mustache", packagePath(), "__init__.py")); supportingFiles.add(new SupportingFile("python-experimental/__init__package.mustache", packagePath(), "__init__.py")); + // add the models and apis folders + supportingFiles.add(new SupportingFile("python-experimental/__init__models.mustache", packagePath() + File.separatorChar + "models", "__init__.py")); + supportingFiles.add(new SupportingFile("python-experimental/__init__apis.mustache", packagePath() + File.separatorChar + "apis", "__init__.py")); // Generate the 'signing.py' module, but only if the 'HTTP signature' security scheme is specified in the OAS. Map securitySchemeMap = openAPI != null ? @@ -518,9 +525,9 @@ public CodegenParameter fromRequestBody(RequestBody body, Set imports, S // set the example value if (modelProp.isEnum) { String value = modelProp._enum.get(0).toString(); - result.example = this.packageName + "." + result.baseType + "(" + toEnumValue(value, simpleDataType) + ")"; + result.example = result.dataType + "(" + toEnumValue(value, simpleDataType) + ")"; } else { - result.example = this.packageName + "." + result.baseType + "(" + result.example + ")"; + result.example = result.dataType + "(" + result.example + ")"; } } else if (!result.isPrimitiveType) { // fix the baseType for the api docs so the .md link to the class's documentation file is correct @@ -1064,7 +1071,7 @@ public void setParameterExampleValue(CodegenParameter p) { example = "'" + escapeText(example) + "'"; } else if (!languageSpecificPrimitives.contains(type)) { // type is a model class, e.g. user.User - example = this.packageName + "." + getPythonClassName(type) + "()"; + example = type + "()"; } else { LOGGER.warn("Type " + type + " not handled properly in setParameterExampleValue"); } diff --git a/modules/openapi-generator/src/main/resources/python/python-experimental/README_common.mustache b/modules/openapi-generator/src/main/resources/python/python-experimental/README_common.mustache index 7d9811fdfb85..0f6dcb41d6f6 100644 --- a/modules/openapi-generator/src/main/resources/python/python-experimental/README_common.mustache +++ b/modules/openapi-generator/src/main/resources/python/python-experimental/README_common.mustache @@ -4,13 +4,22 @@ from __future__ import print_function import time import {{{packageName}}} from pprint import pprint -{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}} +{{#apiInfo}} +{{#apis}} +{{#-first}} +from {{apiPackage}} import {{classVarName}} +{{#imports}} +{{{import}}} +{{/imports}} +{{#operations}} +{{#operation}} +{{#-first}} {{> python_doc_auth_partial}} # Enter a context with an instance of the API client with {{{packageName}}}.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = {{{packageName}}}.{{{classname}}}(api_client) + api_instance = {{classVarName}}.{{{classname}}}(api_client) {{#allParams}}{{paramName}} = {{{example}}} # {{{dataType}}} | {{{description}}}{{^required}} (optional){{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}} {{/allParams}} @@ -20,7 +29,12 @@ with {{{packageName}}}.ApiClient(configuration) as api_client: pprint(api_response){{/returnType}} except {{{packageName}}}.ApiException as e: print("Exception when calling {{classname}}->{{operationId}}: %s\n" % e) - {{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}} +{{/-first}} +{{/operation}} +{{/operations}} +{{/-first}} +{{/apis}} +{{/apiInfo}} ``` ## Documentation for API Endpoints @@ -77,3 +91,22 @@ Class | Method | HTTP request | Description {{#apiInfo}}{{#apis}}{{^hasMore}}{{infoEmail}} {{/hasMore}}{{/apis}}{{/apiInfo}} + +## Notes for Large OpenAPI documents +If the OpenAPI document is large, imports in {{{packageName}}}.apis and {{{packageName}}}.models may fail with a +RecursionError indicating the maximum recursion limit has been exceeded. In that case, there are a couple of solutions: + +Solution 1: +Use specific imports for apis and models like: +- `from {{{packageName}}}.api.default_api import DefaultApi` +- `from {{{packageName}}}.model.pet import Pet` + +Solution 1: +Before importing the package, adjust the maximum recursion limit as shown below: +``` +import sys +sys.setrecursionlimit(1500) +import {{{packageName}}} +from {{{packageName}}}.apis import * +from {{{packageName}}}.models import * +``` diff --git a/modules/openapi-generator/src/main/resources/python/python-experimental/__init__api.mustache b/modules/openapi-generator/src/main/resources/python/python-experimental/__init__api.mustache new file mode 100644 index 000000000000..d37ee6c78b29 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/python/python-experimental/__init__api.mustache @@ -0,0 +1,3 @@ +# do not import all apis into this module because that uses a lot of memory and stack frames +# if you need the ability to import all models from one package, import them with +# from {{packageName}.apis import DefaultApi, PetApi \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/python/python-experimental/__init__apis.mustache b/modules/openapi-generator/src/main/resources/python/python-experimental/__init__apis.mustache new file mode 100644 index 000000000000..b5b7065e1ed2 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/python/python-experimental/__init__apis.mustache @@ -0,0 +1,19 @@ +# coding: utf-8 + +# flake8: noqa + +# import all apis into this package +# if you have many ampis here with many many models used in each api this may +# raise a RecursionError +# to avoid this, import only the api that you directly need like: +# from {{packagename}}.api.pet_api import PetApi +# or import this package, but before doing it, use: +# import sys +# sys.setrecursionlimit(n) + +# import apis into api package +{{#apiInfo}} +{{#apis}} +from {{apiPackage}}.{{classVarName}} import {{classname}} +{{/apis}} +{{/apiInfo}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/python/python-experimental/__init__model.mustache b/modules/openapi-generator/src/main/resources/python/python-experimental/__init__model.mustache index ca86cb8a6249..cfe32b784926 100644 --- a/modules/openapi-generator/src/main/resources/python/python-experimental/__init__model.mustache +++ b/modules/openapi-generator/src/main/resources/python/python-experimental/__init__model.mustache @@ -1,7 +1,5 @@ -# coding: utf-8 - -# flake8: noqa -{{>partial_header}} - # we can not import model classes here because that would create a circular # reference which would not work in python2 +# do not import all models into this module because that uses a lot of memory and stack frames +# if you need the ability to import all models from one package, import them with +# from {{packageName}.models import ModelA, ModelB diff --git a/modules/openapi-generator/src/main/resources/python/python-experimental/__init__models.mustache b/modules/openapi-generator/src/main/resources/python/python-experimental/__init__models.mustache new file mode 100644 index 000000000000..abe69dc03504 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/python/python-experimental/__init__models.mustache @@ -0,0 +1,18 @@ +# coding: utf-8 + +# flake8: noqa + +# import all models into this package +# if you have many models here with many references from one model to another this may +# raise a RecursionError +# to avoid this, import only the models that you directly need like: +# from from {{modelPackage}}.pet import Pet +# or import this package, but before doing it, use: +# import sys +# sys.setrecursionlimit(n) + +{{#models}} +{{#model}} +from {{modelPackage}}.{{classFilename}} import {{unescapedDescription}} +{{/model}} +{{/models}} diff --git a/modules/openapi-generator/src/main/resources/python/python-experimental/__init__package.mustache b/modules/openapi-generator/src/main/resources/python/python-experimental/__init__package.mustache index 1d74d016ab47..a949d5085067 100644 --- a/modules/openapi-generator/src/main/resources/python/python-experimental/__init__package.mustache +++ b/modules/openapi-generator/src/main/resources/python/python-experimental/__init__package.mustache @@ -8,13 +8,6 @@ from __future__ import absolute_import __version__ = "{{packageVersion}}" -# import apis into sdk package -{{#apiInfo}} -{{#apis}} -from {{apiPackage}}.{{classVarName}} import {{classname}} -{{/apis}} -{{/apiInfo}} - # import ApiClient from {{packageName}}.api_client import ApiClient @@ -26,14 +19,8 @@ from {{packageName}}.signing import HttpSigningConfiguration # import exceptions from {{packageName}}.exceptions import OpenApiException +from {{packageName}}.exceptions import ApiAttributeError from {{packageName}}.exceptions import ApiTypeError from {{packageName}}.exceptions import ApiValueError from {{packageName}}.exceptions import ApiKeyError -from {{packageName}}.exceptions import ApiException - -# import models into sdk package -{{#models}} -{{#model}} -from {{modelPackage}}.{{classFilename}} import {{unescapedDescription}} -{{/model}} -{{/models}} +from {{packageName}}.exceptions import ApiException \ No newline at end of file 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 index ae7b8a697970..23cf85e9dffa 100644 --- 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 @@ -2,6 +2,10 @@ from __future__ import print_function import time import {{{packageName}}} +from {{apiPackage}} import {{classVarName}} +{{#imports}} +{{{.}}} +{{/imports}} from pprint import pprint {{> python_doc_auth_partial}} # Enter a context with an instance of the API client @@ -12,7 +16,7 @@ with {{{packageName}}}.ApiClient(configuration) as api_client: with {{{packageName}}}.ApiClient() as api_client: {{/hasAuthMethods}} # Create an instance of the API class - api_instance = {{{packageName}}}.{{{classname}}}(api_client) + api_instance = {{classVarName}}.{{{classname}}}(api_client) {{#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}} diff --git a/modules/openapi-generator/src/main/resources/python/python-experimental/api_test.mustache b/modules/openapi-generator/src/main/resources/python/python-experimental/api_test.mustache new file mode 100644 index 000000000000..e04b32f96edb --- /dev/null +++ b/modules/openapi-generator/src/main/resources/python/python-experimental/api_test.mustache @@ -0,0 +1,36 @@ +# coding: utf-8 + +{{>partial_header}} + +from __future__ import absolute_import + +import unittest + +import {{packageName}} +from {{apiPackage}}.{{classVarName}} import {{classname}} # noqa: E501 + + +class {{#operations}}Test{{classname}}(unittest.TestCase): + """{{classname}} unit test stubs""" + + def setUp(self): + self.api = {{classname}}() # noqa: E501 + + def tearDown(self): + pass + + {{#operation}} + def test_{{operationId}}(self): + """Test case for {{{operationId}}} + +{{#summary}} + {{{summary}}} # noqa: E501 +{{/summary}} + """ + pass + + {{/operation}} +{{/operations}} + +if __name__ == '__main__': + unittest.main() diff --git a/modules/openapi-generator/src/main/resources/python/python-experimental/model_test.mustache b/modules/openapi-generator/src/main/resources/python/python-experimental/model_test.mustache index 4fd1263b5f28..5b9a91d2d073 100644 --- a/modules/openapi-generator/src/main/resources/python/python-experimental/model_test.mustache +++ b/modules/openapi-generator/src/main/resources/python/python-experimental/model_test.mustache @@ -3,12 +3,16 @@ {{>partial_header}} from __future__ import absolute_import - +import sys import unittest +import {{packageName}} {{#models}} {{#model}} -import {{packageName}} +{{#imports}} +{{{.}}} +{{/imports}} +from {{modelPackage}}.{{classFilename}} import {{unescapedDescription}} class Test{{unescapedDescription}}(unittest.TestCase): @@ -23,7 +27,7 @@ class Test{{unescapedDescription}}(unittest.TestCase): def test{{unescapedDescription}}(self): """Test {{unescapedDescription}}""" # FIXME: construct object with mandatory attributes with example values - # model = {{packageName}}.{{unescapedDescription}}() # noqa: E501 + # model = {{unescapedDescription}}() # noqa: E501 pass {{/model}} diff --git a/samples/client/petstore/python-experimental/.openapi-generator/FILES b/samples/client/petstore/python-experimental/.openapi-generator/FILES index e855d6b1ef4e..d282130ffbc0 100644 --- a/samples/client/petstore/python-experimental/.openapi-generator/FILES +++ b/samples/client/petstore/python-experimental/.openapi-generator/FILES @@ -80,72 +80,74 @@ petstore_api/api/pet_api.py petstore_api/api/store_api.py petstore_api/api/user_api.py petstore_api/api_client.py +petstore_api/apis/__init__.py petstore_api/configuration.py petstore_api/exceptions.py +petstore_api/model/__init__.py +petstore_api/model/additional_properties_any_type.py +petstore_api/model/additional_properties_array.py +petstore_api/model/additional_properties_boolean.py +petstore_api/model/additional_properties_class.py +petstore_api/model/additional_properties_integer.py +petstore_api/model/additional_properties_number.py +petstore_api/model/additional_properties_object.py +petstore_api/model/additional_properties_string.py +petstore_api/model/animal.py +petstore_api/model/api_response.py +petstore_api/model/array_of_array_of_number_only.py +petstore_api/model/array_of_number_only.py +petstore_api/model/array_test.py +petstore_api/model/capitalization.py +petstore_api/model/cat.py +petstore_api/model/cat_all_of.py +petstore_api/model/category.py +petstore_api/model/child.py +petstore_api/model/child_all_of.py +petstore_api/model/child_cat.py +petstore_api/model/child_cat_all_of.py +petstore_api/model/child_dog.py +petstore_api/model/child_dog_all_of.py +petstore_api/model/child_lizard.py +petstore_api/model/child_lizard_all_of.py +petstore_api/model/class_model.py +petstore_api/model/client.py +petstore_api/model/dog.py +petstore_api/model/dog_all_of.py +petstore_api/model/enum_arrays.py +petstore_api/model/enum_class.py +petstore_api/model/enum_test.py +petstore_api/model/file.py +petstore_api/model/file_schema_test_class.py +petstore_api/model/format_test.py +petstore_api/model/grandparent.py +petstore_api/model/grandparent_animal.py +petstore_api/model/has_only_read_only.py +petstore_api/model/list.py +petstore_api/model/map_test.py +petstore_api/model/mixed_properties_and_additional_properties_class.py +petstore_api/model/model200_response.py +petstore_api/model/model_return.py +petstore_api/model/name.py +petstore_api/model/number_only.py +petstore_api/model/order.py +petstore_api/model/outer_composite.py +petstore_api/model/outer_enum.py +petstore_api/model/outer_number.py +petstore_api/model/parent.py +petstore_api/model/parent_all_of.py +petstore_api/model/parent_pet.py +petstore_api/model/pet.py +petstore_api/model/player.py +petstore_api/model/read_only_first.py +petstore_api/model/special_model_name.py +petstore_api/model/string_boolean_map.py +petstore_api/model/tag.py +petstore_api/model/type_holder_default.py +petstore_api/model/type_holder_example.py +petstore_api/model/user.py +petstore_api/model/xml_item.py petstore_api/model_utils.py petstore_api/models/__init__.py -petstore_api/models/additional_properties_any_type.py -petstore_api/models/additional_properties_array.py -petstore_api/models/additional_properties_boolean.py -petstore_api/models/additional_properties_class.py -petstore_api/models/additional_properties_integer.py -petstore_api/models/additional_properties_number.py -petstore_api/models/additional_properties_object.py -petstore_api/models/additional_properties_string.py -petstore_api/models/animal.py -petstore_api/models/api_response.py -petstore_api/models/array_of_array_of_number_only.py -petstore_api/models/array_of_number_only.py -petstore_api/models/array_test.py -petstore_api/models/capitalization.py -petstore_api/models/cat.py -petstore_api/models/cat_all_of.py -petstore_api/models/category.py -petstore_api/models/child.py -petstore_api/models/child_all_of.py -petstore_api/models/child_cat.py -petstore_api/models/child_cat_all_of.py -petstore_api/models/child_dog.py -petstore_api/models/child_dog_all_of.py -petstore_api/models/child_lizard.py -petstore_api/models/child_lizard_all_of.py -petstore_api/models/class_model.py -petstore_api/models/client.py -petstore_api/models/dog.py -petstore_api/models/dog_all_of.py -petstore_api/models/enum_arrays.py -petstore_api/models/enum_class.py -petstore_api/models/enum_test.py -petstore_api/models/file.py -petstore_api/models/file_schema_test_class.py -petstore_api/models/format_test.py -petstore_api/models/grandparent.py -petstore_api/models/grandparent_animal.py -petstore_api/models/has_only_read_only.py -petstore_api/models/list.py -petstore_api/models/map_test.py -petstore_api/models/mixed_properties_and_additional_properties_class.py -petstore_api/models/model200_response.py -petstore_api/models/model_return.py -petstore_api/models/name.py -petstore_api/models/number_only.py -petstore_api/models/order.py -petstore_api/models/outer_composite.py -petstore_api/models/outer_enum.py -petstore_api/models/outer_number.py -petstore_api/models/parent.py -petstore_api/models/parent_all_of.py -petstore_api/models/parent_pet.py -petstore_api/models/pet.py -petstore_api/models/player.py -petstore_api/models/read_only_first.py -petstore_api/models/special_model_name.py -petstore_api/models/string_boolean_map.py -petstore_api/models/tag.py -petstore_api/models/type_holder_default.py -petstore_api/models/type_holder_example.py -petstore_api/models/user.py -petstore_api/models/xml_item.py petstore_api/rest.py requirements.txt setup.cfg diff --git a/samples/client/petstore/python-experimental/README.md b/samples/client/petstore/python-experimental/README.md index 81b680fa57b3..d6b85d02a55a 100644 --- a/samples/client/petstore/python-experimental/README.md +++ b/samples/client/petstore/python-experimental/README.md @@ -50,7 +50,8 @@ from __future__ import print_function import time import petstore_api from pprint import pprint - +from petstore_api.api import another_fake_api +from petstore_api.model import client # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -62,8 +63,8 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = petstore_api.AnotherFakeApi(api_client) - body = petstore_api.Client() # client.Client | client model + api_instance = another_fake_api.AnotherFakeApi(api_client) + body = client.Client() # client.Client | client model try: # To test special tags @@ -71,7 +72,6 @@ with petstore_api.ApiClient(configuration) as api_client: pprint(api_response) except petstore_api.ApiException as e: print("Exception when calling AnotherFakeApi->call_123_test_special_tags: %s\n" % e) - ``` ## Documentation for API Endpoints @@ -223,3 +223,22 @@ Class | Method | HTTP request | Description +## Notes for Large OpenAPI documents +If the OpenAPI document is large, imports in petstore_api.apis and petstore_api.models may fail with a +RecursionError indicating the maximum recursion limit has been exceeded. In that case, there are a couple of solutions: + +Solution 1: +Use specific imports for apis and models like: +- `from petstore_api.api.default_api import DefaultApi` +- `from petstore_api.model.pet import Pet` + +Solution 1: +Before importing the package, adjust the maximum recursion limit as shown below: +``` +import sys +sys.setrecursionlimit(1500) +import petstore_api +from petstore_api.apis import * +from petstore_api.models import * +``` + diff --git a/samples/client/petstore/python-experimental/docs/AnotherFakeApi.md b/samples/client/petstore/python-experimental/docs/AnotherFakeApi.md index 83a89addfaee..8b7a61109454 100644 --- a/samples/client/petstore/python-experimental/docs/AnotherFakeApi.md +++ b/samples/client/petstore/python-experimental/docs/AnotherFakeApi.md @@ -20,6 +20,8 @@ To test special tags and operation ID starting with number from __future__ import print_function import time import petstore_api +from petstore_api.api import another_fake_api +from petstore_api.model import client from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -31,8 +33,8 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.AnotherFakeApi(api_client) - body = petstore_api.Client() # client.Client | client model + api_instance = another_fake_api.AnotherFakeApi(api_client) + body = client.Client() # client.Client | client model # example passing only required values which don't have defaults set try: diff --git a/samples/client/petstore/python-experimental/docs/FakeApi.md b/samples/client/petstore/python-experimental/docs/FakeApi.md index de9a3fd1a4fb..7f813d160f77 100644 --- a/samples/client/petstore/python-experimental/docs/FakeApi.md +++ b/samples/client/petstore/python-experimental/docs/FakeApi.md @@ -34,6 +34,8 @@ this route creates an XmlItem from __future__ import print_function import time import petstore_api +from petstore_api.api import fake_api +from petstore_api.model import xml_item from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -45,8 +47,8 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) - xml_item = petstore_api.XmlItem() # xml_item.XmlItem | XmlItem Body + api_instance = fake_api.FakeApi(api_client) + xml_item = xml_item.XmlItem() # xml_item.XmlItem | XmlItem Body # example passing only required values which don't have defaults set try: @@ -95,6 +97,7 @@ Test serialization of outer boolean types from __future__ import print_function import time import petstore_api +from petstore_api.api import fake_api from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -106,7 +109,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) + api_instance = fake_api.FakeApi(api_client) body = True # bool | Input boolean as post body (optional) # example passing only required values which don't have defaults set @@ -157,6 +160,8 @@ Test serialization of object with outer number type from __future__ import print_function import time import petstore_api +from petstore_api.api import fake_api +from petstore_api.model import outer_composite from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -168,8 +173,8 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) - body = petstore_api.OuterComposite() # outer_composite.OuterComposite | Input composite as post body (optional) + api_instance = fake_api.FakeApi(api_client) + body = outer_composite.OuterComposite() # outer_composite.OuterComposite | Input composite as post body (optional) # example passing only required values which don't have defaults set # and optional values @@ -219,6 +224,8 @@ Test serialization of outer enum from __future__ import print_function import time import petstore_api +from petstore_api.api import fake_api +from petstore_api.model import outer_enum from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -230,8 +237,8 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) - body = petstore_api.OuterEnum("placed") # outer_enum.OuterEnum | Input enum as post body (optional) + api_instance = fake_api.FakeApi(api_client) + body = outer_enum.OuterEnum("placed") # outer_enum.OuterEnum | Input enum as post body (optional) # example passing only required values which don't have defaults set # and optional values @@ -281,6 +288,8 @@ Test serialization of outer number types from __future__ import print_function import time import petstore_api +from petstore_api.api import fake_api +from petstore_api.model import outer_number from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -292,8 +301,8 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) - body = petstore_api.OuterNumber(3.4) # outer_number.OuterNumber | Input number as post body (optional) + api_instance = fake_api.FakeApi(api_client) + body = outer_number.OuterNumber(3.4) # outer_number.OuterNumber | Input number as post body (optional) # example passing only required values which don't have defaults set # and optional values @@ -343,6 +352,7 @@ Test serialization of outer string types from __future__ import print_function import time import petstore_api +from petstore_api.api import fake_api from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -354,7 +364,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) + api_instance = fake_api.FakeApi(api_client) body = 'body_example' # str | Input string as post body (optional) # example passing only required values which don't have defaults set @@ -405,6 +415,8 @@ For this test, the body for this request much reference a schema named `File`. from __future__ import print_function import time import petstore_api +from petstore_api.api import fake_api +from petstore_api.model import file_schema_test_class from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -416,8 +428,8 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) - body = petstore_api.FileSchemaTestClass() # file_schema_test_class.FileSchemaTestClass | + api_instance = fake_api.FakeApi(api_client) + body = file_schema_test_class.FileSchemaTestClass() # file_schema_test_class.FileSchemaTestClass | # example passing only required values which don't have defaults set try: @@ -463,6 +475,8 @@ No authorization required from __future__ import print_function import time import petstore_api +from petstore_api.api import fake_api +from petstore_api.model import user from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -474,9 +488,9 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) + api_instance = fake_api.FakeApi(api_client) query = 'query_example' # str | - body = petstore_api.User() # user.User | + body = user.User() # user.User | # example passing only required values which don't have defaults set try: @@ -525,6 +539,8 @@ To test \"client\" model from __future__ import print_function import time import petstore_api +from petstore_api.api import fake_api +from petstore_api.model import client from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -536,8 +552,8 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) - body = petstore_api.Client() # client.Client | client model + api_instance = fake_api.FakeApi(api_client) + body = client.Client() # client.Client | client model # example passing only required values which don't have defaults set try: @@ -587,6 +603,7 @@ This route has required values with enums of 1 from __future__ import print_function import time import petstore_api +from petstore_api.api import fake_api from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -598,7 +615,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) + api_instance = fake_api.FakeApi(api_client) # example passing only required values which don't have defaults set try: @@ -651,6 +668,7 @@ Fake endpoint for testing various parameters 假端點 偽のエンドポイ from __future__ import print_function import time import petstore_api +from petstore_api.api import fake_api from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -672,7 +690,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) + api_instance = fake_api.FakeApi(api_client) number = 3.4 # float | None double = 3.4 # float | None pattern_without_delimiter = 'pattern_without_delimiter_example' # str | None @@ -757,6 +775,7 @@ To test enum parameters from __future__ import print_function import time import petstore_api +from petstore_api.api import fake_api from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -768,7 +787,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) + api_instance = fake_api.FakeApi(api_client) enum_header_string_array = ['enum_header_string_array_example'] # [str] | Header parameter enum test (string array) (optional) enum_header_string = '-efg' # str | Header parameter enum test (string) (optional) if omitted the server will use the default value of '-efg' enum_query_string_array = ['enum_query_string_array_example'] # [str] | Query parameter enum test (string array) (optional) @@ -834,6 +853,7 @@ Fake endpoint to test group parameters (optional) from __future__ import print_function import time import petstore_api +from petstore_api.api import fake_api from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -845,7 +865,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) + api_instance = fake_api.FakeApi(api_client) required_string_group = 56 # int | Required String in group parameters required_boolean_group = True # bool | Required Boolean in group parameters required_int64_group = 56 # int | Required Integer in group parameters @@ -911,6 +931,7 @@ test inline additionalProperties from __future__ import print_function import time import petstore_api +from petstore_api.api import fake_api from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -922,7 +943,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) + api_instance = fake_api.FakeApi(api_client) param = {'key': 'param_example'} # {str: (str,)} | request body # example passing only required values which don't have defaults set @@ -970,6 +991,7 @@ test json serialization of form data from __future__ import print_function import time import petstore_api +from petstore_api.api import fake_api from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -981,7 +1003,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) + api_instance = fake_api.FakeApi(api_client) param = 'param_example' # str | field1 param2 = 'param2_example' # str | field2 diff --git a/samples/client/petstore/python-experimental/docs/FakeClassnameTags123Api.md b/samples/client/petstore/python-experimental/docs/FakeClassnameTags123Api.md index c10f9f37e164..6cc246194992 100644 --- a/samples/client/petstore/python-experimental/docs/FakeClassnameTags123Api.md +++ b/samples/client/petstore/python-experimental/docs/FakeClassnameTags123Api.md @@ -21,6 +21,8 @@ To test class name in snake case from __future__ import print_function import time import petstore_api +from petstore_api.api import fake_classname_tags_123_api +from petstore_api.model import client from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -46,8 +48,8 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = petstore_api.FakeClassnameTags123Api(api_client) - body = petstore_api.Client() # client.Client | client model + api_instance = fake_classname_tags_123_api.FakeClassnameTags123Api(api_client) + body = client.Client() # client.Client | client model # example passing only required values which don't have defaults set try: diff --git a/samples/client/petstore/python-experimental/docs/PetApi.md b/samples/client/petstore/python-experimental/docs/PetApi.md index d7192a2dd5f3..20b56372d833 100644 --- a/samples/client/petstore/python-experimental/docs/PetApi.md +++ b/samples/client/petstore/python-experimental/docs/PetApi.md @@ -27,6 +27,8 @@ Add a new pet to the store from __future__ import print_function import time import petstore_api +from petstore_api.api import pet_api +from petstore_api.model import pet from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -48,8 +50,8 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN' # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = petstore_api.PetApi(api_client) - body = petstore_api.Pet() # pet.Pet | Pet object that needs to be added to the store + api_instance = pet_api.PetApi(api_client) + body = pet.Pet() # pet.Pet | Pet object that needs to be added to the store # example passing only required values which don't have defaults set try: @@ -98,6 +100,7 @@ Deletes a pet from __future__ import print_function import time import petstore_api +from petstore_api.api import pet_api from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -119,7 +122,7 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN' # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = petstore_api.PetApi(api_client) + api_instance = pet_api.PetApi(api_client) pet_id = 56 # int | Pet id to delete api_key = 'api_key_example' # str | (optional) @@ -181,6 +184,8 @@ Multiple status values can be provided with comma separated strings from __future__ import print_function import time import petstore_api +from petstore_api.api import pet_api +from petstore_api.model import pet from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -202,7 +207,7 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN' # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = petstore_api.PetApi(api_client) + api_instance = pet_api.PetApi(api_client) status = ['status_example'] # [str] | Status values that need to be considered for filter # example passing only required values which don't have defaults set @@ -255,6 +260,8 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 from __future__ import print_function import time import petstore_api +from petstore_api.api import pet_api +from petstore_api.model import pet from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -276,7 +283,7 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN' # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = petstore_api.PetApi(api_client) + api_instance = pet_api.PetApi(api_client) tags = ['tags_example'] # [str] | Tags to filter by # example passing only required values which don't have defaults set @@ -329,6 +336,8 @@ Returns a single pet from __future__ import print_function import time import petstore_api +from petstore_api.api import pet_api +from petstore_api.model import pet from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -354,7 +363,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = petstore_api.PetApi(api_client) + api_instance = pet_api.PetApi(api_client) pet_id = 56 # int | ID of pet to return # example passing only required values which don't have defaults set @@ -406,6 +415,8 @@ Update an existing pet from __future__ import print_function import time import petstore_api +from petstore_api.api import pet_api +from petstore_api.model import pet from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -427,8 +438,8 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN' # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = petstore_api.PetApi(api_client) - body = petstore_api.Pet() # pet.Pet | Pet object that needs to be added to the store + api_instance = pet_api.PetApi(api_client) + body = pet.Pet() # pet.Pet | Pet object that needs to be added to the store # example passing only required values which don't have defaults set try: @@ -479,6 +490,7 @@ Updates a pet in the store with form data from __future__ import print_function import time import petstore_api +from petstore_api.api import pet_api from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -500,7 +512,7 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN' # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = petstore_api.PetApi(api_client) + api_instance = pet_api.PetApi(api_client) pet_id = 56 # int | ID of pet that needs to be updated name = 'name_example' # str | Updated name of the pet (optional) status = 'status_example' # str | Updated status of the pet (optional) @@ -561,6 +573,8 @@ uploads an image from __future__ import print_function import time import petstore_api +from petstore_api.api import pet_api +from petstore_api.model import api_response from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -582,7 +596,7 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN' # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = petstore_api.PetApi(api_client) + api_instance = pet_api.PetApi(api_client) pet_id = 56 # int | ID of pet to update additional_metadata = 'additional_metadata_example' # str | Additional data to pass to server (optional) file = open('/path/to/file', 'rb') # file_type | file to upload (optional) @@ -647,6 +661,8 @@ uploads an image (required) from __future__ import print_function import time import petstore_api +from petstore_api.api import pet_api +from petstore_api.model import api_response from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -668,7 +684,7 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN' # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = petstore_api.PetApi(api_client) + api_instance = pet_api.PetApi(api_client) pet_id = 56 # int | ID of pet to update required_file = open('/path/to/file', 'rb') # file_type | file to upload additional_metadata = 'additional_metadata_example' # str | Additional data to pass to server (optional) diff --git a/samples/client/petstore/python-experimental/docs/StoreApi.md b/samples/client/petstore/python-experimental/docs/StoreApi.md index b4492962d69c..36e72b2ac4f1 100644 --- a/samples/client/petstore/python-experimental/docs/StoreApi.md +++ b/samples/client/petstore/python-experimental/docs/StoreApi.md @@ -23,6 +23,7 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or non from __future__ import print_function import time import petstore_api +from petstore_api.api import store_api from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -34,7 +35,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.StoreApi(api_client) + api_instance = store_api.StoreApi(api_client) order_id = 'order_id_example' # str | ID of the order that needs to be deleted # example passing only required values which don't have defaults set @@ -86,6 +87,7 @@ Returns a map of status codes to quantities from __future__ import print_function import time import petstore_api +from petstore_api.api import store_api from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -111,7 +113,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = petstore_api.StoreApi(api_client) + api_instance = store_api.StoreApi(api_client) # example, this endpoint has no required or optional parameters try: @@ -158,6 +160,8 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge from __future__ import print_function import time import petstore_api +from petstore_api.api import store_api +from petstore_api.model import order from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -169,7 +173,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.StoreApi(api_client) + api_instance = store_api.StoreApi(api_client) order_id = 56 # int | ID of pet that needs to be fetched # example passing only required values which don't have defaults set @@ -220,6 +224,8 @@ Place an order for a pet from __future__ import print_function import time import petstore_api +from petstore_api.api import store_api +from petstore_api.model import order from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -231,8 +237,8 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.StoreApi(api_client) - body = petstore_api.Order() # order.Order | order placed for purchasing the pet + api_instance = store_api.StoreApi(api_client) + body = order.Order() # order.Order | order placed for purchasing the pet # example passing only required values which don't have defaults set try: diff --git a/samples/client/petstore/python-experimental/docs/UserApi.md b/samples/client/petstore/python-experimental/docs/UserApi.md index b02b92afbf74..4727961273c1 100644 --- a/samples/client/petstore/python-experimental/docs/UserApi.md +++ b/samples/client/petstore/python-experimental/docs/UserApi.md @@ -27,6 +27,8 @@ This can only be done by the logged in user. from __future__ import print_function import time import petstore_api +from petstore_api.api import user_api +from petstore_api.model import user from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -38,8 +40,8 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.UserApi(api_client) - body = petstore_api.User() # user.User | Created user object + api_instance = user_api.UserApi(api_client) + body = user.User() # user.User | Created user object # example passing only required values which don't have defaults set try: @@ -86,6 +88,8 @@ Creates list of users with given input array from __future__ import print_function import time import petstore_api +from petstore_api.api import user_api +from petstore_api.model import user from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -97,8 +101,8 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.UserApi(api_client) - body = [petstore_api.User()] # [user.User] | List of user object + api_instance = user_api.UserApi(api_client) + body = [user.User()] # [user.User] | List of user object # example passing only required values which don't have defaults set try: @@ -145,6 +149,8 @@ Creates list of users with given input array from __future__ import print_function import time import petstore_api +from petstore_api.api import user_api +from petstore_api.model import user from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -156,8 +162,8 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.UserApi(api_client) - body = [petstore_api.User()] # [user.User] | List of user object + api_instance = user_api.UserApi(api_client) + body = [user.User()] # [user.User] | List of user object # example passing only required values which don't have defaults set try: @@ -206,6 +212,7 @@ This can only be done by the logged in user. from __future__ import print_function import time import petstore_api +from petstore_api.api import user_api from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -217,7 +224,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.UserApi(api_client) + api_instance = user_api.UserApi(api_client) username = 'username_example' # str | The name that needs to be deleted # example passing only required values which don't have defaults set @@ -266,6 +273,8 @@ Get user by user name from __future__ import print_function import time import petstore_api +from petstore_api.api import user_api +from petstore_api.model import user from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -277,7 +286,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.UserApi(api_client) + api_instance = user_api.UserApi(api_client) username = 'username_example' # str | The name that needs to be fetched. Use user1 for testing. # example passing only required values which don't have defaults set @@ -328,6 +337,7 @@ Logs user into the system from __future__ import print_function import time import petstore_api +from petstore_api.api import user_api from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -339,7 +349,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.UserApi(api_client) + api_instance = user_api.UserApi(api_client) username = 'username_example' # str | The user name for login password = 'password_example' # str | The password for login in clear text @@ -391,6 +401,7 @@ Logs out current logged in user session from __future__ import print_function import time import petstore_api +from petstore_api.api import user_api from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -402,7 +413,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.UserApi(api_client) + api_instance = user_api.UserApi(api_client) # example, this endpoint has no required or optional parameters try: @@ -448,6 +459,8 @@ This can only be done by the logged in user. from __future__ import print_function import time import petstore_api +from petstore_api.api import user_api +from petstore_api.model import user from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -459,9 +472,9 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.UserApi(api_client) + api_instance = user_api.UserApi(api_client) username = 'username_example' # str | name that need to be deleted - body = petstore_api.User() # user.User | Updated user object + body = user.User() # user.User | Updated user object # example passing only required values which don't have defaults set try: diff --git a/samples/client/petstore/python-experimental/petstore_api/__init__.py b/samples/client/petstore/python-experimental/petstore_api/__init__.py index 445bf2409aee..4af4353187f6 100644 --- a/samples/client/petstore/python-experimental/petstore_api/__init__.py +++ b/samples/client/petstore/python-experimental/petstore_api/__init__.py @@ -16,14 +16,6 @@ __version__ = "1.0.0" -# import apis into sdk package -from petstore_api.api.another_fake_api import AnotherFakeApi -from petstore_api.api.fake_api import FakeApi -from petstore_api.api.fake_classname_tags_123_api import FakeClassnameTags123Api -from petstore_api.api.pet_api import PetApi -from petstore_api.api.store_api import StoreApi -from petstore_api.api.user_api import UserApi - # import ApiClient from petstore_api.api_client import ApiClient @@ -32,71 +24,8 @@ # import exceptions from petstore_api.exceptions import OpenApiException +from petstore_api.exceptions import ApiAttributeError from petstore_api.exceptions import ApiTypeError from petstore_api.exceptions import ApiValueError from petstore_api.exceptions import ApiKeyError -from petstore_api.exceptions import ApiException - -# import models into sdk package -from petstore_api.models.additional_properties_any_type import AdditionalPropertiesAnyType -from petstore_api.models.additional_properties_array import AdditionalPropertiesArray -from petstore_api.models.additional_properties_boolean import AdditionalPropertiesBoolean -from petstore_api.models.additional_properties_class import AdditionalPropertiesClass -from petstore_api.models.additional_properties_integer import AdditionalPropertiesInteger -from petstore_api.models.additional_properties_number import AdditionalPropertiesNumber -from petstore_api.models.additional_properties_object import AdditionalPropertiesObject -from petstore_api.models.additional_properties_string import AdditionalPropertiesString -from petstore_api.models.animal import Animal -from petstore_api.models.api_response import ApiResponse -from petstore_api.models.array_of_array_of_number_only import ArrayOfArrayOfNumberOnly -from petstore_api.models.array_of_number_only import ArrayOfNumberOnly -from petstore_api.models.array_test import ArrayTest -from petstore_api.models.capitalization import Capitalization -from petstore_api.models.cat import Cat -from petstore_api.models.cat_all_of import CatAllOf -from petstore_api.models.category import Category -from petstore_api.models.child import Child -from petstore_api.models.child_all_of import ChildAllOf -from petstore_api.models.child_cat import ChildCat -from petstore_api.models.child_cat_all_of import ChildCatAllOf -from petstore_api.models.child_dog import ChildDog -from petstore_api.models.child_dog_all_of import ChildDogAllOf -from petstore_api.models.child_lizard import ChildLizard -from petstore_api.models.child_lizard_all_of import ChildLizardAllOf -from petstore_api.models.class_model import ClassModel -from petstore_api.models.client import Client -from petstore_api.models.dog import Dog -from petstore_api.models.dog_all_of import DogAllOf -from petstore_api.models.enum_arrays import EnumArrays -from petstore_api.models.enum_class import EnumClass -from petstore_api.models.enum_test import EnumTest -from petstore_api.models.file import File -from petstore_api.models.file_schema_test_class import FileSchemaTestClass -from petstore_api.models.format_test import FormatTest -from petstore_api.models.grandparent import Grandparent -from petstore_api.models.grandparent_animal import GrandparentAnimal -from petstore_api.models.has_only_read_only import HasOnlyReadOnly -from petstore_api.models.list import List -from petstore_api.models.map_test import MapTest -from petstore_api.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass -from petstore_api.models.model200_response import Model200Response -from petstore_api.models.model_return import ModelReturn -from petstore_api.models.name import Name -from petstore_api.models.number_only import NumberOnly -from petstore_api.models.order import Order -from petstore_api.models.outer_composite import OuterComposite -from petstore_api.models.outer_enum import OuterEnum -from petstore_api.models.outer_number import OuterNumber -from petstore_api.models.parent import Parent -from petstore_api.models.parent_all_of import ParentAllOf -from petstore_api.models.parent_pet import ParentPet -from petstore_api.models.pet import Pet -from petstore_api.models.player import Player -from petstore_api.models.read_only_first import ReadOnlyFirst -from petstore_api.models.special_model_name import SpecialModelName -from petstore_api.models.string_boolean_map import StringBooleanMap -from petstore_api.models.tag import Tag -from petstore_api.models.type_holder_default import TypeHolderDefault -from petstore_api.models.type_holder_example import TypeHolderExample -from petstore_api.models.user import User -from petstore_api.models.xml_item import XmlItem +from petstore_api.exceptions import ApiException \ No newline at end of file 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 b7ea5e549329..3f277311b8fb 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 @@ -34,7 +34,7 @@ str, validate_and_convert_types ) -from petstore_api.models import client +from petstore_api.model import client class AnotherFakeApi(object): 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 e97902bb9a2b..a05c8e947b31 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 @@ -34,13 +34,13 @@ str, validate_and_convert_types ) -from petstore_api.models import xml_item -from petstore_api.models import outer_composite -from petstore_api.models import outer_enum -from petstore_api.models import outer_number -from petstore_api.models import file_schema_test_class -from petstore_api.models import user -from petstore_api.models import client +from petstore_api.model import xml_item +from petstore_api.model import outer_composite +from petstore_api.model import outer_enum +from petstore_api.model import outer_number +from petstore_api.model import file_schema_test_class +from petstore_api.model import user +from petstore_api.model import client class FakeApi(object): 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 863e64beb0b5..be57432ae68d 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 @@ -34,7 +34,7 @@ str, validate_and_convert_types ) -from petstore_api.models import client +from petstore_api.model import client class FakeClassnameTags123Api(object): 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 3d289a669882..6ec1e6d5c5cd 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 @@ -34,8 +34,8 @@ str, validate_and_convert_types ) -from petstore_api.models import pet -from petstore_api.models import api_response +from petstore_api.model import pet +from petstore_api.model import api_response class PetApi(object): 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 bcae5aab2a60..e612a43704f2 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 @@ -34,7 +34,7 @@ str, validate_and_convert_types ) -from petstore_api.models import order +from petstore_api.model import order class StoreApi(object): 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 1362c5e31105..930ae821f2cb 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 @@ -34,7 +34,7 @@ str, validate_and_convert_types ) -from petstore_api.models import user +from petstore_api.model import user class UserApi(object): diff --git a/samples/client/petstore/python-experimental/petstore_api/apis/__init__.py b/samples/client/petstore/python-experimental/petstore_api/apis/__init__.py new file mode 100644 index 000000000000..f309caa3e651 --- /dev/null +++ b/samples/client/petstore/python-experimental/petstore_api/apis/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +# flake8: noqa + +# import all apis into this package +# if you have many ampis here with many many models used in each api this may +# raise a RecursionError +# to avoid this, import only the api that you directly need like: +# from .api.pet_api import PetApi +# or import this package, but before doing it, use: +# import sys +# sys.setrecursionlimit(n) + +# import apis into api package +from petstore_api.api.another_fake_api import AnotherFakeApi +from petstore_api.api.fake_api import FakeApi +from petstore_api.api.fake_classname_tags_123_api import FakeClassnameTags123Api +from petstore_api.api.pet_api import PetApi +from petstore_api.api.store_api import StoreApi +from petstore_api.api.user_api import UserApi diff --git a/samples/client/petstore/python-experimental/petstore_api/model/__init__.py b/samples/client/petstore/python-experimental/petstore_api/model/__init__.py new file mode 100644 index 000000000000..cfe32b784926 --- /dev/null +++ b/samples/client/petstore/python-experimental/petstore_api/model/__init__.py @@ -0,0 +1,5 @@ +# we can not import model classes here because that would create a circular +# reference which would not work in python2 +# do not import all models into this module because that uses a lot of memory and stack frames +# if you need the ability to import all models from one package, import them with +# from {{packageName}.models import ModelA, ModelB diff --git a/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_any_type.py b/samples/client/petstore/python-experimental/petstore_api/model/additional_properties_any_type.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/additional_properties_any_type.py rename to samples/client/petstore/python-experimental/petstore_api/model/additional_properties_any_type.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_array.py b/samples/client/petstore/python-experimental/petstore_api/model/additional_properties_array.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/additional_properties_array.py rename to samples/client/petstore/python-experimental/petstore_api/model/additional_properties_array.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_boolean.py b/samples/client/petstore/python-experimental/petstore_api/model/additional_properties_boolean.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/additional_properties_boolean.py rename to samples/client/petstore/python-experimental/petstore_api/model/additional_properties_boolean.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_class.py b/samples/client/petstore/python-experimental/petstore_api/model/additional_properties_class.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/additional_properties_class.py rename to samples/client/petstore/python-experimental/petstore_api/model/additional_properties_class.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_integer.py b/samples/client/petstore/python-experimental/petstore_api/model/additional_properties_integer.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/additional_properties_integer.py rename to samples/client/petstore/python-experimental/petstore_api/model/additional_properties_integer.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_number.py b/samples/client/petstore/python-experimental/petstore_api/model/additional_properties_number.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/additional_properties_number.py rename to samples/client/petstore/python-experimental/petstore_api/model/additional_properties_number.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_object.py b/samples/client/petstore/python-experimental/petstore_api/model/additional_properties_object.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/additional_properties_object.py rename to samples/client/petstore/python-experimental/petstore_api/model/additional_properties_object.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_string.py b/samples/client/petstore/python-experimental/petstore_api/model/additional_properties_string.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/additional_properties_string.py rename to samples/client/petstore/python-experimental/petstore_api/model/additional_properties_string.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/animal.py b/samples/client/petstore/python-experimental/petstore_api/model/animal.py similarity index 97% rename from samples/client/petstore/python-experimental/petstore_api/models/animal.py rename to samples/client/petstore/python-experimental/petstore_api/model/animal.py index 641c9c16e279..7ba62dad1622 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/animal.py +++ b/samples/client/petstore/python-experimental/petstore_api/model/animal.py @@ -34,15 +34,15 @@ validate_get_composed_info, ) try: - from petstore_api.models import cat + from petstore_api.model import cat except ImportError: cat = sys.modules[ - 'petstore_api.models.cat'] + 'petstore_api.model.cat'] try: - from petstore_api.models import dog + from petstore_api.model import dog except ImportError: dog = sys.modules[ - 'petstore_api.models.dog'] + 'petstore_api.model.dog'] class Animal(ModelNormal): diff --git a/samples/client/petstore/python-experimental/petstore_api/models/api_response.py b/samples/client/petstore/python-experimental/petstore_api/model/api_response.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/api_response.py rename to samples/client/petstore/python-experimental/petstore_api/model/api_response.py 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/model/array_of_array_of_number_only.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/array_of_array_of_number_only.py rename to samples/client/petstore/python-experimental/petstore_api/model/array_of_array_of_number_only.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/array_of_number_only.py b/samples/client/petstore/python-experimental/petstore_api/model/array_of_number_only.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/array_of_number_only.py rename to samples/client/petstore/python-experimental/petstore_api/model/array_of_number_only.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/array_test.py b/samples/client/petstore/python-experimental/petstore_api/model/array_test.py similarity index 98% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/array_test.py rename to samples/client/petstore/python-experimental/petstore_api/model/array_test.py index 0eed8d054611..e2bc76832b27 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/array_test.py +++ b/samples/client/petstore/python-experimental/petstore_api/model/array_test.py @@ -34,10 +34,10 @@ validate_get_composed_info, ) try: - from petstore_api.models import read_only_first + from petstore_api.model import read_only_first except ImportError: read_only_first = sys.modules[ - 'petstore_api.models.read_only_first'] + 'petstore_api.model.read_only_first'] class ArrayTest(ModelNormal): diff --git a/samples/client/petstore/python-experimental/petstore_api/models/capitalization.py b/samples/client/petstore/python-experimental/petstore_api/model/capitalization.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/capitalization.py rename to samples/client/petstore/python-experimental/petstore_api/model/capitalization.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/cat.py b/samples/client/petstore/python-experimental/petstore_api/model/cat.py similarity index 98% rename from samples/client/petstore/python-experimental/petstore_api/models/cat.py rename to samples/client/petstore/python-experimental/petstore_api/model/cat.py index 9620612169bf..b40a97dbab9a 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/cat.py +++ b/samples/client/petstore/python-experimental/petstore_api/model/cat.py @@ -34,15 +34,15 @@ validate_get_composed_info, ) try: - from petstore_api.models import animal + from petstore_api.model import animal except ImportError: animal = sys.modules[ - 'petstore_api.models.animal'] + 'petstore_api.model.animal'] try: - from petstore_api.models import cat_all_of + from petstore_api.model import cat_all_of except ImportError: cat_all_of = sys.modules[ - 'petstore_api.models.cat_all_of'] + 'petstore_api.model.cat_all_of'] class Cat(ModelComposed): diff --git a/samples/client/petstore/python-experimental/petstore_api/models/cat_all_of.py b/samples/client/petstore/python-experimental/petstore_api/model/cat_all_of.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/cat_all_of.py rename to samples/client/petstore/python-experimental/petstore_api/model/cat_all_of.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/category.py b/samples/client/petstore/python-experimental/petstore_api/model/category.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/category.py rename to samples/client/petstore/python-experimental/petstore_api/model/category.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/child.py b/samples/client/petstore/python-experimental/petstore_api/model/child.py similarity index 98% rename from samples/client/petstore/python-experimental/petstore_api/models/child.py rename to samples/client/petstore/python-experimental/petstore_api/model/child.py index 7be69a7d5280..37c138d6a488 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/child.py +++ b/samples/client/petstore/python-experimental/petstore_api/model/child.py @@ -34,15 +34,15 @@ validate_get_composed_info, ) try: - from petstore_api.models import child_all_of + from petstore_api.model import child_all_of except ImportError: child_all_of = sys.modules[ - 'petstore_api.models.child_all_of'] + 'petstore_api.model.child_all_of'] try: - from petstore_api.models import parent + from petstore_api.model import parent except ImportError: parent = sys.modules[ - 'petstore_api.models.parent'] + 'petstore_api.model.parent'] class Child(ModelComposed): diff --git a/samples/client/petstore/python-experimental/petstore_api/models/child_all_of.py b/samples/client/petstore/python-experimental/petstore_api/model/child_all_of.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/child_all_of.py rename to samples/client/petstore/python-experimental/petstore_api/model/child_all_of.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/child_cat.py b/samples/client/petstore/python-experimental/petstore_api/model/child_cat.py similarity index 97% rename from samples/client/petstore/python-experimental/petstore_api/models/child_cat.py rename to samples/client/petstore/python-experimental/petstore_api/model/child_cat.py index 873c3bc76cf7..6d42f11a18ff 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/child_cat.py +++ b/samples/client/petstore/python-experimental/petstore_api/model/child_cat.py @@ -34,15 +34,15 @@ validate_get_composed_info, ) try: - from petstore_api.models import child_cat_all_of + from petstore_api.model import child_cat_all_of except ImportError: child_cat_all_of = sys.modules[ - 'petstore_api.models.child_cat_all_of'] + 'petstore_api.model.child_cat_all_of'] try: - from petstore_api.models import parent_pet + from petstore_api.model import parent_pet except ImportError: parent_pet = sys.modules[ - 'petstore_api.models.parent_pet'] + 'petstore_api.model.parent_pet'] class ChildCat(ModelComposed): diff --git a/samples/client/petstore/python-experimental/petstore_api/models/child_cat_all_of.py b/samples/client/petstore/python-experimental/petstore_api/model/child_cat_all_of.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/child_cat_all_of.py rename to samples/client/petstore/python-experimental/petstore_api/model/child_cat_all_of.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/child_dog.py b/samples/client/petstore/python-experimental/petstore_api/model/child_dog.py similarity index 97% rename from samples/client/petstore/python-experimental/petstore_api/models/child_dog.py rename to samples/client/petstore/python-experimental/petstore_api/model/child_dog.py index a49f042cf74d..b7a93571a6a0 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/child_dog.py +++ b/samples/client/petstore/python-experimental/petstore_api/model/child_dog.py @@ -34,15 +34,15 @@ validate_get_composed_info, ) try: - from petstore_api.models import child_dog_all_of + from petstore_api.model import child_dog_all_of except ImportError: child_dog_all_of = sys.modules[ - 'petstore_api.models.child_dog_all_of'] + 'petstore_api.model.child_dog_all_of'] try: - from petstore_api.models import parent_pet + from petstore_api.model import parent_pet except ImportError: parent_pet = sys.modules[ - 'petstore_api.models.parent_pet'] + 'petstore_api.model.parent_pet'] class ChildDog(ModelComposed): diff --git a/samples/client/petstore/python-experimental/petstore_api/models/child_dog_all_of.py b/samples/client/petstore/python-experimental/petstore_api/model/child_dog_all_of.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/child_dog_all_of.py rename to samples/client/petstore/python-experimental/petstore_api/model/child_dog_all_of.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/child_lizard.py b/samples/client/petstore/python-experimental/petstore_api/model/child_lizard.py similarity index 97% rename from samples/client/petstore/python-experimental/petstore_api/models/child_lizard.py rename to samples/client/petstore/python-experimental/petstore_api/model/child_lizard.py index 0f11243a2493..978fea14a183 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/child_lizard.py +++ b/samples/client/petstore/python-experimental/petstore_api/model/child_lizard.py @@ -34,15 +34,15 @@ validate_get_composed_info, ) try: - from petstore_api.models import child_lizard_all_of + from petstore_api.model import child_lizard_all_of except ImportError: child_lizard_all_of = sys.modules[ - 'petstore_api.models.child_lizard_all_of'] + 'petstore_api.model.child_lizard_all_of'] try: - from petstore_api.models import parent_pet + from petstore_api.model import parent_pet except ImportError: parent_pet = sys.modules[ - 'petstore_api.models.parent_pet'] + 'petstore_api.model.parent_pet'] class ChildLizard(ModelComposed): diff --git a/samples/client/petstore/python-experimental/petstore_api/models/child_lizard_all_of.py b/samples/client/petstore/python-experimental/petstore_api/model/child_lizard_all_of.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/child_lizard_all_of.py rename to samples/client/petstore/python-experimental/petstore_api/model/child_lizard_all_of.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/class_model.py b/samples/client/petstore/python-experimental/petstore_api/model/class_model.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/class_model.py rename to samples/client/petstore/python-experimental/petstore_api/model/class_model.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/client.py b/samples/client/petstore/python-experimental/petstore_api/model/client.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/client.py rename to samples/client/petstore/python-experimental/petstore_api/model/client.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/dog.py b/samples/client/petstore/python-experimental/petstore_api/model/dog.py similarity index 98% rename from samples/client/petstore/python-experimental/petstore_api/models/dog.py rename to samples/client/petstore/python-experimental/petstore_api/model/dog.py index f9b93eebc78f..547eba90c2b1 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/dog.py +++ b/samples/client/petstore/python-experimental/petstore_api/model/dog.py @@ -34,15 +34,15 @@ validate_get_composed_info, ) try: - from petstore_api.models import animal + from petstore_api.model import animal except ImportError: animal = sys.modules[ - 'petstore_api.models.animal'] + 'petstore_api.model.animal'] try: - from petstore_api.models import dog_all_of + from petstore_api.model import dog_all_of except ImportError: dog_all_of = sys.modules[ - 'petstore_api.models.dog_all_of'] + 'petstore_api.model.dog_all_of'] class Dog(ModelComposed): diff --git a/samples/client/petstore/python-experimental/petstore_api/models/dog_all_of.py b/samples/client/petstore/python-experimental/petstore_api/model/dog_all_of.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/dog_all_of.py rename to samples/client/petstore/python-experimental/petstore_api/model/dog_all_of.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/enum_arrays.py b/samples/client/petstore/python-experimental/petstore_api/model/enum_arrays.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/enum_arrays.py rename to samples/client/petstore/python-experimental/petstore_api/model/enum_arrays.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/enum_class.py b/samples/client/petstore/python-experimental/petstore_api/model/enum_class.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/enum_class.py rename to samples/client/petstore/python-experimental/petstore_api/model/enum_class.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/enum_test.py b/samples/client/petstore/python-experimental/petstore_api/model/enum_test.py similarity index 98% rename from samples/client/petstore/python-experimental/petstore_api/models/enum_test.py rename to samples/client/petstore/python-experimental/petstore_api/model/enum_test.py index 71cf60fd4823..bc0d1025261f 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/enum_test.py +++ b/samples/client/petstore/python-experimental/petstore_api/model/enum_test.py @@ -34,10 +34,10 @@ validate_get_composed_info, ) try: - from petstore_api.models import outer_enum + from petstore_api.model import outer_enum except ImportError: outer_enum = sys.modules[ - 'petstore_api.models.outer_enum'] + 'petstore_api.model.outer_enum'] class EnumTest(ModelNormal): diff --git a/samples/client/petstore/python-experimental/petstore_api/models/file.py b/samples/client/petstore/python-experimental/petstore_api/model/file.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/file.py rename to samples/client/petstore/python-experimental/petstore_api/model/file.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/file_schema_test_class.py b/samples/client/petstore/python-experimental/petstore_api/model/file_schema_test_class.py similarity index 98% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/file_schema_test_class.py rename to samples/client/petstore/python-experimental/petstore_api/model/file_schema_test_class.py index 79e5638ccc94..0a9471e9e420 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/file_schema_test_class.py +++ b/samples/client/petstore/python-experimental/petstore_api/model/file_schema_test_class.py @@ -34,10 +34,10 @@ validate_get_composed_info, ) try: - from petstore_api.models import file + from petstore_api.model import file except ImportError: file = sys.modules[ - 'petstore_api.models.file'] + 'petstore_api.model.file'] class FileSchemaTestClass(ModelNormal): diff --git a/samples/client/petstore/python-experimental/petstore_api/models/format_test.py b/samples/client/petstore/python-experimental/petstore_api/model/format_test.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/format_test.py rename to samples/client/petstore/python-experimental/petstore_api/model/format_test.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/grandparent.py b/samples/client/petstore/python-experimental/petstore_api/model/grandparent.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/grandparent.py rename to samples/client/petstore/python-experimental/petstore_api/model/grandparent.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/grandparent_animal.py b/samples/client/petstore/python-experimental/petstore_api/model/grandparent_animal.py similarity index 95% rename from samples/client/petstore/python-experimental/petstore_api/models/grandparent_animal.py rename to samples/client/petstore/python-experimental/petstore_api/model/grandparent_animal.py index 54dc5be641d7..81947e1c497d 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/grandparent_animal.py +++ b/samples/client/petstore/python-experimental/petstore_api/model/grandparent_animal.py @@ -34,25 +34,25 @@ validate_get_composed_info, ) try: - from petstore_api.models import child_cat + from petstore_api.model import child_cat except ImportError: child_cat = sys.modules[ - 'petstore_api.models.child_cat'] + 'petstore_api.model.child_cat'] try: - from petstore_api.models import child_dog + from petstore_api.model import child_dog except ImportError: child_dog = sys.modules[ - 'petstore_api.models.child_dog'] + 'petstore_api.model.child_dog'] try: - from petstore_api.models import child_lizard + from petstore_api.model import child_lizard except ImportError: child_lizard = sys.modules[ - 'petstore_api.models.child_lizard'] + 'petstore_api.model.child_lizard'] try: - from petstore_api.models import parent_pet + from petstore_api.model import parent_pet except ImportError: parent_pet = sys.modules[ - 'petstore_api.models.parent_pet'] + 'petstore_api.model.parent_pet'] class GrandparentAnimal(ModelNormal): diff --git a/samples/client/petstore/python-experimental/petstore_api/models/has_only_read_only.py b/samples/client/petstore/python-experimental/petstore_api/model/has_only_read_only.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/has_only_read_only.py rename to samples/client/petstore/python-experimental/petstore_api/model/has_only_read_only.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/list.py b/samples/client/petstore/python-experimental/petstore_api/model/list.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/list.py rename to samples/client/petstore/python-experimental/petstore_api/model/list.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/map_test.py b/samples/client/petstore/python-experimental/petstore_api/model/map_test.py similarity index 98% rename from samples/client/petstore/python-experimental/petstore_api/models/map_test.py rename to samples/client/petstore/python-experimental/petstore_api/model/map_test.py index 45be8a1fecfd..a22af06ce4fd 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/map_test.py +++ b/samples/client/petstore/python-experimental/petstore_api/model/map_test.py @@ -34,10 +34,10 @@ validate_get_composed_info, ) try: - from petstore_api.models import string_boolean_map + from petstore_api.model import string_boolean_map except ImportError: string_boolean_map = sys.modules[ - 'petstore_api.models.string_boolean_map'] + 'petstore_api.model.string_boolean_map'] class MapTest(ModelNormal): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/mixed_properties_and_additional_properties_class.py b/samples/client/petstore/python-experimental/petstore_api/model/mixed_properties_and_additional_properties_class.py similarity index 98% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/mixed_properties_and_additional_properties_class.py rename to samples/client/petstore/python-experimental/petstore_api/model/mixed_properties_and_additional_properties_class.py index 0e584ebd43e9..a0fcac2eb019 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/mixed_properties_and_additional_properties_class.py +++ b/samples/client/petstore/python-experimental/petstore_api/model/mixed_properties_and_additional_properties_class.py @@ -34,10 +34,10 @@ validate_get_composed_info, ) try: - from petstore_api.models import animal + from petstore_api.model import animal except ImportError: animal = sys.modules[ - 'petstore_api.models.animal'] + 'petstore_api.model.animal'] class MixedPropertiesAndAdditionalPropertiesClass(ModelNormal): diff --git a/samples/client/petstore/python-experimental/petstore_api/models/model200_response.py b/samples/client/petstore/python-experimental/petstore_api/model/model200_response.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/model200_response.py rename to samples/client/petstore/python-experimental/petstore_api/model/model200_response.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/model_return.py b/samples/client/petstore/python-experimental/petstore_api/model/model_return.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/model_return.py rename to samples/client/petstore/python-experimental/petstore_api/model/model_return.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/name.py b/samples/client/petstore/python-experimental/petstore_api/model/name.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/name.py rename to samples/client/petstore/python-experimental/petstore_api/model/name.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/number_only.py b/samples/client/petstore/python-experimental/petstore_api/model/number_only.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/number_only.py rename to samples/client/petstore/python-experimental/petstore_api/model/number_only.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/order.py b/samples/client/petstore/python-experimental/petstore_api/model/order.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/order.py rename to samples/client/petstore/python-experimental/petstore_api/model/order.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/outer_composite.py b/samples/client/petstore/python-experimental/petstore_api/model/outer_composite.py similarity index 98% rename from samples/client/petstore/python-experimental/petstore_api/models/outer_composite.py rename to samples/client/petstore/python-experimental/petstore_api/model/outer_composite.py index a64cbe37592c..5614b9afe422 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/outer_composite.py +++ b/samples/client/petstore/python-experimental/petstore_api/model/outer_composite.py @@ -34,10 +34,10 @@ validate_get_composed_info, ) try: - from petstore_api.models import outer_number + from petstore_api.model import outer_number except ImportError: outer_number = sys.modules[ - 'petstore_api.models.outer_number'] + 'petstore_api.model.outer_number'] class OuterComposite(ModelNormal): diff --git a/samples/client/petstore/python-experimental/petstore_api/models/outer_enum.py b/samples/client/petstore/python-experimental/petstore_api/model/outer_enum.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/outer_enum.py rename to samples/client/petstore/python-experimental/petstore_api/model/outer_enum.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/outer_number.py b/samples/client/petstore/python-experimental/petstore_api/model/outer_number.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/outer_number.py rename to samples/client/petstore/python-experimental/petstore_api/model/outer_number.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/parent.py b/samples/client/petstore/python-experimental/petstore_api/model/parent.py similarity index 97% rename from samples/client/petstore/python-experimental/petstore_api/models/parent.py rename to samples/client/petstore/python-experimental/petstore_api/model/parent.py index 5d33beb6979d..a855a3ffd014 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/parent.py +++ b/samples/client/petstore/python-experimental/petstore_api/model/parent.py @@ -34,15 +34,15 @@ validate_get_composed_info, ) try: - from petstore_api.models import grandparent + from petstore_api.model import grandparent except ImportError: grandparent = sys.modules[ - 'petstore_api.models.grandparent'] + 'petstore_api.model.grandparent'] try: - from petstore_api.models import parent_all_of + from petstore_api.model import parent_all_of except ImportError: parent_all_of = sys.modules[ - 'petstore_api.models.parent_all_of'] + 'petstore_api.model.parent_all_of'] class Parent(ModelComposed): diff --git a/samples/client/petstore/python-experimental/petstore_api/models/parent_all_of.py b/samples/client/petstore/python-experimental/petstore_api/model/parent_all_of.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/parent_all_of.py rename to samples/client/petstore/python-experimental/petstore_api/model/parent_all_of.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/parent_pet.py b/samples/client/petstore/python-experimental/petstore_api/model/parent_pet.py similarity index 96% rename from samples/client/petstore/python-experimental/petstore_api/models/parent_pet.py rename to samples/client/petstore/python-experimental/petstore_api/model/parent_pet.py index 4635ac947806..0b0b30c656f5 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/parent_pet.py +++ b/samples/client/petstore/python-experimental/petstore_api/model/parent_pet.py @@ -34,25 +34,25 @@ validate_get_composed_info, ) try: - from petstore_api.models import child_cat + from petstore_api.model import child_cat except ImportError: child_cat = sys.modules[ - 'petstore_api.models.child_cat'] + 'petstore_api.model.child_cat'] try: - from petstore_api.models import child_dog + from petstore_api.model import child_dog except ImportError: child_dog = sys.modules[ - 'petstore_api.models.child_dog'] + 'petstore_api.model.child_dog'] try: - from petstore_api.models import child_lizard + from petstore_api.model import child_lizard except ImportError: child_lizard = sys.modules[ - 'petstore_api.models.child_lizard'] + 'petstore_api.model.child_lizard'] try: - from petstore_api.models import grandparent_animal + from petstore_api.model import grandparent_animal except ImportError: grandparent_animal = sys.modules[ - 'petstore_api.models.grandparent_animal'] + 'petstore_api.model.grandparent_animal'] class ParentPet(ModelComposed): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/pet.py b/samples/client/petstore/python-experimental/petstore_api/model/pet.py similarity index 97% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/pet.py rename to samples/client/petstore/python-experimental/petstore_api/model/pet.py index c93acd53c96c..742d7cdf04a8 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/pet.py +++ b/samples/client/petstore/python-experimental/petstore_api/model/pet.py @@ -34,15 +34,15 @@ validate_get_composed_info, ) try: - from petstore_api.models import category + from petstore_api.model import category except ImportError: category = sys.modules[ - 'petstore_api.models.category'] + 'petstore_api.model.category'] try: - from petstore_api.models import tag + from petstore_api.model import tag except ImportError: tag = sys.modules[ - 'petstore_api.models.tag'] + 'petstore_api.model.tag'] class Pet(ModelNormal): diff --git a/samples/client/petstore/python-experimental/petstore_api/models/player.py b/samples/client/petstore/python-experimental/petstore_api/model/player.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/player.py rename to samples/client/petstore/python-experimental/petstore_api/model/player.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/read_only_first.py b/samples/client/petstore/python-experimental/petstore_api/model/read_only_first.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/read_only_first.py rename to samples/client/petstore/python-experimental/petstore_api/model/read_only_first.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/special_model_name.py b/samples/client/petstore/python-experimental/petstore_api/model/special_model_name.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/special_model_name.py rename to samples/client/petstore/python-experimental/petstore_api/model/special_model_name.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/string_boolean_map.py b/samples/client/petstore/python-experimental/petstore_api/model/string_boolean_map.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/string_boolean_map.py rename to samples/client/petstore/python-experimental/petstore_api/model/string_boolean_map.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/tag.py b/samples/client/petstore/python-experimental/petstore_api/model/tag.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/tag.py rename to samples/client/petstore/python-experimental/petstore_api/model/tag.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/type_holder_default.py b/samples/client/petstore/python-experimental/petstore_api/model/type_holder_default.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/type_holder_default.py rename to samples/client/petstore/python-experimental/petstore_api/model/type_holder_default.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/type_holder_example.py b/samples/client/petstore/python-experimental/petstore_api/model/type_holder_example.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/type_holder_example.py rename to samples/client/petstore/python-experimental/petstore_api/model/type_holder_example.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/user.py b/samples/client/petstore/python-experimental/petstore_api/model/user.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/user.py rename to samples/client/petstore/python-experimental/petstore_api/model/user.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/xml_item.py b/samples/client/petstore/python-experimental/petstore_api/model/xml_item.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/xml_item.py rename to samples/client/petstore/python-experimental/petstore_api/model/xml_item.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/__init__.py b/samples/client/petstore/python-experimental/petstore_api/models/__init__.py index e02c66519259..51bdb1a85a57 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/__init__.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/__init__.py @@ -1,15 +1,75 @@ # coding: utf-8 # flake8: noqa -""" - 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 +# import all models into this package +# if you have many models here with many references from one model to another this may +# raise a RecursionError +# to avoid this, import only the models that you directly need like: +# from from petstore_api.model.pet import Pet +# or import this package, but before doing it, use: +# import sys +# sys.setrecursionlimit(n) - The version of the OpenAPI document: 1.0.0 - Generated by: https://openapi-generator.tech -""" - - -# we can not import model classes here because that would create a circular -# reference which would not work in python2 +from petstore_api.model.additional_properties_any_type import AdditionalPropertiesAnyType +from petstore_api.model.additional_properties_array import AdditionalPropertiesArray +from petstore_api.model.additional_properties_boolean import AdditionalPropertiesBoolean +from petstore_api.model.additional_properties_class import AdditionalPropertiesClass +from petstore_api.model.additional_properties_integer import AdditionalPropertiesInteger +from petstore_api.model.additional_properties_number import AdditionalPropertiesNumber +from petstore_api.model.additional_properties_object import AdditionalPropertiesObject +from petstore_api.model.additional_properties_string import AdditionalPropertiesString +from petstore_api.model.animal import Animal +from petstore_api.model.api_response import ApiResponse +from petstore_api.model.array_of_array_of_number_only import ArrayOfArrayOfNumberOnly +from petstore_api.model.array_of_number_only import ArrayOfNumberOnly +from petstore_api.model.array_test import ArrayTest +from petstore_api.model.capitalization import Capitalization +from petstore_api.model.cat import Cat +from petstore_api.model.cat_all_of import CatAllOf +from petstore_api.model.category import Category +from petstore_api.model.child import Child +from petstore_api.model.child_all_of import ChildAllOf +from petstore_api.model.child_cat import ChildCat +from petstore_api.model.child_cat_all_of import ChildCatAllOf +from petstore_api.model.child_dog import ChildDog +from petstore_api.model.child_dog_all_of import ChildDogAllOf +from petstore_api.model.child_lizard import ChildLizard +from petstore_api.model.child_lizard_all_of import ChildLizardAllOf +from petstore_api.model.class_model import ClassModel +from petstore_api.model.client import Client +from petstore_api.model.dog import Dog +from petstore_api.model.dog_all_of import DogAllOf +from petstore_api.model.enum_arrays import EnumArrays +from petstore_api.model.enum_class import EnumClass +from petstore_api.model.enum_test import EnumTest +from petstore_api.model.file import File +from petstore_api.model.file_schema_test_class import FileSchemaTestClass +from petstore_api.model.format_test import FormatTest +from petstore_api.model.grandparent import Grandparent +from petstore_api.model.grandparent_animal import GrandparentAnimal +from petstore_api.model.has_only_read_only import HasOnlyReadOnly +from petstore_api.model.list import List +from petstore_api.model.map_test import MapTest +from petstore_api.model.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass +from petstore_api.model.model200_response import Model200Response +from petstore_api.model.model_return import ModelReturn +from petstore_api.model.name import Name +from petstore_api.model.number_only import NumberOnly +from petstore_api.model.order import Order +from petstore_api.model.outer_composite import OuterComposite +from petstore_api.model.outer_enum import OuterEnum +from petstore_api.model.outer_number import OuterNumber +from petstore_api.model.parent import Parent +from petstore_api.model.parent_all_of import ParentAllOf +from petstore_api.model.parent_pet import ParentPet +from petstore_api.model.pet import Pet +from petstore_api.model.player import Player +from petstore_api.model.read_only_first import ReadOnlyFirst +from petstore_api.model.special_model_name import SpecialModelName +from petstore_api.model.string_boolean_map import StringBooleanMap +from petstore_api.model.tag import Tag +from petstore_api.model.type_holder_default import TypeHolderDefault +from petstore_api.model.type_holder_example import TypeHolderExample +from petstore_api.model.user import User +from petstore_api.model.xml_item import XmlItem diff --git a/samples/client/petstore/python-experimental/test/test_additional_properties_any_type.py b/samples/client/petstore/python-experimental/test/test_additional_properties_any_type.py index 4b6739a1faf3..ce985f76ed9e 100644 --- a/samples/client/petstore/python-experimental/test/test_additional_properties_any_type.py +++ b/samples/client/petstore/python-experimental/test/test_additional_properties_any_type.py @@ -5,18 +5,17 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.additional_properties_any_type import AdditionalPropertiesAnyType # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.model.additional_properties_any_type import AdditionalPropertiesAnyType class TestAdditionalPropertiesAnyType(unittest.TestCase): @@ -31,7 +30,7 @@ def tearDown(self): def testAdditionalPropertiesAnyType(self): """Test AdditionalPropertiesAnyType""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.additional_properties_any_type.AdditionalPropertiesAnyType() # noqa: E501 + # model = AdditionalPropertiesAnyType() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_additional_properties_array.py b/samples/client/petstore/python-experimental/test/test_additional_properties_array.py index 6c86292cd4a4..f63ca82f6c22 100644 --- a/samples/client/petstore/python-experimental/test/test_additional_properties_array.py +++ b/samples/client/petstore/python-experimental/test/test_additional_properties_array.py @@ -5,21 +5,17 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.additional_properties_array import AdditionalPropertiesArray # noqa: E501 -from petstore_api.rest import ApiException -from petstore_api.exceptions import ApiTypeError - -import datetime +from petstore_api.model.additional_properties_array import AdditionalPropertiesArray class TestAdditionalPropertiesArray(unittest.TestCase): @@ -37,6 +33,7 @@ def testAdditionalPropertiesArray(self): model = AdditionalPropertiesArray() # can make one with additional properties + import datetime some_val = [] model = AdditionalPropertiesArray(some_key=some_val) assert model['some_key'] == some_val @@ -45,7 +42,7 @@ def testAdditionalPropertiesArray(self): assert model['some_key'] == some_val # type checking works on additional properties - with self.assertRaises(ApiTypeError) as exc: + with self.assertRaises(petstore_api.ApiTypeError) as exc: model = AdditionalPropertiesArray(some_key='some string') diff --git a/samples/client/petstore/python-experimental/test/test_additional_properties_boolean.py b/samples/client/petstore/python-experimental/test/test_additional_properties_boolean.py index 33bcfb90bb61..e5a13891c098 100644 --- a/samples/client/petstore/python-experimental/test/test_additional_properties_boolean.py +++ b/samples/client/petstore/python-experimental/test/test_additional_properties_boolean.py @@ -5,19 +5,17 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.additional_properties_boolean import AdditionalPropertiesBoolean # noqa: E501 -from petstore_api.rest import ApiException -from petstore_api.exceptions import ApiTypeError +from petstore_api.model.additional_properties_boolean import AdditionalPropertiesBoolean class TestAdditionalPropertiesBoolean(unittest.TestCase): @@ -39,7 +37,7 @@ def testAdditionalPropertiesBoolean(self): assert model['some_key'] == True # type checking works on additional properties - with self.assertRaises(ApiTypeError) as exc: + with self.assertRaises(petstore_api.ApiTypeError) as exc: model = AdditionalPropertiesBoolean(some_key='True') diff --git a/samples/client/petstore/python-experimental/test/test_additional_properties_class.py b/samples/client/petstore/python-experimental/test/test_additional_properties_class.py index fc9df3bbb505..befc14455da2 100644 --- a/samples/client/petstore/python-experimental/test/test_additional_properties_class.py +++ b/samples/client/petstore/python-experimental/test/test_additional_properties_class.py @@ -5,18 +5,17 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.additional_properties_class import AdditionalPropertiesClass # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.model.additional_properties_class import AdditionalPropertiesClass class TestAdditionalPropertiesClass(unittest.TestCase): @@ -31,7 +30,7 @@ def tearDown(self): def testAdditionalPropertiesClass(self): """Test AdditionalPropertiesClass""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.additional_properties_class.AdditionalPropertiesClass() # noqa: E501 + # model = AdditionalPropertiesClass() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_additional_properties_integer.py b/samples/client/petstore/python-experimental/test/test_additional_properties_integer.py index 0029cb9c84c5..0e08b8f87706 100644 --- a/samples/client/petstore/python-experimental/test/test_additional_properties_integer.py +++ b/samples/client/petstore/python-experimental/test/test_additional_properties_integer.py @@ -5,19 +5,17 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.additional_properties_integer import AdditionalPropertiesInteger # noqa: E501 -from petstore_api.rest import ApiException -from petstore_api.exceptions import ApiTypeError +from petstore_api.model.additional_properties_integer import AdditionalPropertiesInteger class TestAdditionalPropertiesInteger(unittest.TestCase): @@ -39,7 +37,7 @@ def testAdditionalPropertiesInteger(self): assert model['some_key'] == 3 # type checking works on additional properties - with self.assertRaises(ApiTypeError) as exc: + with self.assertRaises(petstore_api.ApiTypeError) as exc: model = AdditionalPropertiesInteger(some_key=11.3) diff --git a/samples/client/petstore/python-experimental/test/test_additional_properties_number.py b/samples/client/petstore/python-experimental/test/test_additional_properties_number.py index 28d0b23377a6..90f4429e989f 100644 --- a/samples/client/petstore/python-experimental/test/test_additional_properties_number.py +++ b/samples/client/petstore/python-experimental/test/test_additional_properties_number.py @@ -5,19 +5,17 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.additional_properties_number import AdditionalPropertiesNumber # noqa: E501 -from petstore_api.rest import ApiException -from petstore_api.exceptions import ApiTypeError +from petstore_api.model.additional_properties_number import AdditionalPropertiesNumber class TestAdditionalPropertiesNumber(unittest.TestCase): @@ -39,8 +37,9 @@ def testAdditionalPropertiesNumber(self): assert model['some_key'] == 11.3 # type checking works on additional properties - with self.assertRaises(ApiTypeError) as exc: + with self.assertRaises(petstore_api.ApiTypeError) as exc: model = AdditionalPropertiesNumber(some_key=10) + if __name__ == '__main__': unittest.main() diff --git a/samples/client/petstore/python-experimental/test/test_additional_properties_object.py b/samples/client/petstore/python-experimental/test/test_additional_properties_object.py index 3d135116736c..ded4a8e8a124 100644 --- a/samples/client/petstore/python-experimental/test/test_additional_properties_object.py +++ b/samples/client/petstore/python-experimental/test/test_additional_properties_object.py @@ -5,21 +5,17 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.additional_properties_object import AdditionalPropertiesObject # noqa: E501 -from petstore_api.rest import ApiException -from petstore_api.exceptions import ApiTypeError - -import datetime +from petstore_api.model.additional_properties_object import AdditionalPropertiesObject class TestAdditionalPropertiesObject(unittest.TestCase): @@ -40,12 +36,13 @@ def testAdditionalPropertiesObject(self): some_val = {} model = AdditionalPropertiesObject(some_key=some_val) assert model['some_key'] == some_val + import datetime some_val = {'a': True, 'b': datetime.date(1970,1,1), 'c': datetime.datetime(1970,1,1), 'd': {}, 'e': 3.1, 'f': 1, 'g': [], 'h': 'hello'} model = AdditionalPropertiesObject(some_key=some_val) assert model['some_key'] == some_val # type checking works on additional properties - with self.assertRaises(ApiTypeError) as exc: + with self.assertRaises(petstore_api.ApiTypeError) as exc: model = AdditionalPropertiesObject(some_key='some string') diff --git a/samples/client/petstore/python-experimental/test/test_additional_properties_string.py b/samples/client/petstore/python-experimental/test/test_additional_properties_string.py index 0276334ead53..cff2c31921fe 100644 --- a/samples/client/petstore/python-experimental/test/test_additional_properties_string.py +++ b/samples/client/petstore/python-experimental/test/test_additional_properties_string.py @@ -5,19 +5,17 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.additional_properties_string import AdditionalPropertiesString # noqa: E501 -from petstore_api.rest import ApiException -from petstore_api.exceptions import ApiTypeError +from petstore_api.model.additional_properties_string import AdditionalPropertiesString class TestAdditionalPropertiesString(unittest.TestCase): @@ -39,7 +37,7 @@ def testAdditionalPropertiesString(self): assert model['some_key'] == 'some_val' # type checking works on additional properties - with self.assertRaises(ApiTypeError) as exc: + with self.assertRaises(petstore_api.ApiTypeError) as exc: model = AdditionalPropertiesString(some_key=True) diff --git a/samples/client/petstore/python-experimental/test/test_animal.py b/samples/client/petstore/python-experimental/test/test_animal.py index 179f1fbd0e52..958f303f13e3 100644 --- a/samples/client/petstore/python-experimental/test/test_animal.py +++ b/samples/client/petstore/python-experimental/test/test_animal.py @@ -5,18 +5,27 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.animal import Animal # noqa: E501 -from petstore_api.rest import ApiException +try: + from petstore_api.model import cat +except ImportError: + cat = sys.modules[ + 'petstore_api.model.cat'] +try: + from petstore_api.model import dog +except ImportError: + dog = sys.modules[ + 'petstore_api.model.dog'] +from petstore_api.model.animal import Animal class TestAnimal(unittest.TestCase): @@ -31,7 +40,7 @@ def tearDown(self): def testAnimal(self): """Test Animal""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.animal.Animal() # noqa: E501 + # model = Animal() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_another_fake_api.py b/samples/client/petstore/python-experimental/test/test_another_fake_api.py index 4b80dc4eda52..f79966a26961 100644 --- a/samples/client/petstore/python-experimental/test/test_another_fake_api.py +++ b/samples/client/petstore/python-experimental/test/test_another_fake_api.py @@ -5,7 +5,7 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ @@ -16,20 +16,19 @@ import petstore_api from petstore_api.api.another_fake_api import AnotherFakeApi # noqa: E501 -from petstore_api.rest import ApiException class TestAnotherFakeApi(unittest.TestCase): """AnotherFakeApi unit test stubs""" def setUp(self): - self.api = petstore_api.api.another_fake_api.AnotherFakeApi() # noqa: E501 + self.api = AnotherFakeApi() # noqa: E501 def tearDown(self): pass - def test_test_special_tags(self): - """Test case for test_special_tags + def test_call_123_test_special_tags(self): + """Test case for call_123_test_special_tags To test special tags # noqa: E501 """ diff --git a/samples/client/petstore/python-experimental/test/test_api_response.py b/samples/client/petstore/python-experimental/test/test_api_response.py index 5031b458a0db..9db92633f626 100644 --- a/samples/client/petstore/python-experimental/test/test_api_response.py +++ b/samples/client/petstore/python-experimental/test/test_api_response.py @@ -5,18 +5,17 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.api_response import ApiResponse # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.model.api_response import ApiResponse class TestApiResponse(unittest.TestCase): @@ -31,7 +30,7 @@ def tearDown(self): def testApiResponse(self): """Test ApiResponse""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.api_response.ApiResponse() # noqa: E501 + # model = ApiResponse() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_array_of_array_of_number_only.py b/samples/client/petstore/python-experimental/test/test_array_of_array_of_number_only.py index a02233045421..4980ad17afb5 100644 --- a/samples/client/petstore/python-experimental/test/test_array_of_array_of_number_only.py +++ b/samples/client/petstore/python-experimental/test/test_array_of_array_of_number_only.py @@ -5,18 +5,17 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.array_of_array_of_number_only import ArrayOfArrayOfNumberOnly # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.model.array_of_array_of_number_only import ArrayOfArrayOfNumberOnly class TestArrayOfArrayOfNumberOnly(unittest.TestCase): @@ -31,7 +30,7 @@ def tearDown(self): def testArrayOfArrayOfNumberOnly(self): """Test ArrayOfArrayOfNumberOnly""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.array_of_array_of_number_only.ArrayOfArrayOfNumberOnly() # noqa: E501 + # model = ArrayOfArrayOfNumberOnly() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_array_of_number_only.py b/samples/client/petstore/python-experimental/test/test_array_of_number_only.py index 1a928bf7d2e0..479c537cada7 100644 --- a/samples/client/petstore/python-experimental/test/test_array_of_number_only.py +++ b/samples/client/petstore/python-experimental/test/test_array_of_number_only.py @@ -5,18 +5,17 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.array_of_number_only import ArrayOfNumberOnly # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.model.array_of_number_only import ArrayOfNumberOnly class TestArrayOfNumberOnly(unittest.TestCase): @@ -31,7 +30,7 @@ def tearDown(self): def testArrayOfNumberOnly(self): """Test ArrayOfNumberOnly""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.array_of_number_only.ArrayOfNumberOnly() # noqa: E501 + # model = ArrayOfNumberOnly() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_array_test.py b/samples/client/petstore/python-experimental/test/test_array_test.py index c56b77b77ee3..2426b27b7e46 100644 --- a/samples/client/petstore/python-experimental/test/test_array_test.py +++ b/samples/client/petstore/python-experimental/test/test_array_test.py @@ -5,18 +5,22 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.array_test import ArrayTest # noqa: E501 -from petstore_api.rest import ApiException +try: + from petstore_api.model import read_only_first +except ImportError: + read_only_first = sys.modules[ + 'petstore_api.model.read_only_first'] +from petstore_api.model.array_test import ArrayTest class TestArrayTest(unittest.TestCase): @@ -31,7 +35,7 @@ def tearDown(self): def testArrayTest(self): """Test ArrayTest""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.array_test.ArrayTest() # noqa: E501 + # model = ArrayTest() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_capitalization.py b/samples/client/petstore/python-experimental/test/test_capitalization.py index 2ae7725b3f09..20d2649c01eb 100644 --- a/samples/client/petstore/python-experimental/test/test_capitalization.py +++ b/samples/client/petstore/python-experimental/test/test_capitalization.py @@ -5,18 +5,17 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.capitalization import Capitalization # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.model.capitalization import Capitalization class TestCapitalization(unittest.TestCase): @@ -31,7 +30,7 @@ def tearDown(self): def testCapitalization(self): """Test Capitalization""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.capitalization.Capitalization() # noqa: E501 + # model = Capitalization() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_cat.py b/samples/client/petstore/python-experimental/test/test_cat.py index 5ebd7908d2db..64b525aaf118 100644 --- a/samples/client/petstore/python-experimental/test/test_cat.py +++ b/samples/client/petstore/python-experimental/test/test_cat.py @@ -5,18 +5,27 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.cat import Cat # noqa: E501 -from petstore_api.rest import ApiException +try: + from petstore_api.model import animal +except ImportError: + animal = sys.modules[ + 'petstore_api.model.animal'] +try: + from petstore_api.model import cat_all_of +except ImportError: + cat_all_of = sys.modules[ + 'petstore_api.model.cat_all_of'] +from petstore_api.model.cat import Cat class TestCat(unittest.TestCase): @@ -31,7 +40,7 @@ def tearDown(self): def testCat(self): """Test Cat""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.cat.Cat() # noqa: E501 + # model = Cat() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_cat_all_of.py b/samples/client/petstore/python-experimental/test/test_cat_all_of.py index 531443380c6e..a5bb91ac864e 100644 --- a/samples/client/petstore/python-experimental/test/test_cat_all_of.py +++ b/samples/client/petstore/python-experimental/test/test_cat_all_of.py @@ -5,18 +5,17 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.cat_all_of import CatAllOf # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.model.cat_all_of import CatAllOf class TestCatAllOf(unittest.TestCase): @@ -31,7 +30,7 @@ def tearDown(self): def testCatAllOf(self): """Test CatAllOf""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.cat_all_of.CatAllOf() # noqa: E501 + # model = CatAllOf() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_category.py b/samples/client/petstore/python-experimental/test/test_category.py index 6a592521281e..59b64e5924a8 100644 --- a/samples/client/petstore/python-experimental/test/test_category.py +++ b/samples/client/petstore/python-experimental/test/test_category.py @@ -5,18 +5,17 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.category import Category # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.model.category import Category class TestCategory(unittest.TestCase): @@ -31,7 +30,7 @@ def tearDown(self): def testCategory(self): """Test Category""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.category.Category() # noqa: E501 + # model = Category() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_child.py b/samples/client/petstore/python-experimental/test/test_child.py index 660cfe637d96..51c0bb129d24 100644 --- a/samples/client/petstore/python-experimental/test/test_child.py +++ b/samples/client/petstore/python-experimental/test/test_child.py @@ -11,10 +11,21 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import child_all_of +except ImportError: + child_all_of = sys.modules[ + 'petstore_api.model.child_all_of'] +try: + from petstore_api.model import parent +except ImportError: + parent = sys.modules[ + 'petstore_api.model.parent'] +from petstore_api.model.child import Child class TestChild(unittest.TestCase): @@ -33,7 +44,7 @@ def testChild(self): radio_waves = True tele_vision = True inter_net = True - child = petstore_api.Child( + child = Child( radio_waves=radio_waves, tele_vision=tele_vision, inter_net=inter_net @@ -64,10 +75,10 @@ def testChild(self): # setting a value that doesn't exist raises an exception # with a key - with self.assertRaises(AttributeError): + with self.assertRaises(petstore_api.ApiAttributeError): child['invalid_variable'] = 'some value' # with setattr - with self.assertRaises(AttributeError): + with self.assertRaises(petstore_api.ApiAttributeError): setattr(child, 'invalid_variable', 'some value') # with hasattr @@ -75,12 +86,12 @@ def testChild(self): # getting a value that doesn't exist raises an exception # with a key - with self.assertRaises(AttributeError): + with self.assertRaises(petstore_api.ApiAttributeError): invalid_variable = child['invalid_variable'] # with getattr self.assertEquals(getattr(child, 'invalid_variable', 'some value'), 'some value') - with self.assertRaises(AttributeError): + with self.assertRaises(petstore_api.ApiAttributeError): invalid_variable = getattr(child, 'invalid_variable') # make sure that the ModelComposed class properties are correct @@ -90,8 +101,8 @@ def testChild(self): { 'anyOf': [], 'allOf': [ - petstore_api.ChildAllOf, - petstore_api.Parent, + child_all_of.ChildAllOf, + parent.Parent, ], 'oneOf': [], } @@ -99,9 +110,9 @@ def testChild(self): # model._composed_instances is a list of the instances that were # made from the anyOf/allOf/OneOf classes in model._composed_schemas() for composed_instance in child._composed_instances: - if composed_instance.__class__ == petstore_api.Parent: + if composed_instance.__class__ == parent.Parent: parent_instance = composed_instance - elif composed_instance.__class__ == petstore_api.ChildAllOf: + elif composed_instance.__class__ == child_all_of.ChildAllOf: child_allof_instance = composed_instance self.assertEqual( child._composed_instances, @@ -132,12 +143,11 @@ def testChild(self): # including extra parameters raises an exception with self.assertRaises(petstore_api.ApiValueError): - child = petstore_api.Child( + child = Child( radio_waves=radio_waves, tele_vision=tele_vision, inter_net=inter_net, - unknown_property='some value' - ) + unknown_property='some value') if __name__ == '__main__': unittest.main() diff --git a/samples/client/petstore/python-experimental/test/test_child_all_of.py b/samples/client/petstore/python-experimental/test/test_child_all_of.py index e3f14035f625..96e479cf0796 100644 --- a/samples/client/petstore/python-experimental/test/test_child_all_of.py +++ b/samples/client/petstore/python-experimental/test/test_child_all_of.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.child_all_of import ChildAllOf class TestChildAllOf(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testChildAllOf(self): """Test ChildAllOf""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.ChildAllOf() # noqa: E501 + # model = ChildAllOf() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_child_cat.py b/samples/client/petstore/python-experimental/test/test_child_cat.py index c42c3b583aae..34c085515a80 100644 --- a/samples/client/petstore/python-experimental/test/test_child_cat.py +++ b/samples/client/petstore/python-experimental/test/test_child_cat.py @@ -11,10 +11,21 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import child_cat_all_of +except ImportError: + child_cat_all_of = sys.modules[ + 'petstore_api.model.child_cat_all_of'] +try: + from petstore_api.model import parent_pet +except ImportError: + parent_pet = sys.modules[ + 'petstore_api.model.parent_pet'] +from petstore_api.model.child_cat import ChildCat class TestChildCat(unittest.TestCase): @@ -29,7 +40,7 @@ def tearDown(self): def testChildCat(self): """Test ChildCat""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.ChildCat() # noqa: E501 + # model = ChildCat() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_child_cat_all_of.py b/samples/client/petstore/python-experimental/test/test_child_cat_all_of.py index 3304a81a2321..2a7aab100fbf 100644 --- a/samples/client/petstore/python-experimental/test/test_child_cat_all_of.py +++ b/samples/client/petstore/python-experimental/test/test_child_cat_all_of.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.child_cat_all_of import ChildCatAllOf class TestChildCatAllOf(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testChildCatAllOf(self): """Test ChildCatAllOf""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.ChildCatAllOf() # noqa: E501 + # model = ChildCatAllOf() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_child_dog.py b/samples/client/petstore/python-experimental/test/test_child_dog.py index 9c56f27bbc49..dfb09213e40c 100644 --- a/samples/client/petstore/python-experimental/test/test_child_dog.py +++ b/samples/client/petstore/python-experimental/test/test_child_dog.py @@ -11,10 +11,21 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import child_dog_all_of +except ImportError: + child_dog_all_of = sys.modules[ + 'petstore_api.model.child_dog_all_of'] +try: + from petstore_api.model import parent_pet +except ImportError: + parent_pet = sys.modules[ + 'petstore_api.model.parent_pet'] +from petstore_api.model.child_dog import ChildDog class TestChildDog(unittest.TestCase): @@ -29,7 +40,7 @@ def tearDown(self): def testChildDog(self): """Test ChildDog""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.ChildDog() # noqa: E501 + # model = ChildDog() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_child_dog_all_of.py b/samples/client/petstore/python-experimental/test/test_child_dog_all_of.py index a9124db412b7..ca75000c650e 100644 --- a/samples/client/petstore/python-experimental/test/test_child_dog_all_of.py +++ b/samples/client/petstore/python-experimental/test/test_child_dog_all_of.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.child_dog_all_of import ChildDogAllOf class TestChildDogAllOf(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testChildDogAllOf(self): """Test ChildDogAllOf""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.ChildDogAllOf() # noqa: E501 + # model = ChildDogAllOf() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_child_lizard.py b/samples/client/petstore/python-experimental/test/test_child_lizard.py index 21ba88480aad..975dc1612a9f 100644 --- a/samples/client/petstore/python-experimental/test/test_child_lizard.py +++ b/samples/client/petstore/python-experimental/test/test_child_lizard.py @@ -11,10 +11,21 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import child_lizard_all_of +except ImportError: + child_lizard_all_of = sys.modules[ + 'petstore_api.model.child_lizard_all_of'] +try: + from petstore_api.model import parent_pet +except ImportError: + parent_pet = sys.modules[ + 'petstore_api.model.parent_pet'] +from petstore_api.model.child_lizard import ChildLizard class TestChildLizard(unittest.TestCase): @@ -29,7 +40,7 @@ def tearDown(self): def testChildLizard(self): """Test ChildLizard""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.ChildLizard() # noqa: E501 + # model = ChildLizard() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_child_lizard_all_of.py b/samples/client/petstore/python-experimental/test/test_child_lizard_all_of.py index 824e376f855b..1b3bf4dba943 100644 --- a/samples/client/petstore/python-experimental/test/test_child_lizard_all_of.py +++ b/samples/client/petstore/python-experimental/test/test_child_lizard_all_of.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.child_lizard_all_of import ChildLizardAllOf class TestChildLizardAllOf(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testChildLizardAllOf(self): """Test ChildLizardAllOf""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.ChildLizardAllOf() # noqa: E501 + # model = ChildLizardAllOf() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_class_model.py b/samples/client/petstore/python-experimental/test/test_class_model.py index 12b7fb99402e..060df39e4b5e 100644 --- a/samples/client/petstore/python-experimental/test/test_class_model.py +++ b/samples/client/petstore/python-experimental/test/test_class_model.py @@ -5,18 +5,17 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.class_model import ClassModel # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.model.class_model import ClassModel class TestClassModel(unittest.TestCase): @@ -31,7 +30,7 @@ def tearDown(self): def testClassModel(self): """Test ClassModel""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.class_model.ClassModel() # noqa: E501 + # model = ClassModel() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_client.py b/samples/client/petstore/python-experimental/test/test_client.py index 9e18c4310d96..ab5e3a80d377 100644 --- a/samples/client/petstore/python-experimental/test/test_client.py +++ b/samples/client/petstore/python-experimental/test/test_client.py @@ -5,18 +5,17 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.client import Client # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.model.client import Client class TestClient(unittest.TestCase): @@ -31,7 +30,7 @@ def tearDown(self): def testClient(self): """Test Client""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.client.Client() # noqa: E501 + # model = Client() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_dog.py b/samples/client/petstore/python-experimental/test/test_dog.py index 91f9318b9c68..26949b34ae7f 100644 --- a/samples/client/petstore/python-experimental/test/test_dog.py +++ b/samples/client/petstore/python-experimental/test/test_dog.py @@ -11,10 +11,21 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import animal +except ImportError: + animal = sys.modules[ + 'petstore_api.model.animal'] +try: + from petstore_api.model import dog_all_of +except ImportError: + dog_all_of = sys.modules[ + 'petstore_api.model.dog_all_of'] +from petstore_api.model.dog import Dog class TestDog(unittest.TestCase): @@ -33,7 +44,7 @@ def testDog(self): class_name = 'Dog' color = 'white' breed = 'Jack Russel Terrier' - dog = petstore_api.Dog( + dog = Dog( class_name=class_name, color=color, breed=breed @@ -87,8 +98,8 @@ def testDog(self): { 'anyOf': [], 'allOf': [ - petstore_api.Animal, - petstore_api.DogAllOf, + animal.Animal, + dog_all_of.DogAllOf, ], 'oneOf': [], } @@ -96,9 +107,9 @@ def testDog(self): # model._composed_instances is a list of the instances that were # made from the anyOf/allOf/OneOf classes in model._composed_schemas() for composed_instance in dog._composed_instances: - if composed_instance.__class__ == petstore_api.Animal: + if composed_instance.__class__ == animal.Animal: animal_instance = composed_instance - elif composed_instance.__class__ == petstore_api.DogAllOf: + elif composed_instance.__class__ == dog_all_of.DogAllOf: dog_allof_instance = composed_instance self.assertEqual( dog._composed_instances, @@ -129,13 +140,12 @@ def testDog(self): # including extra parameters raises an exception with self.assertRaises(petstore_api.ApiValueError): - dog = petstore_api.Dog( + dog = Dog( class_name=class_name, color=color, breed=breed, unknown_property='some value' ) - if __name__ == '__main__': unittest.main() diff --git a/samples/client/petstore/python-experimental/test/test_dog_all_of.py b/samples/client/petstore/python-experimental/test/test_dog_all_of.py index 3d79f2888c96..7ab4e8ae79d8 100644 --- a/samples/client/petstore/python-experimental/test/test_dog_all_of.py +++ b/samples/client/petstore/python-experimental/test/test_dog_all_of.py @@ -5,18 +5,17 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.dog_all_of import DogAllOf # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.model.dog_all_of import DogAllOf class TestDogAllOf(unittest.TestCase): @@ -31,7 +30,7 @@ def tearDown(self): def testDogAllOf(self): """Test DogAllOf""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.dog_all_of.DogAllOf() # noqa: E501 + # model = DogAllOf() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_enum_arrays.py b/samples/client/petstore/python-experimental/test/test_enum_arrays.py index be572508ef22..64ad5fd7dc08 100644 --- a/samples/client/petstore/python-experimental/test/test_enum_arrays.py +++ b/samples/client/petstore/python-experimental/test/test_enum_arrays.py @@ -5,18 +5,17 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.enum_arrays import EnumArrays # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.model.enum_arrays import EnumArrays class TestEnumArrays(unittest.TestCase): @@ -28,12 +27,136 @@ def setUp(self): def tearDown(self): pass - def testEnumArrays(self): - """Test EnumArrays""" - # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.enum_arrays.EnumArrays() # noqa: E501 - pass + def test_enumarrays_init(self): + # + # Check various combinations of valid values. + # + fish_or_crab = EnumArrays(just_symbol=">=") + self.assertEqual(fish_or_crab.just_symbol, ">=") + # if optional property is unset we raise an exception + with self.assertRaises(petstore_api.ApiAttributeError) as exc: + self.assertEqual(fish_or_crab.array_enum, None) + + fish_or_crab = EnumArrays(just_symbol="$", array_enum=["fish"]) + self.assertEqual(fish_or_crab.just_symbol, "$") + self.assertEqual(fish_or_crab.array_enum, ["fish"]) + + fish_or_crab = EnumArrays(just_symbol=">=", array_enum=["fish"]) + self.assertEqual(fish_or_crab.just_symbol, ">=") + self.assertEqual(fish_or_crab.array_enum, ["fish"]) + + fish_or_crab = EnumArrays(just_symbol="$", array_enum=["crab"]) + self.assertEqual(fish_or_crab.just_symbol, "$") + self.assertEqual(fish_or_crab.array_enum, ["crab"]) + + + # + # Check if setting invalid values fails + # + with self.assertRaises(petstore_api.ApiValueError) as exc: + fish_or_crab = EnumArrays(just_symbol="<=") + + with self.assertRaises(petstore_api.ApiValueError) as exc: + fish_or_crab = EnumArrays(just_symbol="$", array_enum=["dog"]) + + with self.assertRaises(petstore_api.ApiTypeError) as exc: + fish_or_crab = EnumArrays(just_symbol=["$"], array_enum=["crab"]) + + + def test_enumarrays_setter(self): + + # + # Check various combinations of valid values + # + fish_or_crab = EnumArrays() + + fish_or_crab.just_symbol = ">=" + self.assertEqual(fish_or_crab.just_symbol, ">=") + + fish_or_crab.just_symbol = "$" + self.assertEqual(fish_or_crab.just_symbol, "$") + + fish_or_crab.array_enum = [] + self.assertEqual(fish_or_crab.array_enum, []) + + fish_or_crab.array_enum = ["fish"] + self.assertEqual(fish_or_crab.array_enum, ["fish"]) + + fish_or_crab.array_enum = ["fish", "fish", "fish"] + self.assertEqual(fish_or_crab.array_enum, ["fish", "fish", "fish"]) + + fish_or_crab.array_enum = ["crab"] + self.assertEqual(fish_or_crab.array_enum, ["crab"]) + + fish_or_crab.array_enum = ["crab", "fish"] + self.assertEqual(fish_or_crab.array_enum, ["crab", "fish"]) + + fish_or_crab.array_enum = ["crab", "fish", "crab", "fish"] + self.assertEqual(fish_or_crab.array_enum, ["crab", "fish", "crab", "fish"]) + + # + # Check if setting invalid values fails + # + fish_or_crab = EnumArrays() + with self.assertRaises(petstore_api.ApiValueError) as exc: + fish_or_crab.just_symbol = "!=" + + with self.assertRaises(petstore_api.ApiTypeError) as exc: + fish_or_crab.just_symbol = ["fish"] + + with self.assertRaises(petstore_api.ApiValueError) as exc: + fish_or_crab.array_enum = ["cat"] + + with self.assertRaises(petstore_api.ApiValueError) as exc: + fish_or_crab.array_enum = ["fish", "crab", "dog"] + + with self.assertRaises(petstore_api.ApiTypeError) as exc: + fish_or_crab.array_enum = "fish" + + + def test_todict(self): + # + # Check if dictionary serialization works + # + dollar_fish_crab_dict = { + 'just_symbol': "$", + 'array_enum': ["fish", "crab"] + } + + dollar_fish_crab = EnumArrays( + just_symbol="$", array_enum=["fish", "crab"]) + + self.assertEqual(dollar_fish_crab_dict, dollar_fish_crab.to_dict()) + + # + # Sanity check for different arrays + # + dollar_crab_fish_dict = { + 'just_symbol': "$", + 'array_enum': ["crab", "fish"] + } + + dollar_fish_crab = EnumArrays( + just_symbol="$", array_enum=["fish", "crab"]) + + self.assertNotEqual(dollar_crab_fish_dict, dollar_fish_crab.to_dict()) + + + def test_equals(self): + # + # Check if object comparison works + # + fish1 = EnumArrays(just_symbol="$", array_enum=["fish"]) + fish2 = EnumArrays(just_symbol="$", array_enum=["fish"]) + self.assertEqual(fish1, fish2) + + fish = EnumArrays(just_symbol="$", array_enum=["fish"]) + crab = EnumArrays(just_symbol="$", array_enum=["crab"]) + self.assertNotEqual(fish, crab) + dollar = EnumArrays(just_symbol="$") + greater = EnumArrays(just_symbol=">=") + self.assertNotEqual(dollar, greater) if __name__ == '__main__': unittest.main() diff --git a/samples/client/petstore/python-experimental/test/test_enum_class.py b/samples/client/petstore/python-experimental/test/test_enum_class.py index 57eb14558a7d..f910231c9d02 100644 --- a/samples/client/petstore/python-experimental/test/test_enum_class.py +++ b/samples/client/petstore/python-experimental/test/test_enum_class.py @@ -5,18 +5,17 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.enum_class import EnumClass # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.model.enum_class import EnumClass class TestEnumClass(unittest.TestCase): @@ -31,7 +30,7 @@ def tearDown(self): def testEnumClass(self): """Test EnumClass""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.enum_class.EnumClass() # noqa: E501 + # model = EnumClass() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_enum_test.py b/samples/client/petstore/python-experimental/test/test_enum_test.py index ecd43afc709d..0ada34cdc1f2 100644 --- a/samples/client/petstore/python-experimental/test/test_enum_test.py +++ b/samples/client/petstore/python-experimental/test/test_enum_test.py @@ -5,18 +5,22 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.enum_test import EnumTest # noqa: E501 -from petstore_api.rest import ApiException +try: + from petstore_api.model import outer_enum +except ImportError: + outer_enum = sys.modules[ + 'petstore_api.model.outer_enum'] +from petstore_api.model.enum_test import EnumTest class TestEnumTest(unittest.TestCase): @@ -31,7 +35,7 @@ def tearDown(self): def testEnumTest(self): """Test EnumTest""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.enum_test.EnumTest() # noqa: E501 + # model = EnumTest() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_fake_api.py b/samples/client/petstore/python-experimental/test/test_fake_api.py index 7a6f1d6810a0..d55e538b8608 100644 --- a/samples/client/petstore/python-experimental/test/test_fake_api.py +++ b/samples/client/petstore/python-experimental/test/test_fake_api.py @@ -11,24 +11,18 @@ from __future__ import absolute_import -import six import unittest -if six.PY3: - from unittest.mock import patch -else: - from mock import patch import petstore_api from petstore_api.api.fake_api import FakeApi # noqa: E501 -from petstore_api.rest import ApiException class TestFakeApi(unittest.TestCase): """FakeApi unit test stubs""" def setUp(self): - self.api = petstore_api.api.fake_api.FakeApi() # noqa: E501 + self.api = FakeApi() # noqa: E501 def tearDown(self): pass @@ -57,18 +51,20 @@ def test_fake_outer_enum_serialize(self): """ # verify that the input and output are type OuterEnum + from petstore_api.model import outer_enum endpoint = self.api.fake_outer_enum_serialize - assert endpoint.openapi_types['body'] == (petstore_api.OuterEnum,) - assert endpoint.settings['response_type'] == (petstore_api.OuterEnum,) + assert endpoint.openapi_types['body'] == (outer_enum.OuterEnum,) + assert endpoint.settings['response_type'] == (outer_enum.OuterEnum,) def test_fake_outer_number_serialize(self): """Test case for fake_outer_number_serialize """ # verify that the input and output are the correct type + from petstore_api.model import outer_number endpoint = self.api.fake_outer_number_serialize - assert endpoint.openapi_types['body'] == (petstore_api.OuterNumber,) - assert endpoint.settings['response_type'] == (petstore_api.OuterNumber,) + assert endpoint.openapi_types['body'] == (outer_number.OuterNumber,) + assert endpoint.settings['response_type'] == (outer_number.OuterNumber,) def test_fake_outer_string_serialize(self): """Test case for fake_outer_string_serialize @@ -101,6 +97,11 @@ def test_test_endpoint_enums_length_one(self): """ # when we omit the required enums of length one, they are still set endpoint = self.api.test_endpoint_enums_length_one + import six + if six.PY3: + from unittest.mock import patch + else: + from mock import patch with patch.object(endpoint, 'call_with_http_info') as call_with_http_info: endpoint() call_with_http_info.assert_called_with( diff --git a/samples/client/petstore/python-experimental/test/test_fake_classname_tags_123_api.py b/samples/client/petstore/python-experimental/test/test_fake_classname_tags_123_api.py index 87cac0b9ef85..1ade31405a62 100644 --- a/samples/client/petstore/python-experimental/test/test_fake_classname_tags_123_api.py +++ b/samples/client/petstore/python-experimental/test/test_fake_classname_tags_123_api.py @@ -5,25 +5,24 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api from petstore_api.api.fake_classname_tags_123_api import FakeClassnameTags123Api # noqa: E501 -from petstore_api.rest import ApiException class TestFakeClassnameTags123Api(unittest.TestCase): """FakeClassnameTags123Api unit test stubs""" def setUp(self): - self.api = petstore_api.api.fake_classname_tags_123_api.FakeClassnameTags123Api() # noqa: E501 + self.api = FakeClassnameTags123Api() # noqa: E501 def tearDown(self): pass diff --git a/samples/client/petstore/python-experimental/test/test_file.py b/samples/client/petstore/python-experimental/test/test_file.py index cc32edb7b523..8d60f64e01cc 100644 --- a/samples/client/petstore/python-experimental/test/test_file.py +++ b/samples/client/petstore/python-experimental/test/test_file.py @@ -5,18 +5,17 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.file import File # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.model.file import File class TestFile(unittest.TestCase): @@ -31,7 +30,7 @@ def tearDown(self): def testFile(self): """Test File""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.file.File() # noqa: E501 + # model = File() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_file_schema_test_class.py b/samples/client/petstore/python-experimental/test/test_file_schema_test_class.py index 91e1b6a1c745..9a4f6d38dfef 100644 --- a/samples/client/petstore/python-experimental/test/test_file_schema_test_class.py +++ b/samples/client/petstore/python-experimental/test/test_file_schema_test_class.py @@ -5,18 +5,22 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.file_schema_test_class import FileSchemaTestClass # noqa: E501 -from petstore_api.rest import ApiException +try: + from petstore_api.model import file +except ImportError: + file = sys.modules[ + 'petstore_api.model.file'] +from petstore_api.model.file_schema_test_class import FileSchemaTestClass class TestFileSchemaTestClass(unittest.TestCase): @@ -31,7 +35,7 @@ def tearDown(self): def testFileSchemaTestClass(self): """Test FileSchemaTestClass""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.file_schema_test_class.FileSchemaTestClass() # noqa: E501 + # model = FileSchemaTestClass() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_format_test.py b/samples/client/petstore/python-experimental/test/test_format_test.py index e7a32e3253ff..ca37b005fd96 100644 --- a/samples/client/petstore/python-experimental/test/test_format_test.py +++ b/samples/client/petstore/python-experimental/test/test_format_test.py @@ -2,26 +2,27 @@ """ OpenAPI Petstore + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 - OpenAPI spec version: 1.0.0 + + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - -import datetime +import sys import unittest import petstore_api -from petstore_api.models.format_test import FormatTest # noqa: E501 -from petstore_api import ApiValueError +from petstore_api.model.format_test import FormatTest class TestFormatTest(unittest.TestCase): """FormatTest unit test stubs""" def setUp(self): + import datetime self.required_named_args = dict( number=40.1, byte='what', @@ -37,7 +38,7 @@ def test_integer(self): key_adder_pairs = [('inclusive_maximum', 1), ('inclusive_minimum', -1)] for key, adder in key_adder_pairs: # value outside the bounds throws an error - with self.assertRaises(ApiValueError): + with self.assertRaises(petstore_api.ApiValueError): keyword_args[var_name] = validations[key] + adder FormatTest(**keyword_args) @@ -54,7 +55,7 @@ def test_int32(self): key_adder_pairs = [('inclusive_maximum', 1), ('inclusive_minimum', -1)] for key, adder in key_adder_pairs: # value outside the bounds throws an error - with self.assertRaises(ApiValueError): + with self.assertRaises(petstore_api.ApiValueError): keyword_args[var_name] = validations[key] + adder FormatTest(**keyword_args) @@ -71,7 +72,7 @@ def test_number(self): key_adder_pairs = [('inclusive_maximum', 1), ('inclusive_minimum', -1)] for key, adder in key_adder_pairs: # value outside the bounds throws an error - with self.assertRaises(ApiValueError): + with self.assertRaises(petstore_api.ApiValueError): keyword_args[var_name] = validations[key] + adder FormatTest(**keyword_args) @@ -88,7 +89,7 @@ def test_float(self): key_adder_pairs = [('inclusive_maximum', 1), ('inclusive_minimum', -1)] for key, adder in key_adder_pairs: # value outside the bounds throws an error - with self.assertRaises(ApiValueError): + with self.assertRaises(petstore_api.ApiValueError): keyword_args[var_name] = validations[key] + adder FormatTest(**keyword_args) @@ -105,7 +106,7 @@ def test_double(self): key_adder_pairs = [('inclusive_maximum', 1), ('inclusive_minimum', -1)] for key, adder in key_adder_pairs: # value outside the bounds throws an error - with self.assertRaises(ApiValueError): + with self.assertRaises(petstore_api.ApiValueError): keyword_args[var_name] = validations[key] + adder FormatTest(**keyword_args) @@ -122,7 +123,7 @@ def test_password(self): key_adder_pairs = [('max_length', 1), ('min_length', -1)] for key, adder in key_adder_pairs: # value outside the bounds throws an error - with self.assertRaises(ApiValueError): + with self.assertRaises(petstore_api.ApiValueError): keyword_args[var_name] = 'a'*(validations[key] + adder) FormatTest(**keyword_args) @@ -139,7 +140,7 @@ def test_string(self): values_invalid = ['abc3', '1', '.', ' ', 'مرحبا', ''] for value_invalid in values_invalid: # invalid values throw exceptions - with self.assertRaises(ApiValueError): + with self.assertRaises(petstore_api.ApiValueError): keyword_args[var_name] = value_invalid FormatTest(**keyword_args) @@ -148,6 +149,5 @@ def test_string(self): keyword_args[var_name] = value_valid assert getattr(FormatTest(**keyword_args), var_name) == value_valid - if __name__ == '__main__': unittest.main() diff --git a/samples/client/petstore/python-experimental/test/test_grandparent.py b/samples/client/petstore/python-experimental/test/test_grandparent.py index 44f594c086e4..2972d01161cd 100644 --- a/samples/client/petstore/python-experimental/test/test_grandparent.py +++ b/samples/client/petstore/python-experimental/test/test_grandparent.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.grandparent import Grandparent class TestGrandparent(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testGrandparent(self): """Test Grandparent""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.Grandparent() # noqa: E501 + # model = Grandparent() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_grandparent_animal.py b/samples/client/petstore/python-experimental/test/test_grandparent_animal.py index dc0d300cdaea..cabe4d81f98e 100644 --- a/samples/client/petstore/python-experimental/test/test_grandparent_animal.py +++ b/samples/client/petstore/python-experimental/test/test_grandparent_animal.py @@ -11,10 +11,31 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import child_cat +except ImportError: + child_cat = sys.modules[ + 'petstore_api.model.child_cat'] +try: + from petstore_api.model import child_dog +except ImportError: + child_dog = sys.modules[ + 'petstore_api.model.child_dog'] +try: + from petstore_api.model import child_lizard +except ImportError: + child_lizard = sys.modules[ + 'petstore_api.model.child_lizard'] +try: + from petstore_api.model import parent_pet +except ImportError: + parent_pet = sys.modules[ + 'petstore_api.model.parent_pet'] +from petstore_api.model.grandparent_animal import GrandparentAnimal class TestGrandparentAnimal(unittest.TestCase): @@ -29,7 +50,7 @@ def tearDown(self): def testGrandparentAnimal(self): """Test GrandparentAnimal""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.GrandparentAnimal() # noqa: E501 + # model = GrandparentAnimal() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_has_only_read_only.py b/samples/client/petstore/python-experimental/test/test_has_only_read_only.py index 2dc052a328a0..9ebd7683b398 100644 --- a/samples/client/petstore/python-experimental/test/test_has_only_read_only.py +++ b/samples/client/petstore/python-experimental/test/test_has_only_read_only.py @@ -5,18 +5,17 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.has_only_read_only import HasOnlyReadOnly # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.model.has_only_read_only import HasOnlyReadOnly class TestHasOnlyReadOnly(unittest.TestCase): @@ -31,7 +30,7 @@ def tearDown(self): def testHasOnlyReadOnly(self): """Test HasOnlyReadOnly""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.has_only_read_only.HasOnlyReadOnly() # noqa: E501 + # model = HasOnlyReadOnly() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_list.py b/samples/client/petstore/python-experimental/test/test_list.py index a538a6b1ad36..52156adfed2e 100644 --- a/samples/client/petstore/python-experimental/test/test_list.py +++ b/samples/client/petstore/python-experimental/test/test_list.py @@ -5,18 +5,17 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.list import List # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.model.list import List class TestList(unittest.TestCase): @@ -31,7 +30,7 @@ def tearDown(self): def testList(self): """Test List""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.list.List() # noqa: E501 + # model = List() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_map_test.py b/samples/client/petstore/python-experimental/test/test_map_test.py index 0ba6481903e6..3feda0f688df 100644 --- a/samples/client/petstore/python-experimental/test/test_map_test.py +++ b/samples/client/petstore/python-experimental/test/test_map_test.py @@ -5,18 +5,22 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.map_test import MapTest # noqa: E501 -from petstore_api.rest import ApiException +try: + from petstore_api.model import string_boolean_map +except ImportError: + string_boolean_map = sys.modules[ + 'petstore_api.model.string_boolean_map'] +from petstore_api.model.map_test import MapTest class TestMapTest(unittest.TestCase): @@ -28,12 +32,94 @@ def setUp(self): def tearDown(self): pass - def testMapTest(self): - """Test MapTest""" - # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.map_test.MapTest() # noqa: E501 - pass + def test_maptest_init(self): + # + # Test MapTest construction with valid values + # + up_or_low_dict = { + 'UPPER': "UP", + 'lower': "low" + } + map_enum_test = MapTest(map_of_enum_string=up_or_low_dict) + + self.assertEqual(map_enum_test.map_of_enum_string, up_or_low_dict) + + map_of_map_of_strings = { + 'valueDict': up_or_low_dict + } + map_enum_test = MapTest(map_map_of_string=map_of_map_of_strings) + + self.assertEqual(map_enum_test.map_map_of_string, map_of_map_of_strings) + + # + # Make sure that the init fails for invalid enum values + # + black_or_white_dict = { + 'black': "UP", + 'white': "low" + } + with self.assertRaises(petstore_api.ApiValueError): + MapTest(map_of_enum_string=black_or_white_dict) + + def test_maptest_setter(self): + # + # Check with some valid values + # + map_enum_test = MapTest() + up_or_low_dict = { + 'UPPER': "UP", + 'lower': "low" + } + map_enum_test.map_of_enum_string = up_or_low_dict + self.assertEqual(map_enum_test.map_of_enum_string, up_or_low_dict) + + # + # Check if the setter fails for invalid enum values + # + map_enum_test = MapTest() + black_or_white_dict = { + 'black': "UP", + 'white': "low" + } + with self.assertRaises(petstore_api.ApiValueError): + map_enum_test.map_of_enum_string = black_or_white_dict + + def test_todict(self): + # + # Check dictionary serialization + # + map_enum_test = MapTest() + up_or_low_dict = { + 'UPPER': "UP", + 'lower': "low" + } + map_of_map_of_strings = { + 'valueDict': up_or_low_dict + } + indirect_map = string_boolean_map.StringBooleanMap(**{ + 'option1': True + }) + direct_map = { + 'option2': False + } + map_enum_test.map_of_enum_string = up_or_low_dict + map_enum_test.map_map_of_string = map_of_map_of_strings + map_enum_test.indirect_map = indirect_map + map_enum_test.direct_map = direct_map + + self.assertEqual(map_enum_test.map_of_enum_string, up_or_low_dict) + self.assertEqual(map_enum_test.map_map_of_string, map_of_map_of_strings) + self.assertEqual(map_enum_test.indirect_map, indirect_map) + self.assertEqual(map_enum_test.direct_map, direct_map) + + expected_dict = { + 'map_of_enum_string': up_or_low_dict, + 'map_map_of_string': map_of_map_of_strings, + 'indirect_map': indirect_map.to_dict(), + 'direct_map': direct_map + } + self.assertEqual(map_enum_test.to_dict(), expected_dict) if __name__ == '__main__': unittest.main() diff --git a/samples/client/petstore/python-experimental/test/test_mixed_properties_and_additional_properties_class.py b/samples/client/petstore/python-experimental/test/test_mixed_properties_and_additional_properties_class.py index 8893bdaf44ee..4dcb5ad4268c 100644 --- a/samples/client/petstore/python-experimental/test/test_mixed_properties_and_additional_properties_class.py +++ b/samples/client/petstore/python-experimental/test/test_mixed_properties_and_additional_properties_class.py @@ -5,18 +5,22 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass # noqa: E501 -from petstore_api.rest import ApiException +try: + from petstore_api.model import animal +except ImportError: + animal = sys.modules[ + 'petstore_api.model.animal'] +from petstore_api.model.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass class TestMixedPropertiesAndAdditionalPropertiesClass(unittest.TestCase): @@ -31,7 +35,7 @@ def tearDown(self): def testMixedPropertiesAndAdditionalPropertiesClass(self): """Test MixedPropertiesAndAdditionalPropertiesClass""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.mixed_properties_and_additional_properties_class.MixedPropertiesAndAdditionalPropertiesClass() # noqa: E501 + # model = MixedPropertiesAndAdditionalPropertiesClass() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_model200_response.py b/samples/client/petstore/python-experimental/test/test_model200_response.py index fab761f4edba..4012eaae3362 100644 --- a/samples/client/petstore/python-experimental/test/test_model200_response.py +++ b/samples/client/petstore/python-experimental/test/test_model200_response.py @@ -5,18 +5,17 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.model200_response import Model200Response # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.model.model200_response import Model200Response class TestModel200Response(unittest.TestCase): @@ -31,7 +30,7 @@ def tearDown(self): def testModel200Response(self): """Test Model200Response""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.model200_response.Model200Response() # noqa: E501 + # model = Model200Response() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_model_return.py b/samples/client/petstore/python-experimental/test/test_model_return.py index ae3f15ee6b83..54c98b33cd66 100644 --- a/samples/client/petstore/python-experimental/test/test_model_return.py +++ b/samples/client/petstore/python-experimental/test/test_model_return.py @@ -5,18 +5,17 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.model_return import ModelReturn # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.model.model_return import ModelReturn class TestModelReturn(unittest.TestCase): @@ -31,7 +30,7 @@ def tearDown(self): def testModelReturn(self): """Test ModelReturn""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.model_return.ModelReturn() # noqa: E501 + # model = ModelReturn() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_name.py b/samples/client/petstore/python-experimental/test/test_name.py index d6c72563991f..6a9be99d1a57 100644 --- a/samples/client/petstore/python-experimental/test/test_name.py +++ b/samples/client/petstore/python-experimental/test/test_name.py @@ -5,18 +5,17 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.name import Name # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.model.name import Name class TestName(unittest.TestCase): @@ -31,7 +30,7 @@ def tearDown(self): def testName(self): """Test Name""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.name.Name() # noqa: E501 + # model = Name() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_number_only.py b/samples/client/petstore/python-experimental/test/test_number_only.py index 7f6df65c8058..07aab1d78af7 100644 --- a/samples/client/petstore/python-experimental/test/test_number_only.py +++ b/samples/client/petstore/python-experimental/test/test_number_only.py @@ -5,18 +5,17 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.number_only import NumberOnly # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.model.number_only import NumberOnly class TestNumberOnly(unittest.TestCase): @@ -31,7 +30,7 @@ def tearDown(self): def testNumberOnly(self): """Test NumberOnly""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.number_only.NumberOnly() # noqa: E501 + # model = NumberOnly() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_order.py b/samples/client/petstore/python-experimental/test/test_order.py index 3e7d517d5c79..ee6988e28ccd 100644 --- a/samples/client/petstore/python-experimental/test/test_order.py +++ b/samples/client/petstore/python-experimental/test/test_order.py @@ -5,18 +5,17 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.order import Order # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.model.order import Order class TestOrder(unittest.TestCase): @@ -30,9 +29,12 @@ def tearDown(self): def testOrder(self): """Test Order""" - # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.order.Order() # noqa: E501 - pass + order = Order() + order.status = "placed" + self.assertEqual("placed", order.status) + with self.assertRaises(petstore_api.ApiValueError): + order.status = "invalid" + if __name__ == '__main__': diff --git a/samples/client/petstore/python-experimental/test/test_outer_composite.py b/samples/client/petstore/python-experimental/test/test_outer_composite.py index dcb078cd2164..f3ad1beff9e4 100644 --- a/samples/client/petstore/python-experimental/test/test_outer_composite.py +++ b/samples/client/petstore/python-experimental/test/test_outer_composite.py @@ -5,18 +5,22 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.outer_composite import OuterComposite # noqa: E501 -from petstore_api.rest import ApiException +try: + from petstore_api.model import outer_number +except ImportError: + outer_number = sys.modules[ + 'petstore_api.model.outer_number'] +from petstore_api.model.outer_composite import OuterComposite class TestOuterComposite(unittest.TestCase): @@ -31,7 +35,7 @@ def tearDown(self): def testOuterComposite(self): """Test OuterComposite""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.outer_composite.OuterComposite() # noqa: E501 + # model = OuterComposite() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_outer_enum.py b/samples/client/petstore/python-experimental/test/test_outer_enum.py index 50bfff0869b7..ff84ad3ba6d4 100644 --- a/samples/client/petstore/python-experimental/test/test_outer_enum.py +++ b/samples/client/petstore/python-experimental/test/test_outer_enum.py @@ -11,12 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.outer_enum import OuterEnum # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.model.outer_enum import OuterEnum class TestOuterEnum(unittest.TestCase): @@ -43,5 +42,6 @@ def testOuterEnum(self): valid_value = OuterEnum.allowed_values[('value',)]['PLACED'] assert valid_value == OuterEnum(valid_value).value + if __name__ == '__main__': unittest.main() diff --git a/samples/client/petstore/python-experimental/test/test_outer_number.py b/samples/client/petstore/python-experimental/test/test_outer_number.py index 31c9c41755dc..e0ab10d91d61 100644 --- a/samples/client/petstore/python-experimental/test/test_outer_number.py +++ b/samples/client/petstore/python-experimental/test/test_outer_number.py @@ -11,12 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.outer_number import OuterNumber # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.model.outer_number import OuterNumber class TestOuterNumber(unittest.TestCase): @@ -31,7 +30,7 @@ def tearDown(self): def testOuterNumber(self): """Test OuterNumber""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.outer_number.OuterNumber() # noqa: E501 + # model = OuterNumber() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_parent.py b/samples/client/petstore/python-experimental/test/test_parent.py index f719771bdcfb..20282dfb41ea 100644 --- a/samples/client/petstore/python-experimental/test/test_parent.py +++ b/samples/client/petstore/python-experimental/test/test_parent.py @@ -11,10 +11,21 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import grandparent +except ImportError: + grandparent = sys.modules[ + 'petstore_api.model.grandparent'] +try: + from petstore_api.model import parent_all_of +except ImportError: + parent_all_of = sys.modules[ + 'petstore_api.model.parent_all_of'] +from petstore_api.model.parent import Parent class TestParent(unittest.TestCase): @@ -29,7 +40,7 @@ def tearDown(self): def testParent(self): """Test Parent""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.Parent() # noqa: E501 + # model = Parent() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_parent_all_of.py b/samples/client/petstore/python-experimental/test/test_parent_all_of.py index c1c152afe18a..ca87189bba50 100644 --- a/samples/client/petstore/python-experimental/test/test_parent_all_of.py +++ b/samples/client/petstore/python-experimental/test/test_parent_all_of.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.parent_all_of import ParentAllOf class TestParentAllOf(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testParentAllOf(self): """Test ParentAllOf""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.ParentAllOf() # noqa: E501 + # model = ParentAllOf() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_parent_pet.py b/samples/client/petstore/python-experimental/test/test_parent_pet.py index b3ec1a94532c..17a4d60e75dc 100644 --- a/samples/client/petstore/python-experimental/test/test_parent_pet.py +++ b/samples/client/petstore/python-experimental/test/test_parent_pet.py @@ -11,10 +11,31 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import child_cat +except ImportError: + child_cat = sys.modules[ + 'petstore_api.model.child_cat'] +try: + from petstore_api.model import child_dog +except ImportError: + child_dog = sys.modules[ + 'petstore_api.model.child_dog'] +try: + from petstore_api.model import child_lizard +except ImportError: + child_lizard = sys.modules[ + 'petstore_api.model.child_lizard'] +try: + from petstore_api.model import grandparent_animal +except ImportError: + grandparent_animal = sys.modules[ + 'petstore_api.model.grandparent_animal'] +from petstore_api.model.parent_pet import ParentPet class TestParentPet(unittest.TestCase): @@ -29,7 +50,7 @@ def tearDown(self): def testParentPet(self): """Test ParentPet""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.ParentPet() # noqa: E501 + # model = ParentPet() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_pet.py b/samples/client/petstore/python-experimental/test/test_pet.py index bc5cc30fac0d..b072cff5e9ad 100644 --- a/samples/client/petstore/python-experimental/test/test_pet.py +++ b/samples/client/petstore/python-experimental/test/test_pet.py @@ -5,18 +5,27 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.pet import Pet # noqa: E501 -from petstore_api.rest import ApiException +try: + from petstore_api.model import category +except ImportError: + category = sys.modules[ + 'petstore_api.model.category'] +try: + from petstore_api.models import tag +except ImportError: + tag = sys.modules[ + 'petstore_api.model.tag'] +from petstore_api.model.pet import Pet class TestPet(unittest.TestCase): @@ -28,11 +37,52 @@ def setUp(self): def tearDown(self): pass - def testPet(self): - """Test Pet""" - # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.pet.Pet() # noqa: E501 - pass + def test_to_str(self): + pet = Pet(name="test name", photo_urls=["string"]) + pet.id = 1 + pet.status = "available" + cate = category.Category() + cate.id = 1 + cate.name = "dog" + pet.category = cate + tag1 = tag.Tag() + tag1.id = 1 + pet.tags = [tag1] + + data = ("{'category': {'id': 1, 'name': 'dog'},\n" + " 'id': 1,\n" + " 'name': 'test name',\n" + " 'photo_urls': ['string'],\n" + " 'status': 'available',\n" + " 'tags': [{'id': 1}]}") + self.assertEqual(data, pet.to_str()) + + def test_equal(self): + pet1 = Pet(name="test name", photo_urls=["string"]) + pet1.id = 1 + pet1.status = "available" + cate1 = category.Category() + cate1.id = 1 + cate1.name = "dog" + tag1 = tag.Tag() + tag1.id = 1 + pet1.tags = [tag1] + + pet2 = Pet(name="test name", photo_urls=["string"]) + pet2.id = 1 + pet2.status = "available" + cate2 = category.Category() + cate2.id = 1 + cate2.name = "dog" + tag2 = tag.Tag() + tag2.id = 1 + pet2.tags = [tag2] + + self.assertTrue(pet1 == pet2) + + # reset pet1 tags to empty array so that object comparison returns false + pet1.tags = [] + self.assertFalse(pet1 == pet2) if __name__ == '__main__': diff --git a/samples/client/petstore/python-experimental/test/test_pet_api.py b/samples/client/petstore/python-experimental/test/test_pet_api.py index ffd3e25c4c64..091b30cf8ac0 100644 --- a/samples/client/petstore/python-experimental/test/test_pet_api.py +++ b/samples/client/petstore/python-experimental/test/test_pet_api.py @@ -5,25 +5,24 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api from petstore_api.api.pet_api import PetApi # noqa: E501 -from petstore_api.rest import ApiException class TestPetApi(unittest.TestCase): """PetApi unit test stubs""" def setUp(self): - self.api = petstore_api.api.pet_api.PetApi() # noqa: E501 + self.api = PetApi() # noqa: E501 def tearDown(self): pass @@ -84,6 +83,13 @@ def test_upload_file(self): """ pass + def test_upload_file_with_required_file(self): + """Test case for upload_file_with_required_file + + uploads an image (required) # noqa: E501 + """ + pass + if __name__ == '__main__': unittest.main() diff --git a/samples/client/petstore/python-experimental/test/test_player.py b/samples/client/petstore/python-experimental/test/test_player.py index b100dd798943..ee7b95a677f1 100644 --- a/samples/client/petstore/python-experimental/test/test_player.py +++ b/samples/client/petstore/python-experimental/test/test_player.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.player import Player class TestPlayer(unittest.TestCase): @@ -29,13 +30,13 @@ def tearDown(self): def testPlayer(self): """Test Player""" # we can make a player without an enemy_player property - jane = petstore_api.Player(name="Jane") + jane = Player(name="Jane") # we can make a player with an enemy_player - sally = petstore_api.Player(name="Sally", enemy_player=jane) + sally = Player(name="Sally", enemy_player=jane) # we can make a player with an inline enemy_player - jim = petstore_api.Player( + jim = Player( name="Jim", - enemy_player=petstore_api.Player(name="Sam") + enemy_player=Player(name="Sam") ) diff --git a/samples/client/petstore/python-experimental/test/test_read_only_first.py b/samples/client/petstore/python-experimental/test/test_read_only_first.py index 2b647b83fc89..c2dcde240e77 100644 --- a/samples/client/petstore/python-experimental/test/test_read_only_first.py +++ b/samples/client/petstore/python-experimental/test/test_read_only_first.py @@ -5,18 +5,17 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.read_only_first import ReadOnlyFirst # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.model.read_only_first import ReadOnlyFirst class TestReadOnlyFirst(unittest.TestCase): @@ -31,7 +30,7 @@ def tearDown(self): def testReadOnlyFirst(self): """Test ReadOnlyFirst""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.read_only_first.ReadOnlyFirst() # noqa: E501 + # model = ReadOnlyFirst() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_special_model_name.py b/samples/client/petstore/python-experimental/test/test_special_model_name.py index 4edfec164f7d..6124525f5170 100644 --- a/samples/client/petstore/python-experimental/test/test_special_model_name.py +++ b/samples/client/petstore/python-experimental/test/test_special_model_name.py @@ -5,18 +5,17 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.special_model_name import SpecialModelName # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.model.special_model_name import SpecialModelName class TestSpecialModelName(unittest.TestCase): @@ -31,7 +30,7 @@ def tearDown(self): def testSpecialModelName(self): """Test SpecialModelName""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.special_model_name.SpecialModelName() # noqa: E501 + # model = SpecialModelName() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_store_api.py b/samples/client/petstore/python-experimental/test/test_store_api.py index 37bf771d13a6..0d9cc3dd36ea 100644 --- a/samples/client/petstore/python-experimental/test/test_store_api.py +++ b/samples/client/petstore/python-experimental/test/test_store_api.py @@ -5,7 +5,7 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ @@ -16,14 +16,13 @@ import petstore_api from petstore_api.api.store_api import StoreApi # noqa: E501 -from petstore_api.rest import ApiException class TestStoreApi(unittest.TestCase): """StoreApi unit test stubs""" def setUp(self): - self.api = petstore_api.api.store_api.StoreApi() # noqa: E501 + self.api = StoreApi() # noqa: E501 def tearDown(self): pass diff --git a/samples/client/petstore/python-experimental/test/test_string_boolean_map.py b/samples/client/petstore/python-experimental/test/test_string_boolean_map.py index 31c1ebeec5db..e2e9d8b420b8 100644 --- a/samples/client/petstore/python-experimental/test/test_string_boolean_map.py +++ b/samples/client/petstore/python-experimental/test/test_string_boolean_map.py @@ -11,12 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.string_boolean_map import StringBooleanMap # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.model.string_boolean_map import StringBooleanMap class TestStringBooleanMap(unittest.TestCase): @@ -31,7 +30,7 @@ def tearDown(self): def testStringBooleanMap(self): """Test StringBooleanMap""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.string_boolean_map.StringBooleanMap() # noqa: E501 + # model = StringBooleanMap() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_tag.py b/samples/client/petstore/python-experimental/test/test_tag.py index 2c3c5157e718..68a3b9046bf4 100644 --- a/samples/client/petstore/python-experimental/test/test_tag.py +++ b/samples/client/petstore/python-experimental/test/test_tag.py @@ -5,18 +5,17 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.tag import Tag # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.model.tag import Tag class TestTag(unittest.TestCase): @@ -31,7 +30,7 @@ def tearDown(self): def testTag(self): """Test Tag""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.tag.Tag() # noqa: E501 + # model = Tag() # noqa: E501 pass 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 08a201b854d0..f9c050b81a82 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 @@ -5,18 +5,17 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.type_holder_default import TypeHolderDefault # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.model.type_holder_default import TypeHolderDefault class TestTypeHolderDefault(unittest.TestCase): diff --git a/samples/client/petstore/python-experimental/test/test_type_holder_example.py b/samples/client/petstore/python-experimental/test/test_type_holder_example.py index 7a2621494857..e1ee7c368628 100644 --- a/samples/client/petstore/python-experimental/test/test_type_holder_example.py +++ b/samples/client/petstore/python-experimental/test/test_type_holder_example.py @@ -5,18 +5,17 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.type_holder_example import TypeHolderExample # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.model.type_holder_example import TypeHolderExample class TestTypeHolderExample(unittest.TestCase): @@ -31,7 +30,7 @@ def tearDown(self): def testTypeHolderExample(self): """Test TypeHolderExample""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.type_holder_example.TypeHolderExample() # noqa: E501 + # model = TypeHolderExample() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_user.py b/samples/client/petstore/python-experimental/test/test_user.py index ad9386b6908e..7241bb589c52 100644 --- a/samples/client/petstore/python-experimental/test/test_user.py +++ b/samples/client/petstore/python-experimental/test/test_user.py @@ -5,18 +5,17 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.user import User # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.model.user import User class TestUser(unittest.TestCase): @@ -31,7 +30,7 @@ def tearDown(self): def testUser(self): """Test User""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.user.User() # noqa: E501 + # model = User() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_user_api.py b/samples/client/petstore/python-experimental/test/test_user_api.py index 6e8aed4f18c7..df306da07761 100644 --- a/samples/client/petstore/python-experimental/test/test_user_api.py +++ b/samples/client/petstore/python-experimental/test/test_user_api.py @@ -5,7 +5,7 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ @@ -16,14 +16,13 @@ import petstore_api from petstore_api.api.user_api import UserApi # noqa: E501 -from petstore_api.rest import ApiException class TestUserApi(unittest.TestCase): """UserApi unit test stubs""" def setUp(self): - self.api = petstore_api.api.user_api.UserApi() # noqa: E501 + self.api = UserApi() # noqa: E501 def tearDown(self): pass diff --git a/samples/client/petstore/python-experimental/test/test_xml_item.py b/samples/client/petstore/python-experimental/test/test_xml_item.py index 121f1ccb6623..4354664815ff 100644 --- a/samples/client/petstore/python-experimental/test/test_xml_item.py +++ b/samples/client/petstore/python-experimental/test/test_xml_item.py @@ -5,18 +5,17 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.xml_item import XmlItem # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.model.xml_item import XmlItem class TestXmlItem(unittest.TestCase): @@ -31,7 +30,7 @@ def tearDown(self): def testXmlItem(self): """Test XmlItem""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.xml_item.XmlItem() # noqa: E501 + # model = XmlItem() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/tests/test_api_client.py b/samples/client/petstore/python-experimental/tests/test_api_client.py index f36762e84e8e..c249bf1fc5e8 100644 --- a/samples/client/petstore/python-experimental/tests/test_api_client.py +++ b/samples/client/petstore/python-experimental/tests/test_api_client.py @@ -171,16 +171,20 @@ def test_sanitize_for_serialization(self): "status": "available", "photoUrls": ["http://foo.bar.com/3", "http://foo.bar.com/4"]} - pet = petstore_api.Pet(name=pet_dict["name"], photo_urls=pet_dict["photoUrls"]) + from petstore_api.model.pet import Pet + from petstore_api.model.category import Category + from petstore_api.model.tag import Tag + from petstore_api.model.string_boolean_map import StringBooleanMap + pet = Pet(name=pet_dict["name"], photo_urls=pet_dict["photoUrls"]) pet.id = pet_dict["id"] - cate = petstore_api.Category() + cate = Category() cate.id = pet_dict["category"]["id"] cate.name = pet_dict["category"]["name"] pet.category = cate - tag1 = petstore_api.Tag() + tag1 = Tag() tag1.id = pet_dict["tags"][0]["id"] tag1.full_name = pet_dict["tags"][0]["fullName"] - tag2 = petstore_api.Tag() + tag2 = Tag() tag2.id = pet_dict["tags"][1]["id"] tag2.full_name = pet_dict["tags"][1]["fullName"] pet.tags = [tag1, tag2] @@ -198,7 +202,7 @@ def test_sanitize_for_serialization(self): # model with additional proerties model_dict = {'some_key': True} - model = petstore_api.StringBooleanMap(**model_dict) + model = StringBooleanMap(**model_dict) result = self.api_client.sanitize_for_serialization(model) self.assertEqual(result, model_dict) diff --git a/samples/client/petstore/python-experimental/tests/test_api_exception.py b/samples/client/petstore/python-experimental/tests/test_api_exception.py index b26ef5252bbf..0d0771b57850 100644 --- a/samples/client/petstore/python-experimental/tests/test_api_exception.py +++ b/samples/client/petstore/python-experimental/tests/test_api_exception.py @@ -15,7 +15,6 @@ import unittest import petstore_api -from petstore_api.rest import ApiException from .util import id_gen @@ -23,17 +22,19 @@ class ApiExceptionTests(unittest.TestCase): def setUp(self): self.api_client = petstore_api.ApiClient() - self.pet_api = petstore_api.PetApi(self.api_client) + from petstore_api.api.pet_api import PetApi + self.pet_api = PetApi(self.api_client) self.setUpModels() def setUpModels(self): - self.category = petstore_api.Category() + from petstore_api.model import category, tag, pet + self.category = category.Category() self.category.id = id_gen() self.category.name = "dog" - self.tag = petstore_api.Tag() + self.tag = tag.Tag() self.tag.id = id_gen() self.tag.full_name = "blank" - self.pet = petstore_api.Pet(name="hello kity", photo_urls=["http://foo.bar.com/1", "http://foo.bar.com/2"]) + self.pet = pet.Pet(name="hello kity", photo_urls=["http://foo.bar.com/1", "http://foo.bar.com/2"]) self.pet.id = id_gen() self.pet.status = "sold" self.pet.category = self.category @@ -43,12 +44,12 @@ def test_404_error(self): self.pet_api.add_pet(self.pet) self.pet_api.delete_pet(pet_id=self.pet.id) - with self.checkRaiseRegex(ApiException, "Pet not found"): + with self.checkRaiseRegex(petstore_api.ApiException, "Pet not found"): self.pet_api.get_pet_by_id(pet_id=self.pet.id) try: self.pet_api.get_pet_by_id(pet_id=self.pet.id) - except ApiException as e: + except petstore_api.ApiException as e: self.assertEqual(e.status, 404) self.assertEqual(e.reason, "Not Found") self.checkRegex(e.body, "Pet not found") @@ -56,7 +57,7 @@ def test_404_error(self): def test_500_error(self): self.pet_api.add_pet(self.pet) - with self.checkRaiseRegex(ApiException, "Internal Server Error"): + with self.checkRaiseRegex(petstore_api.ApiException, "Internal Server Error"): self.pet_api.upload_file( pet_id=self.pet.id, additional_metadata="special" @@ -67,7 +68,7 @@ def test_500_error(self): pet_id=self.pet.id, additional_metadata="special" ) - except ApiException as e: + except petstore_api.ApiException as e: self.assertEqual(e.status, 500) self.assertEqual(e.reason, "Internal Server Error") self.checkRegex(e.body, "Error 500 Internal Server Error") diff --git a/samples/client/petstore/python-experimental/tests/test_deserialization.py b/samples/client/petstore/python-experimental/tests/test_deserialization.py index 83ecabe81d25..f73af24a9425 100644 --- a/samples/client/petstore/python-experimental/tests/test_deserialization.py +++ b/samples/client/petstore/python-experimental/tests/test_deserialization.py @@ -24,7 +24,18 @@ ApiKeyError, ApiValueError, ) - +from petstore_api.model import ( + enum_test, + pet, + animal, + dog, + parent_pet, + child_lizard, + category, + outer_enum, + outer_number, + string_boolean_map, +) from petstore_api.model_utils import ( file_type, int, @@ -56,19 +67,19 @@ def test_enum_test(self): response = MockResponse(data=json.dumps(data)) deserialized = self.deserialize(response, - ({str: (petstore_api.EnumTest,)},), True) + ({str: (enum_test.EnumTest,)},), True) self.assertTrue(isinstance(deserialized, dict)) self.assertTrue( - isinstance(deserialized['enum_test'], petstore_api.EnumTest)) - outer_enum_value = ( - petstore_api.OuterEnum.allowed_values[('value',)]["PLACED"]) - outer_enum = petstore_api.OuterEnum(outer_enum_value) - sample_instance = petstore_api.EnumTest( + isinstance(deserialized['enum_test'], enum_test.EnumTest)) + value = ( + outer_enum.OuterEnum.allowed_values[('value',)]["PLACED"]) + outer_enum_val = outer_enum.OuterEnum(value) + sample_instance = enum_test.EnumTest( enum_string="UPPER", enum_string_required="lower", enum_integer=1, enum_number=1.1, - outer_enum=outer_enum + outer_enum=outer_enum_val ) self.assertEqual(deserialized['enum_test'], sample_instance) @@ -97,9 +108,9 @@ def test_deserialize_dict_str_pet(self): response = MockResponse(data=json.dumps(data)) deserialized = self.deserialize(response, - ({str: (petstore_api.Pet,)},), True) + ({str: (pet.Pet,)},), True) self.assertTrue(isinstance(deserialized, dict)) - self.assertTrue(isinstance(deserialized['pet'], petstore_api.Pet)) + self.assertTrue(isinstance(deserialized['pet'], pet.Pet)) def test_deserialize_dict_str_dog(self): """ deserialize dict(str, Dog), use discriminator""" @@ -113,13 +124,13 @@ def test_deserialize_dict_str_dog(self): response = MockResponse(data=json.dumps(data)) deserialized = self.deserialize(response, - ({str: (petstore_api.Animal,)},), True) + ({str: (animal.Animal,)},), True) self.assertTrue(isinstance(deserialized, dict)) - dog = deserialized['dog'] - self.assertTrue(isinstance(dog, petstore_api.Dog)) - self.assertEqual(dog.class_name, "Dog") - self.assertEqual(dog.color, "white") - self.assertEqual(dog.breed, "Jack Russel Terrier") + dog_inst = deserialized['dog'] + self.assertTrue(isinstance(dog_inst, dog.Dog)) + self.assertEqual(dog_inst.class_name, "Dog") + self.assertEqual(dog_inst.color, "white") + self.assertEqual(dog_inst.breed, "Jack Russel Terrier") def test_deserialize_lizard(self): """ deserialize ChildLizard, use discriminator""" @@ -130,8 +141,8 @@ def test_deserialize_lizard(self): response = MockResponse(data=json.dumps(data)) lizard = self.deserialize(response, - (petstore_api.ParentPet,), True) - self.assertTrue(isinstance(lizard, petstore_api.ChildLizard)) + (parent_pet.ParentPet,), True) + self.assertTrue(isinstance(lizard, child_lizard.ChildLizard)) self.assertEqual(lizard.pet_type, "ChildLizard") self.assertEqual(lizard.loves_rocks, True) @@ -192,11 +203,11 @@ def test_deserialize_pet(self): } response = MockResponse(data=json.dumps(data)) - deserialized = self.deserialize(response, (petstore_api.Pet,), True) - self.assertTrue(isinstance(deserialized, petstore_api.Pet)) + deserialized = self.deserialize(response, (pet.Pet,), True) + self.assertTrue(isinstance(deserialized, pet.Pet)) self.assertEqual(deserialized.id, 0) self.assertEqual(deserialized.name, "doggie") - self.assertTrue(isinstance(deserialized.category, petstore_api.Category)) + self.assertTrue(isinstance(deserialized.category, category.Category)) self.assertEqual(deserialized.category.name, "string") self.assertTrue(isinstance(deserialized.tags, list)) self.assertEqual(deserialized.tags[0].full_name, "string") @@ -243,9 +254,9 @@ def test_deserialize_list_of_pet(self): response = MockResponse(data=json.dumps(data)) deserialized = self.deserialize(response, - ([petstore_api.Pet],), True) + ([pet.Pet],), True) self.assertTrue(isinstance(deserialized, list)) - self.assertTrue(isinstance(deserialized[0], petstore_api.Pet)) + self.assertTrue(isinstance(deserialized[0], pet.Pet)) self.assertEqual(deserialized[0].id, 0) self.assertEqual(deserialized[1].id, 1) self.assertEqual(deserialized[0].name, "doggie0") @@ -294,19 +305,19 @@ def test_deserialize_OuterEnum(self): with self.assertRaises(ApiValueError): self.deserialize( MockResponse(data=json.dumps("test str")), - (petstore_api.OuterEnum,), + (outer_enum.OuterEnum,), True ) # valid value works placed_str = ( - petstore_api.OuterEnum.allowed_values[('value',)]["PLACED"] + outer_enum.OuterEnum.allowed_values[('value',)]["PLACED"] ) response = MockResponse(data=json.dumps(placed_str)) - outer_enum = self.deserialize(response, - (petstore_api.OuterEnum,), True) - self.assertTrue(isinstance(outer_enum, petstore_api.OuterEnum)) - self.assertTrue(outer_enum.value == placed_str) + deserialized = self.deserialize(response, + (outer_enum.OuterEnum,), True) + self.assertTrue(isinstance(deserialized, outer_enum.OuterEnum)) + self.assertTrue(deserialized.value == placed_str) def test_deserialize_OuterNumber(self): """ deserialize OuterNumber """ @@ -314,7 +325,7 @@ def test_deserialize_OuterNumber(self): with self.assertRaises(ApiTypeError): deserialized = self.deserialize( MockResponse(data=json.dumps("test str")), - (petstore_api.OuterNumber,), + (outer_number.OuterNumber,), True ) @@ -322,17 +333,17 @@ def test_deserialize_OuterNumber(self): with self.assertRaises(ApiValueError): deserialized = self.deserialize( MockResponse(data=json.dumps(21.0)), - (petstore_api.OuterNumber,), + (outer_number.OuterNumber,), True ) # valid value works number_val = 11.0 response = MockResponse(data=json.dumps(number_val)) - outer_number = self.deserialize(response, - (petstore_api.OuterNumber,), True) - self.assertTrue(isinstance(outer_number, petstore_api.OuterNumber)) - self.assertTrue(outer_number.value == number_val) + number = self.deserialize(response, + (outer_number.OuterNumber,), True) + self.assertTrue(isinstance(number, outer_number.OuterNumber)) + self.assertTrue(number.value == number_val) def test_deserialize_file(self): """Ensures that file deserialization works""" @@ -416,17 +427,17 @@ def test_deserialize_string_boolean_map(self): with self.assertRaises(ApiTypeError): deserialized = self.deserialize( MockResponse(data=json.dumps("test str")), - (petstore_api.StringBooleanMap,), + (string_boolean_map.StringBooleanMap,), True ) # valid value works item_val = {'some_key': True} response = MockResponse(data=json.dumps(item_val)) - model = petstore_api.StringBooleanMap(**item_val) + model = string_boolean_map.StringBooleanMap(**item_val) deserialized = self.deserialize(response, - (petstore_api.StringBooleanMap,), True) - self.assertTrue(isinstance(deserialized, petstore_api.StringBooleanMap)) + (string_boolean_map.StringBooleanMap,), True) + self.assertTrue(isinstance(deserialized, string_boolean_map.StringBooleanMap)) self.assertTrue(deserialized['some_key'] == True) self.assertTrue(deserialized == model) diff --git a/samples/client/petstore/python-experimental/tests/test_enum_arrays.py b/samples/client/petstore/python-experimental/tests/test_enum_arrays.py deleted file mode 100644 index 96edf49c43a9..000000000000 --- a/samples/client/petstore/python-experimental/tests/test_enum_arrays.py +++ /dev/null @@ -1,155 +0,0 @@ -# coding: utf-8 - -# flake8: noqa - -""" -Run the tests. -$ pip install nose (optional) -$ cd petstore_api-python -$ nosetests -v -""" - -import os -import time -import unittest - -import petstore_api - -from petstore_api.exceptions import ( - ApiTypeError, - ApiKeyError, - ApiValueError, -) - -class EnumArraysTests(unittest.TestCase): - - def test_enumarrays_init(self): - # - # Check various combinations of valid values. - # - fish_or_crab = petstore_api.EnumArrays(just_symbol=">=") - self.assertEqual(fish_or_crab.just_symbol, ">=") - # if optional property is unset we raise an exception - with self.assertRaises(AttributeError) as exc: - self.assertEqual(fish_or_crab.array_enum, None) - - fish_or_crab = petstore_api.EnumArrays(just_symbol="$", array_enum=["fish"]) - self.assertEqual(fish_or_crab.just_symbol, "$") - self.assertEqual(fish_or_crab.array_enum, ["fish"]) - - fish_or_crab = petstore_api.EnumArrays(just_symbol=">=", array_enum=["fish"]) - self.assertEqual(fish_or_crab.just_symbol, ">=") - self.assertEqual(fish_or_crab.array_enum, ["fish"]) - - fish_or_crab = petstore_api.EnumArrays(just_symbol="$", array_enum=["crab"]) - self.assertEqual(fish_or_crab.just_symbol, "$") - self.assertEqual(fish_or_crab.array_enum, ["crab"]) - - - # - # Check if setting invalid values fails - # - with self.assertRaises(ApiValueError) as exc: - fish_or_crab = petstore_api.EnumArrays(just_symbol="<=") - - with self.assertRaises(ApiValueError) as exc: - fish_or_crab = petstore_api.EnumArrays(just_symbol="$", array_enum=["dog"]) - - with self.assertRaises(ApiTypeError) as exc: - fish_or_crab = petstore_api.EnumArrays(just_symbol=["$"], array_enum=["crab"]) - - - def test_enumarrays_setter(self): - - # - # Check various combinations of valid values - # - fish_or_crab = petstore_api.EnumArrays() - - fish_or_crab.just_symbol = ">=" - self.assertEqual(fish_or_crab.just_symbol, ">=") - - fish_or_crab.just_symbol = "$" - self.assertEqual(fish_or_crab.just_symbol, "$") - - fish_or_crab.array_enum = [] - self.assertEqual(fish_or_crab.array_enum, []) - - fish_or_crab.array_enum = ["fish"] - self.assertEqual(fish_or_crab.array_enum, ["fish"]) - - fish_or_crab.array_enum = ["fish", "fish", "fish"] - self.assertEqual(fish_or_crab.array_enum, ["fish", "fish", "fish"]) - - fish_or_crab.array_enum = ["crab"] - self.assertEqual(fish_or_crab.array_enum, ["crab"]) - - fish_or_crab.array_enum = ["crab", "fish"] - self.assertEqual(fish_or_crab.array_enum, ["crab", "fish"]) - - fish_or_crab.array_enum = ["crab", "fish", "crab", "fish"] - self.assertEqual(fish_or_crab.array_enum, ["crab", "fish", "crab", "fish"]) - - # - # Check if setting invalid values fails - # - fish_or_crab = petstore_api.EnumArrays() - with self.assertRaises(ApiValueError) as exc: - fish_or_crab.just_symbol = "!=" - - with self.assertRaises(ApiTypeError) as exc: - fish_or_crab.just_symbol = ["fish"] - - with self.assertRaises(ApiValueError) as exc: - fish_or_crab.array_enum = ["cat"] - - with self.assertRaises(ApiValueError) as exc: - fish_or_crab.array_enum = ["fish", "crab", "dog"] - - with self.assertRaises(ApiTypeError) as exc: - fish_or_crab.array_enum = "fish" - - - def test_todict(self): - # - # Check if dictionary serialization works - # - dollar_fish_crab_dict = { - 'just_symbol': "$", - 'array_enum': ["fish", "crab"] - } - - dollar_fish_crab = petstore_api.EnumArrays( - just_symbol="$", array_enum=["fish", "crab"]) - - self.assertEqual(dollar_fish_crab_dict, dollar_fish_crab.to_dict()) - - # - # Sanity check for different arrays - # - dollar_crab_fish_dict = { - 'just_symbol': "$", - 'array_enum': ["crab", "fish"] - } - - dollar_fish_crab = petstore_api.EnumArrays( - just_symbol="$", array_enum=["fish", "crab"]) - - self.assertNotEqual(dollar_crab_fish_dict, dollar_fish_crab.to_dict()) - - - def test_equals(self): - # - # Check if object comparison works - # - fish1 = petstore_api.EnumArrays(just_symbol="$", array_enum=["fish"]) - fish2 = petstore_api.EnumArrays(just_symbol="$", array_enum=["fish"]) - self.assertEqual(fish1, fish2) - - fish = petstore_api.EnumArrays(just_symbol="$", array_enum=["fish"]) - crab = petstore_api.EnumArrays(just_symbol="$", array_enum=["crab"]) - self.assertNotEqual(fish, crab) - - dollar = petstore_api.EnumArrays(just_symbol="$") - greater = petstore_api.EnumArrays(just_symbol=">=") - self.assertNotEqual(dollar, greater) diff --git a/samples/client/petstore/python-experimental/tests/test_map_test.py b/samples/client/petstore/python-experimental/tests/test_map_test.py deleted file mode 100644 index 13db5181c9ed..000000000000 --- a/samples/client/petstore/python-experimental/tests/test_map_test.py +++ /dev/null @@ -1,117 +0,0 @@ -# coding: utf-8 - -# flake8: noqa - -""" -Run the tests. -$ pip install nose (optional) -$ cd petstore_api-python -$ nosetests -v -""" - -import os -import time -import unittest - -import petstore_api - -from petstore_api.exceptions import ( - ApiTypeError, - ApiKeyError, - ApiValueError, -) - - -class MapTestTests(unittest.TestCase): - - def test_maptest_init(self): - # - # Test MapTest construction with valid values - # - up_or_low_dict = { - 'UPPER': "UP", - 'lower': "low" - } - map_enum_test = petstore_api.MapTest(map_of_enum_string=up_or_low_dict) - - self.assertEqual(map_enum_test.map_of_enum_string, up_or_low_dict) - - map_of_map_of_strings = { - 'valueDict': up_or_low_dict - } - map_enum_test = petstore_api.MapTest(map_map_of_string=map_of_map_of_strings) - - self.assertEqual(map_enum_test.map_map_of_string, map_of_map_of_strings) - - # - # Make sure that the init fails for invalid enum values - # - black_or_white_dict = { - 'black': "UP", - 'white': "low" - } - try: - map_enum_test = petstore_api.MapTest(map_of_enum_string=black_or_white_dict) - self.assertTrue(0) - except ValueError: - self.assertTrue(1) - - def test_maptest_setter(self): - # - # Check with some valid values - # - map_enum_test = petstore_api.MapTest() - up_or_low_dict = { - 'UPPER': "UP", - 'lower': "low" - } - map_enum_test.map_of_enum_string = up_or_low_dict - self.assertEqual(map_enum_test.map_of_enum_string, up_or_low_dict) - - # - # Check if the setter fails for invalid enum values - # - map_enum_test = petstore_api.MapTest() - black_or_white_dict = { - 'black': "UP", - 'white': "low" - } - with self.assertRaises(ApiValueError) as exc: - map_enum_test.map_of_enum_string = black_or_white_dict - - def test_todict(self): - # - # Check dictionary serialization - # - map_enum_test = petstore_api.MapTest() - up_or_low_dict = { - 'UPPER': "UP", - 'lower': "low" - } - map_of_map_of_strings = { - 'valueDict': up_or_low_dict - } - indirect_map = petstore_api.StringBooleanMap(**{ - 'option1': True - }) - direct_map = { - 'option2': False - } - map_enum_test.map_of_enum_string = up_or_low_dict - map_enum_test.map_map_of_string = map_of_map_of_strings - map_enum_test.indirect_map = indirect_map - map_enum_test.direct_map = direct_map - - self.assertEqual(map_enum_test.map_of_enum_string, up_or_low_dict) - self.assertEqual(map_enum_test.map_map_of_string, map_of_map_of_strings) - self.assertEqual(map_enum_test.indirect_map, indirect_map) - self.assertEqual(map_enum_test.direct_map, direct_map) - - expected_dict = { - 'map_of_enum_string': up_or_low_dict, - 'map_map_of_string': map_of_map_of_strings, - 'indirect_map': indirect_map.to_dict(), - 'direct_map': direct_map - } - - self.assertEqual(map_enum_test.to_dict(), expected_dict) diff --git a/samples/client/petstore/python-experimental/tests/test_order_model.py b/samples/client/petstore/python-experimental/tests/test_order_model.py deleted file mode 100644 index 31dc6e3661cd..000000000000 --- a/samples/client/petstore/python-experimental/tests/test_order_model.py +++ /dev/null @@ -1,27 +0,0 @@ -# coding: utf-8 - -# flake8: noqa - -""" -Run the tests. -$ pip install nose (optional) -$ cd petstore_api-python -$ nosetests -v -""" - -import os -import time -import unittest - -import petstore_api - - -class OrderModelTests(unittest.TestCase): - - def test_status(self): - order = petstore_api.Order() - order.status = "placed" - self.assertEqual("placed", order.status) - - with self.assertRaises(ValueError): - order.status = "invalid" diff --git a/samples/client/petstore/python-experimental/tests/test_pet_api.py b/samples/client/petstore/python-experimental/tests/test_pet_api.py index ee7e53ecad85..38d7a1cc0b82 100644 --- a/samples/client/petstore/python-experimental/tests/test_pet_api.py +++ b/samples/client/petstore/python-experimental/tests/test_pet_api.py @@ -30,7 +30,8 @@ ApiValueError, ApiTypeError, ) - +from petstore_api.api.pet_api import PetApi +from petstore_api.model import pet from .util import id_gen import urllib3 @@ -75,18 +76,19 @@ def setUp(self): config.host = HOST config.access_token = 'ACCESS_TOKEN' self.api_client = petstore_api.ApiClient(config) - self.pet_api = petstore_api.PetApi(self.api_client) + self.pet_api = PetApi(self.api_client) self.setUpModels() self.setUpFiles() def setUpModels(self): - self.category = petstore_api.Category() + from petstore_api.model import category, tag + self.category = category.Category() self.category.id = id_gen() self.category.name = "dog" - self.tag = petstore_api.Tag() + self.tag = tag.Tag() self.tag.id = id_gen() self.tag.name = "python-pet-tag" - self.pet = petstore_api.Pet(name="hello kity", photo_urls=["http://foo.bar.com/1", "http://foo.bar.com/2"]) + self.pet = pet.Pet(name="hello kity", photo_urls=["http://foo.bar.com/1", "http://foo.bar.com/2"]) self.pet.id = id_gen() self.pet.status = "sold" self.pet.category = self.category @@ -162,8 +164,8 @@ def test_timeout(self): self.pet_api.add_pet(self.pet, _request_timeout=(1, 2)) def test_separate_default_client_instances(self): - pet_api = petstore_api.PetApi() - pet_api2 = petstore_api.PetApi() + pet_api = PetApi() + pet_api2 = PetApi() self.assertNotEqual(pet_api.api_client, pet_api2.api_client) pet_api.api_client.user_agent = 'api client 3' @@ -172,8 +174,8 @@ def test_separate_default_client_instances(self): self.assertNotEqual(pet_api.api_client.user_agent, pet_api2.api_client.user_agent) def test_separate_default_config_instances(self): - pet_api = petstore_api.PetApi() - pet_api2 = petstore_api.PetApi() + pet_api = PetApi() + pet_api2 = PetApi() self.assertNotEqual(pet_api.api_client.configuration, pet_api2.api_client.configuration) pet_api.api_client.configuration.host = 'somehost' @@ -187,7 +189,7 @@ def test_async_request(self): thread = self.pet_api.get_pet_by_id(self.pet.id, async_req=True) result = thread.get() - self.assertIsInstance(result, petstore_api.Pet) + self.assertIsInstance(result, pet.Pet) def test_async_with_result(self): self.pet_api.add_pet(self.pet, async_req=False) @@ -208,7 +210,7 @@ def test_async_with_http_info(self): _return_http_data_only=False) data, status, headers = thread.get() - self.assertIsInstance(data, petstore_api.Pet) + self.assertIsInstance(data, pet.Pet) self.assertEqual(status, 200) def test_async_exception(self): diff --git a/samples/client/petstore/python-experimental/tests/test_pet_model.py b/samples/client/petstore/python-experimental/tests/test_pet_model.py deleted file mode 100644 index c3352015b973..000000000000 --- a/samples/client/petstore/python-experimental/tests/test_pet_model.py +++ /dev/null @@ -1,69 +0,0 @@ -# coding: utf-8 - -# flake8: noqa - -""" -Run the tests. -$ pip install nose (optional) -$ cd petstore_api-python -$ nosetests -v -""" - -import os -import time -import unittest - -import petstore_api - - -class PetModelTests(unittest.TestCase): - - def setUp(self): - self.pet = petstore_api.Pet(name="test name", photo_urls=["string"]) - self.pet.id = 1 - self.pet.status = "available" - cate = petstore_api.Category() - cate.id = 1 - cate.name = "dog" - self.pet.category = cate - tag = petstore_api.Tag() - tag.id = 1 - self.pet.tags = [tag] - - def test_to_str(self): - data = ("{'category': {'id': 1, 'name': 'dog'},\n" - " 'id': 1,\n" - " 'name': 'test name',\n" - " 'photo_urls': ['string'],\n" - " 'status': 'available',\n" - " 'tags': [{'id': 1}]}") - self.assertEqual(data, self.pet.to_str()) - - def test_equal(self): - self.pet1 = petstore_api.Pet(name="test name", photo_urls=["string"]) - self.pet1.id = 1 - self.pet1.status = "available" - cate1 = petstore_api.Category() - cate1.id = 1 - cate1.name = "dog" - self.pet.category = cate1 - tag1 = petstore_api.Tag() - tag1.id = 1 - self.pet1.tags = [tag1] - - self.pet2 = petstore_api.Pet(name="test name", photo_urls=["string"]) - self.pet2.id = 1 - self.pet2.status = "available" - cate2 = petstore_api.Category() - cate2.id = 1 - cate2.name = "dog" - self.pet.category = cate2 - tag2 = petstore_api.Tag() - tag2.id = 1 - self.pet2.tags = [tag2] - - self.assertTrue(self.pet1 == self.pet2) - - # reset pet1 tags to empty array so that object comparison returns false - self.pet1.tags = [] - self.assertFalse(self.pet1 == self.pet2) diff --git a/samples/client/petstore/python-experimental/tests/test_store_api.py b/samples/client/petstore/python-experimental/tests/test_store_api.py index 1817477aba69..a7c1d5dd6670 100644 --- a/samples/client/petstore/python-experimental/tests/test_store_api.py +++ b/samples/client/petstore/python-experimental/tests/test_store_api.py @@ -14,13 +14,13 @@ import unittest import petstore_api -from petstore_api.rest import ApiException +from petstore_api.api.store_api import StoreApi class StoreApiTests(unittest.TestCase): def setUp(self): - self.store_api = petstore_api.StoreApi() + self.store_api = StoreApi() def tearDown(self): # sleep 1 sec between two every 2 tests diff --git a/samples/openapi3/client/petstore/python-experimental/.openapi-generator/FILES b/samples/openapi3/client/petstore/python-experimental/.openapi-generator/FILES index 378e6965acc8..ffc326a12f08 100644 --- a/samples/openapi3/client/petstore/python-experimental/.openapi-generator/FILES +++ b/samples/openapi3/client/petstore/python-experimental/.openapi-generator/FILES @@ -102,92 +102,94 @@ petstore_api/api/pet_api.py petstore_api/api/store_api.py petstore_api/api/user_api.py petstore_api/api_client.py +petstore_api/apis/__init__.py petstore_api/configuration.py petstore_api/exceptions.py +petstore_api/model/__init__.py +petstore_api/model/additional_properties_class.py +petstore_api/model/address.py +petstore_api/model/animal.py +petstore_api/model/api_response.py +petstore_api/model/apple.py +petstore_api/model/apple_req.py +petstore_api/model/array_of_array_of_number_only.py +petstore_api/model/array_of_number_only.py +petstore_api/model/array_test.py +petstore_api/model/banana.py +petstore_api/model/banana_req.py +petstore_api/model/basque_pig.py +petstore_api/model/capitalization.py +petstore_api/model/cat.py +petstore_api/model/cat_all_of.py +petstore_api/model/category.py +petstore_api/model/child_cat.py +petstore_api/model/child_cat_all_of.py +petstore_api/model/class_model.py +petstore_api/model/client.py +petstore_api/model/complex_quadrilateral.py +petstore_api/model/danish_pig.py +petstore_api/model/dog.py +petstore_api/model/dog_all_of.py +petstore_api/model/drawing.py +petstore_api/model/enum_arrays.py +petstore_api/model/enum_class.py +petstore_api/model/enum_test.py +petstore_api/model/equilateral_triangle.py +petstore_api/model/file.py +petstore_api/model/file_schema_test_class.py +petstore_api/model/foo.py +petstore_api/model/format_test.py +petstore_api/model/fruit.py +petstore_api/model/fruit_req.py +petstore_api/model/gm_fruit.py +petstore_api/model/grandparent_animal.py +petstore_api/model/has_only_read_only.py +petstore_api/model/health_check_result.py +petstore_api/model/inline_object.py +petstore_api/model/inline_object1.py +petstore_api/model/inline_object2.py +petstore_api/model/inline_object3.py +petstore_api/model/inline_object4.py +petstore_api/model/inline_object5.py +petstore_api/model/inline_response_default.py +petstore_api/model/isosceles_triangle.py +petstore_api/model/list.py +petstore_api/model/mammal.py +petstore_api/model/map_test.py +petstore_api/model/mixed_properties_and_additional_properties_class.py +petstore_api/model/model200_response.py +petstore_api/model/model_return.py +petstore_api/model/name.py +petstore_api/model/nullable_class.py +petstore_api/model/nullable_shape.py +petstore_api/model/number_only.py +petstore_api/model/order.py +petstore_api/model/outer_composite.py +petstore_api/model/outer_enum.py +petstore_api/model/outer_enum_default_value.py +petstore_api/model/outer_enum_integer.py +petstore_api/model/outer_enum_integer_default_value.py +petstore_api/model/parent_pet.py +petstore_api/model/pet.py +petstore_api/model/pig.py +petstore_api/model/quadrilateral.py +petstore_api/model/quadrilateral_interface.py +petstore_api/model/read_only_first.py +petstore_api/model/scalene_triangle.py +petstore_api/model/shape.py +petstore_api/model/shape_interface.py +petstore_api/model/shape_or_null.py +petstore_api/model/simple_quadrilateral.py +petstore_api/model/special_model_name.py +petstore_api/model/string_boolean_map.py +petstore_api/model/tag.py +petstore_api/model/triangle.py +petstore_api/model/triangle_interface.py +petstore_api/model/user.py +petstore_api/model/whale.py +petstore_api/model/zebra.py petstore_api/model_utils.py petstore_api/models/__init__.py -petstore_api/models/additional_properties_class.py -petstore_api/models/address.py -petstore_api/models/animal.py -petstore_api/models/api_response.py -petstore_api/models/apple.py -petstore_api/models/apple_req.py -petstore_api/models/array_of_array_of_number_only.py -petstore_api/models/array_of_number_only.py -petstore_api/models/array_test.py -petstore_api/models/banana.py -petstore_api/models/banana_req.py -petstore_api/models/basque_pig.py -petstore_api/models/capitalization.py -petstore_api/models/cat.py -petstore_api/models/cat_all_of.py -petstore_api/models/category.py -petstore_api/models/child_cat.py -petstore_api/models/child_cat_all_of.py -petstore_api/models/class_model.py -petstore_api/models/client.py -petstore_api/models/complex_quadrilateral.py -petstore_api/models/danish_pig.py -petstore_api/models/dog.py -petstore_api/models/dog_all_of.py -petstore_api/models/drawing.py -petstore_api/models/enum_arrays.py -petstore_api/models/enum_class.py -petstore_api/models/enum_test.py -petstore_api/models/equilateral_triangle.py -petstore_api/models/file.py -petstore_api/models/file_schema_test_class.py -petstore_api/models/foo.py -petstore_api/models/format_test.py -petstore_api/models/fruit.py -petstore_api/models/fruit_req.py -petstore_api/models/gm_fruit.py -petstore_api/models/grandparent_animal.py -petstore_api/models/has_only_read_only.py -petstore_api/models/health_check_result.py -petstore_api/models/inline_object.py -petstore_api/models/inline_object1.py -petstore_api/models/inline_object2.py -petstore_api/models/inline_object3.py -petstore_api/models/inline_object4.py -petstore_api/models/inline_object5.py -petstore_api/models/inline_response_default.py -petstore_api/models/isosceles_triangle.py -petstore_api/models/list.py -petstore_api/models/mammal.py -petstore_api/models/map_test.py -petstore_api/models/mixed_properties_and_additional_properties_class.py -petstore_api/models/model200_response.py -petstore_api/models/model_return.py -petstore_api/models/name.py -petstore_api/models/nullable_class.py -petstore_api/models/nullable_shape.py -petstore_api/models/number_only.py -petstore_api/models/order.py -petstore_api/models/outer_composite.py -petstore_api/models/outer_enum.py -petstore_api/models/outer_enum_default_value.py -petstore_api/models/outer_enum_integer.py -petstore_api/models/outer_enum_integer_default_value.py -petstore_api/models/parent_pet.py -petstore_api/models/pet.py -petstore_api/models/pig.py -petstore_api/models/quadrilateral.py -petstore_api/models/quadrilateral_interface.py -petstore_api/models/read_only_first.py -petstore_api/models/scalene_triangle.py -petstore_api/models/shape.py -petstore_api/models/shape_interface.py -petstore_api/models/shape_or_null.py -petstore_api/models/simple_quadrilateral.py -petstore_api/models/special_model_name.py -petstore_api/models/string_boolean_map.py -petstore_api/models/tag.py -petstore_api/models/triangle.py -petstore_api/models/triangle_interface.py -petstore_api/models/user.py -petstore_api/models/whale.py -petstore_api/models/zebra.py petstore_api/rest.py petstore_api/signing.py requirements.txt diff --git a/samples/openapi3/client/petstore/python-experimental/README.md b/samples/openapi3/client/petstore/python-experimental/README.md index 9827e98d2a13..a542d727b93d 100644 --- a/samples/openapi3/client/petstore/python-experimental/README.md +++ b/samples/openapi3/client/petstore/python-experimental/README.md @@ -50,7 +50,8 @@ import datetime import time import petstore_api from pprint import pprint - +from petstore_api.api import another_fake_api +from petstore_api.model import client # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -62,8 +63,8 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = petstore_api.AnotherFakeApi(api_client) - client_client = petstore_api.Client() # client.Client | client model + api_instance = another_fake_api.AnotherFakeApi(api_client) + client_client = client.Client() # client.Client | client model try: # To test special tags @@ -71,7 +72,6 @@ with petstore_api.ApiClient(configuration) as api_client: pprint(api_response) except petstore_api.ApiException as e: print("Exception when calling AnotherFakeApi->call_123_test_special_tags: %s\n" % e) - ``` ## Documentation for API Endpoints @@ -253,3 +253,22 @@ Class | Method | HTTP request | Description +## Notes for Large OpenAPI documents +If the OpenAPI document is large, imports in petstore_api.apis and petstore_api.models may fail with a +RecursionError indicating the maximum recursion limit has been exceeded. In that case, there are a couple of solutions: + +Solution 1: +Use specific imports for apis and models like: +- `from petstore_api.api.default_api import DefaultApi` +- `from petstore_api.model.pet import Pet` + +Solution 1: +Before importing the package, adjust the maximum recursion limit as shown below: +``` +import sys +sys.setrecursionlimit(1500) +import petstore_api +from petstore_api.apis import * +from petstore_api.models import * +``` + diff --git a/samples/openapi3/client/petstore/python-experimental/docs/AnotherFakeApi.md b/samples/openapi3/client/petstore/python-experimental/docs/AnotherFakeApi.md index 7b8b3d6796d0..4290afb9ab04 100644 --- a/samples/openapi3/client/petstore/python-experimental/docs/AnotherFakeApi.md +++ b/samples/openapi3/client/petstore/python-experimental/docs/AnotherFakeApi.md @@ -20,6 +20,8 @@ To test special tags and operation ID starting with number from __future__ import print_function import time import petstore_api +from petstore_api.api import another_fake_api +from petstore_api.model import client from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -31,8 +33,8 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.AnotherFakeApi(api_client) - client_client = petstore_api.Client() # client.Client | client model + api_instance = another_fake_api.AnotherFakeApi(api_client) + client_client = client.Client() # client.Client | client model # example passing only required values which don't have defaults set try: diff --git a/samples/openapi3/client/petstore/python-experimental/docs/DefaultApi.md b/samples/openapi3/client/petstore/python-experimental/docs/DefaultApi.md index 91623f7a45ae..d5e28c8bc429 100644 --- a/samples/openapi3/client/petstore/python-experimental/docs/DefaultApi.md +++ b/samples/openapi3/client/petstore/python-experimental/docs/DefaultApi.md @@ -18,6 +18,8 @@ Method | HTTP request | Description from __future__ import print_function import time import petstore_api +from petstore_api.api import default_api +from petstore_api.model import inline_response_default from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -29,7 +31,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.DefaultApi(api_client) + api_instance = default_api.DefaultApi(api_client) # example, this endpoint has no required or optional parameters try: diff --git a/samples/openapi3/client/petstore/python-experimental/docs/FakeApi.md b/samples/openapi3/client/petstore/python-experimental/docs/FakeApi.md index a31649db9aaf..6bd8936f1b5b 100644 --- a/samples/openapi3/client/petstore/python-experimental/docs/FakeApi.md +++ b/samples/openapi3/client/petstore/python-experimental/docs/FakeApi.md @@ -31,6 +31,8 @@ Health check endpoint from __future__ import print_function import time import petstore_api +from petstore_api.api import fake_api +from petstore_api.model import health_check_result from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -42,7 +44,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) + api_instance = fake_api.FakeApi(api_client) # example, this endpoint has no required or optional parameters try: @@ -89,6 +91,7 @@ Test serialization of outer boolean types from __future__ import print_function import time import petstore_api +from petstore_api.api import fake_api from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -100,7 +103,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) + api_instance = fake_api.FakeApi(api_client) body = True # bool | Input boolean as post body (optional) # example passing only required values which don't have defaults set @@ -151,6 +154,8 @@ Test serialization of object with outer number type from __future__ import print_function import time import petstore_api +from petstore_api.api import fake_api +from petstore_api.model import outer_composite from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -162,8 +167,8 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) - outer_composite_outer_composite = petstore_api.OuterComposite() # outer_composite.OuterComposite | Input composite as post body (optional) + api_instance = fake_api.FakeApi(api_client) + outer_composite_outer_composite = outer_composite.OuterComposite() # outer_composite.OuterComposite | Input composite as post body (optional) # example passing only required values which don't have defaults set # and optional values @@ -213,6 +218,7 @@ Test serialization of outer number types from __future__ import print_function import time import petstore_api +from petstore_api.api import fake_api from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -224,7 +230,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) + api_instance = fake_api.FakeApi(api_client) body = 3.4 # float | Input number as post body (optional) # example passing only required values which don't have defaults set @@ -275,6 +281,7 @@ Test serialization of outer string types from __future__ import print_function import time import petstore_api +from petstore_api.api import fake_api from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -286,7 +293,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) + api_instance = fake_api.FakeApi(api_client) body = 'body_example' # str | Input string as post body (optional) # example passing only required values which don't have defaults set @@ -337,6 +344,8 @@ For this test, the body for this request much reference a schema named `File`. from __future__ import print_function import time import petstore_api +from petstore_api.api import fake_api +from petstore_api.model import file_schema_test_class from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -348,8 +357,8 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) - file_schema_test_class_file_schema_test_class = petstore_api.FileSchemaTestClass() # file_schema_test_class.FileSchemaTestClass | + api_instance = fake_api.FakeApi(api_client) + file_schema_test_class_file_schema_test_class = file_schema_test_class.FileSchemaTestClass() # file_schema_test_class.FileSchemaTestClass | # example passing only required values which don't have defaults set try: @@ -395,6 +404,8 @@ No authorization required from __future__ import print_function import time import petstore_api +from petstore_api.api import fake_api +from petstore_api.model import user from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -406,9 +417,9 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) + api_instance = fake_api.FakeApi(api_client) query = 'query_example' # str | - user_user = petstore_api.User() # user.User | + user_user = user.User() # user.User | # example passing only required values which don't have defaults set try: @@ -457,6 +468,8 @@ To test \"client\" model from __future__ import print_function import time import petstore_api +from petstore_api.api import fake_api +from petstore_api.model import client from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -468,8 +481,8 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) - client_client = petstore_api.Client() # client.Client | client model + api_instance = fake_api.FakeApi(api_client) + client_client = client.Client() # client.Client | client model # example passing only required values which don't have defaults set try: @@ -520,6 +533,7 @@ Fake endpoint for testing various parameters 假端點 偽のエンドポイン from __future__ import print_function import time import petstore_api +from petstore_api.api import fake_api from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -541,7 +555,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) + api_instance = fake_api.FakeApi(api_client) number = 3.4 # float | None double = 3.4 # float | None pattern_without_delimiter = 'pattern_without_delimiter_example' # str | None @@ -626,6 +640,7 @@ To test enum parameters from __future__ import print_function import time import petstore_api +from petstore_api.api import fake_api from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -637,7 +652,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) + api_instance = fake_api.FakeApi(api_client) enum_header_string_array = ['enum_header_string_array_example'] # [str] | Header parameter enum test (string array) (optional) enum_header_string = '-efg' # str | Header parameter enum test (string) (optional) if omitted the server will use the default value of '-efg' enum_query_string_array = ['enum_query_string_array_example'] # [str] | Query parameter enum test (string array) (optional) @@ -704,6 +719,7 @@ Fake endpoint to test group parameters (optional) from __future__ import print_function import time import petstore_api +from petstore_api.api import fake_api from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -724,7 +740,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) + api_instance = fake_api.FakeApi(api_client) required_string_group = 56 # int | Required String in group parameters required_boolean_group = True # bool | Required Boolean in group parameters required_int64_group = 56 # int | Required Integer in group parameters @@ -790,6 +806,7 @@ test inline additionalProperties from __future__ import print_function import time import petstore_api +from petstore_api.api import fake_api from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -801,7 +818,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) + api_instance = fake_api.FakeApi(api_client) request_body = {'key': 'request_body_example'} # {str: (str,)} | request body # example passing only required values which don't have defaults set @@ -849,6 +866,7 @@ test json serialization of form data from __future__ import print_function import time import petstore_api +from petstore_api.api import fake_api from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -860,7 +878,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) + api_instance = fake_api.FakeApi(api_client) param = 'param_example' # str | field1 param2 = 'param2_example' # str | field2 @@ -912,6 +930,7 @@ To test the collection format in query parameters from __future__ import print_function import time import petstore_api +from petstore_api.api import fake_api from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -923,7 +942,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) + api_instance = fake_api.FakeApi(api_client) pipe = ['pipe_example'] # [str] | ioutil = ['ioutil_example'] # [str] | http = ['http_example'] # [str] | diff --git a/samples/openapi3/client/petstore/python-experimental/docs/FakeClassnameTags123Api.md b/samples/openapi3/client/petstore/python-experimental/docs/FakeClassnameTags123Api.md index ab1eb4d62ca8..3568b3be2399 100644 --- a/samples/openapi3/client/petstore/python-experimental/docs/FakeClassnameTags123Api.md +++ b/samples/openapi3/client/petstore/python-experimental/docs/FakeClassnameTags123Api.md @@ -21,6 +21,8 @@ To test class name in snake case from __future__ import print_function import time import petstore_api +from petstore_api.api import fake_classname_tags_123_api +from petstore_api.model import client from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -46,8 +48,8 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = petstore_api.FakeClassnameTags123Api(api_client) - client_client = petstore_api.Client() # client.Client | client model + api_instance = fake_classname_tags_123_api.FakeClassnameTags123Api(api_client) + client_client = client.Client() # client.Client | client model # example passing only required values which don't have defaults set try: diff --git a/samples/openapi3/client/petstore/python-experimental/docs/PetApi.md b/samples/openapi3/client/petstore/python-experimental/docs/PetApi.md index 62bcfdd1bdd1..a5344a30f168 100644 --- a/samples/openapi3/client/petstore/python-experimental/docs/PetApi.md +++ b/samples/openapi3/client/petstore/python-experimental/docs/PetApi.md @@ -27,6 +27,8 @@ Add a new pet to the store from __future__ import print_function import time import petstore_api +from petstore_api.api import pet_api +from petstore_api.model import pet from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -108,8 +110,8 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN' # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = petstore_api.PetApi(api_client) - pet_pet = petstore_api.Pet() # pet.Pet | Pet object that needs to be added to the store + api_instance = pet_api.PetApi(api_client) + pet_pet = pet.Pet() # pet.Pet | Pet object that needs to be added to the store # example passing only required values which don't have defaults set try: @@ -157,6 +159,7 @@ Deletes a pet from __future__ import print_function import time import petstore_api +from petstore_api.api import pet_api from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -178,7 +181,7 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN' # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = petstore_api.PetApi(api_client) + api_instance = pet_api.PetApi(api_client) pet_id = 56 # int | Pet id to delete api_key = 'api_key_example' # str | (optional) @@ -239,6 +242,8 @@ Multiple status values can be provided with comma separated strings from __future__ import print_function import time import petstore_api +from petstore_api.api import pet_api +from petstore_api.model import pet from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -320,7 +325,7 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN' # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = petstore_api.PetApi(api_client) + api_instance = pet_api.PetApi(api_client) status = ['status_example'] # [str] | Status values that need to be considered for filter # example passing only required values which don't have defaults set @@ -373,6 +378,8 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 from __future__ import print_function import time import petstore_api +from petstore_api.api import pet_api +from petstore_api.model import pet from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -454,7 +461,7 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN' # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = petstore_api.PetApi(api_client) + api_instance = pet_api.PetApi(api_client) tags = ['tags_example'] # [str] | Tags to filter by # example passing only required values which don't have defaults set @@ -507,6 +514,8 @@ Returns a single pet from __future__ import print_function import time import petstore_api +from petstore_api.api import pet_api +from petstore_api.model import pet from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -532,7 +541,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = petstore_api.PetApi(api_client) + api_instance = pet_api.PetApi(api_client) pet_id = 56 # int | ID of pet to return # example passing only required values which don't have defaults set @@ -584,6 +593,8 @@ Update an existing pet from __future__ import print_function import time import petstore_api +from petstore_api.api import pet_api +from petstore_api.model import pet from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -665,8 +676,8 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN' # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = petstore_api.PetApi(api_client) - pet_pet = petstore_api.Pet() # pet.Pet | Pet object that needs to be added to the store + api_instance = pet_api.PetApi(api_client) + pet_pet = pet.Pet() # pet.Pet | Pet object that needs to be added to the store # example passing only required values which don't have defaults set try: @@ -716,6 +727,7 @@ Updates a pet in the store with form data from __future__ import print_function import time import petstore_api +from petstore_api.api import pet_api from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -737,7 +749,7 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN' # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = petstore_api.PetApi(api_client) + api_instance = pet_api.PetApi(api_client) pet_id = 56 # int | ID of pet that needs to be updated name = 'name_example' # str | Updated name of the pet (optional) status = 'status_example' # str | Updated status of the pet (optional) @@ -798,6 +810,8 @@ uploads an image from __future__ import print_function import time import petstore_api +from petstore_api.api import pet_api +from petstore_api.model import api_response from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -819,7 +833,7 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN' # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = petstore_api.PetApi(api_client) + api_instance = pet_api.PetApi(api_client) pet_id = 56 # int | ID of pet to update additional_metadata = 'additional_metadata_example' # str | Additional data to pass to server (optional) file = open('/path/to/file', 'rb') # file_type | file to upload (optional) @@ -882,6 +896,8 @@ uploads an image (required) from __future__ import print_function import time import petstore_api +from petstore_api.api import pet_api +from petstore_api.model import api_response from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -903,7 +919,7 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN' # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = petstore_api.PetApi(api_client) + api_instance = pet_api.PetApi(api_client) pet_id = 56 # int | ID of pet to update required_file = open('/path/to/file', 'rb') # file_type | file to upload additional_metadata = 'additional_metadata_example' # str | Additional data to pass to server (optional) diff --git a/samples/openapi3/client/petstore/python-experimental/docs/StoreApi.md b/samples/openapi3/client/petstore/python-experimental/docs/StoreApi.md index 4a7b890a1cc1..2cebd103e1f8 100644 --- a/samples/openapi3/client/petstore/python-experimental/docs/StoreApi.md +++ b/samples/openapi3/client/petstore/python-experimental/docs/StoreApi.md @@ -23,6 +23,7 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or non from __future__ import print_function import time import petstore_api +from petstore_api.api import store_api from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -34,7 +35,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.StoreApi(api_client) + api_instance = store_api.StoreApi(api_client) order_id = 'order_id_example' # str | ID of the order that needs to be deleted # example passing only required values which don't have defaults set @@ -86,6 +87,7 @@ Returns a map of status codes to quantities from __future__ import print_function import time import petstore_api +from petstore_api.api import store_api from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -111,7 +113,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = petstore_api.StoreApi(api_client) + api_instance = store_api.StoreApi(api_client) # example, this endpoint has no required or optional parameters try: @@ -158,6 +160,8 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge from __future__ import print_function import time import petstore_api +from petstore_api.api import store_api +from petstore_api.model import order from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -169,7 +173,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.StoreApi(api_client) + api_instance = store_api.StoreApi(api_client) order_id = 56 # int | ID of pet that needs to be fetched # example passing only required values which don't have defaults set @@ -220,6 +224,8 @@ Place an order for a pet from __future__ import print_function import time import petstore_api +from petstore_api.api import store_api +from petstore_api.model import order from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -231,8 +237,8 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.StoreApi(api_client) - order_order = petstore_api.Order() # order.Order | order placed for purchasing the pet + api_instance = store_api.StoreApi(api_client) + order_order = order.Order() # order.Order | order placed for purchasing the pet # example passing only required values which don't have defaults set try: diff --git a/samples/openapi3/client/petstore/python-experimental/docs/UserApi.md b/samples/openapi3/client/petstore/python-experimental/docs/UserApi.md index 4aa31e100bb0..ffcdef6d343c 100644 --- a/samples/openapi3/client/petstore/python-experimental/docs/UserApi.md +++ b/samples/openapi3/client/petstore/python-experimental/docs/UserApi.md @@ -27,6 +27,8 @@ This can only be done by the logged in user. from __future__ import print_function import time import petstore_api +from petstore_api.api import user_api +from petstore_api.model import user from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -38,8 +40,8 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.UserApi(api_client) - user_user = petstore_api.User() # user.User | Created user object + api_instance = user_api.UserApi(api_client) + user_user = user.User() # user.User | Created user object # example passing only required values which don't have defaults set try: @@ -86,6 +88,8 @@ Creates list of users with given input array from __future__ import print_function import time import petstore_api +from petstore_api.api import user_api +from petstore_api.model import user from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -97,8 +101,8 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.UserApi(api_client) - user_user = [petstore_api.User()] # [user.User] | List of user object + api_instance = user_api.UserApi(api_client) + user_user = [user.User()] # [user.User] | List of user object # example passing only required values which don't have defaults set try: @@ -145,6 +149,8 @@ Creates list of users with given input array from __future__ import print_function import time import petstore_api +from petstore_api.api import user_api +from petstore_api.model import user from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -156,8 +162,8 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.UserApi(api_client) - user_user = [petstore_api.User()] # [user.User] | List of user object + api_instance = user_api.UserApi(api_client) + user_user = [user.User()] # [user.User] | List of user object # example passing only required values which don't have defaults set try: @@ -206,6 +212,7 @@ This can only be done by the logged in user. from __future__ import print_function import time import petstore_api +from petstore_api.api import user_api from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -217,7 +224,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.UserApi(api_client) + api_instance = user_api.UserApi(api_client) username = 'username_example' # str | The name that needs to be deleted # example passing only required values which don't have defaults set @@ -266,6 +273,8 @@ Get user by user name from __future__ import print_function import time import petstore_api +from petstore_api.api import user_api +from petstore_api.model import user from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -277,7 +286,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.UserApi(api_client) + api_instance = user_api.UserApi(api_client) username = 'username_example' # str | The name that needs to be fetched. Use user1 for testing. # example passing only required values which don't have defaults set @@ -328,6 +337,7 @@ Logs user into the system from __future__ import print_function import time import petstore_api +from petstore_api.api import user_api from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -339,7 +349,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.UserApi(api_client) + api_instance = user_api.UserApi(api_client) username = 'username_example' # str | The user name for login password = 'password_example' # str | The password for login in clear text @@ -391,6 +401,7 @@ Logs out current logged in user session from __future__ import print_function import time import petstore_api +from petstore_api.api import user_api from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -402,7 +413,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.UserApi(api_client) + api_instance = user_api.UserApi(api_client) # example, this endpoint has no required or optional parameters try: @@ -448,6 +459,8 @@ This can only be done by the logged in user. from __future__ import print_function import time import petstore_api +from petstore_api.api import user_api +from petstore_api.model import user from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -459,9 +472,9 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.UserApi(api_client) + api_instance = user_api.UserApi(api_client) username = 'username_example' # str | name that need to be deleted - user_user = petstore_api.User() # user.User | Updated user object + user_user = user.User() # user.User | Updated user object # example passing only required values which don't have defaults set try: diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/__init__.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/__init__.py index 8b945d032fbe..fb7630e30d59 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/__init__.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/__init__.py @@ -16,15 +16,6 @@ __version__ = "1.0.0" -# import apis into sdk package -from petstore_api.api.another_fake_api import AnotherFakeApi -from petstore_api.api.default_api import DefaultApi -from petstore_api.api.fake_api import FakeApi -from petstore_api.api.fake_classname_tags_123_api import FakeClassnameTags123Api -from petstore_api.api.pet_api import PetApi -from petstore_api.api.store_api import StoreApi -from petstore_api.api.user_api import UserApi - # import ApiClient from petstore_api.api_client import ApiClient @@ -34,91 +25,8 @@ # import exceptions from petstore_api.exceptions import OpenApiException +from petstore_api.exceptions import ApiAttributeError from petstore_api.exceptions import ApiTypeError from petstore_api.exceptions import ApiValueError from petstore_api.exceptions import ApiKeyError -from petstore_api.exceptions import ApiException - -# import models into sdk package -from petstore_api.models.additional_properties_class import AdditionalPropertiesClass -from petstore_api.models.address import Address -from petstore_api.models.animal import Animal -from petstore_api.models.api_response import ApiResponse -from petstore_api.models.apple import Apple -from petstore_api.models.apple_req import AppleReq -from petstore_api.models.array_of_array_of_number_only import ArrayOfArrayOfNumberOnly -from petstore_api.models.array_of_number_only import ArrayOfNumberOnly -from petstore_api.models.array_test import ArrayTest -from petstore_api.models.banana import Banana -from petstore_api.models.banana_req import BananaReq -from petstore_api.models.basque_pig import BasquePig -from petstore_api.models.capitalization import Capitalization -from petstore_api.models.cat import Cat -from petstore_api.models.cat_all_of import CatAllOf -from petstore_api.models.category import Category -from petstore_api.models.child_cat import ChildCat -from petstore_api.models.child_cat_all_of import ChildCatAllOf -from petstore_api.models.class_model import ClassModel -from petstore_api.models.client import Client -from petstore_api.models.complex_quadrilateral import ComplexQuadrilateral -from petstore_api.models.danish_pig import DanishPig -from petstore_api.models.dog import Dog -from petstore_api.models.dog_all_of import DogAllOf -from petstore_api.models.drawing import Drawing -from petstore_api.models.enum_arrays import EnumArrays -from petstore_api.models.enum_class import EnumClass -from petstore_api.models.enum_test import EnumTest -from petstore_api.models.equilateral_triangle import EquilateralTriangle -from petstore_api.models.file import File -from petstore_api.models.file_schema_test_class import FileSchemaTestClass -from petstore_api.models.foo import Foo -from petstore_api.models.format_test import FormatTest -from petstore_api.models.fruit import Fruit -from petstore_api.models.fruit_req import FruitReq -from petstore_api.models.gm_fruit import GmFruit -from petstore_api.models.grandparent_animal import GrandparentAnimal -from petstore_api.models.has_only_read_only import HasOnlyReadOnly -from petstore_api.models.health_check_result import HealthCheckResult -from petstore_api.models.inline_object import InlineObject -from petstore_api.models.inline_object1 import InlineObject1 -from petstore_api.models.inline_object2 import InlineObject2 -from petstore_api.models.inline_object3 import InlineObject3 -from petstore_api.models.inline_object4 import InlineObject4 -from petstore_api.models.inline_object5 import InlineObject5 -from petstore_api.models.inline_response_default import InlineResponseDefault -from petstore_api.models.isosceles_triangle import IsoscelesTriangle -from petstore_api.models.list import List -from petstore_api.models.mammal import Mammal -from petstore_api.models.map_test import MapTest -from petstore_api.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass -from petstore_api.models.model200_response import Model200Response -from petstore_api.models.model_return import ModelReturn -from petstore_api.models.name import Name -from petstore_api.models.nullable_class import NullableClass -from petstore_api.models.nullable_shape import NullableShape -from petstore_api.models.number_only import NumberOnly -from petstore_api.models.order import Order -from petstore_api.models.outer_composite import OuterComposite -from petstore_api.models.outer_enum import OuterEnum -from petstore_api.models.outer_enum_default_value import OuterEnumDefaultValue -from petstore_api.models.outer_enum_integer import OuterEnumInteger -from petstore_api.models.outer_enum_integer_default_value import OuterEnumIntegerDefaultValue -from petstore_api.models.parent_pet import ParentPet -from petstore_api.models.pet import Pet -from petstore_api.models.pig import Pig -from petstore_api.models.quadrilateral import Quadrilateral -from petstore_api.models.quadrilateral_interface import QuadrilateralInterface -from petstore_api.models.read_only_first import ReadOnlyFirst -from petstore_api.models.scalene_triangle import ScaleneTriangle -from petstore_api.models.shape import Shape -from petstore_api.models.shape_interface import ShapeInterface -from petstore_api.models.shape_or_null import ShapeOrNull -from petstore_api.models.simple_quadrilateral import SimpleQuadrilateral -from petstore_api.models.special_model_name import SpecialModelName -from petstore_api.models.string_boolean_map import StringBooleanMap -from petstore_api.models.tag import Tag -from petstore_api.models.triangle import Triangle -from petstore_api.models.triangle_interface import TriangleInterface -from petstore_api.models.user import User -from petstore_api.models.whale import Whale -from petstore_api.models.zebra import Zebra +from petstore_api.exceptions import ApiException \ No newline at end of file diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/api/another_fake_api.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/api/another_fake_api.py index 6c7e40c24825..cb2881b7ae8c 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/api/another_fake_api.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/api/another_fake_api.py @@ -34,7 +34,7 @@ str, validate_and_convert_types ) -from petstore_api.models import client +from petstore_api.model import client class AnotherFakeApi(object): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/api/default_api.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/api/default_api.py index 3e46d7928cb5..25c8e40e5252 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/api/default_api.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/api/default_api.py @@ -34,7 +34,7 @@ str, validate_and_convert_types ) -from petstore_api.models import inline_response_default +from petstore_api.model import inline_response_default class DefaultApi(object): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/api/fake_api.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/api/fake_api.py index fd5096ba6de1..69531b0525fa 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/api/fake_api.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/api/fake_api.py @@ -34,11 +34,11 @@ str, validate_and_convert_types ) -from petstore_api.models import health_check_result -from petstore_api.models import outer_composite -from petstore_api.models import file_schema_test_class -from petstore_api.models import user -from petstore_api.models import client +from petstore_api.model import health_check_result +from petstore_api.model import outer_composite +from petstore_api.model import file_schema_test_class +from petstore_api.model import user +from petstore_api.model import client class FakeApi(object): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/api/fake_classname_tags_123_api.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/api/fake_classname_tags_123_api.py index f2a13a0b92fd..2ed92b4d0f33 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/api/fake_classname_tags_123_api.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/api/fake_classname_tags_123_api.py @@ -34,7 +34,7 @@ str, validate_and_convert_types ) -from petstore_api.models import client +from petstore_api.model import client class FakeClassnameTags123Api(object): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/api/pet_api.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/api/pet_api.py index 1a0fdb48bf4c..9ccaf11c268d 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/api/pet_api.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/api/pet_api.py @@ -34,8 +34,8 @@ str, validate_and_convert_types ) -from petstore_api.models import pet -from petstore_api.models import api_response +from petstore_api.model import pet +from petstore_api.model import api_response class PetApi(object): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/api/store_api.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/api/store_api.py index 46fce50d29d3..67648f5ee722 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/api/store_api.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/api/store_api.py @@ -34,7 +34,7 @@ str, validate_and_convert_types ) -from petstore_api.models import order +from petstore_api.model import order class StoreApi(object): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/api/user_api.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/api/user_api.py index e354babbfe5c..e5f5ffe886c9 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/api/user_api.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/api/user_api.py @@ -34,7 +34,7 @@ str, validate_and_convert_types ) -from petstore_api.models import user +from petstore_api.model import user class UserApi(object): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/apis/__init__.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/apis/__init__.py new file mode 100644 index 000000000000..41cbd0aa055e --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/apis/__init__.py @@ -0,0 +1,21 @@ +# coding: utf-8 + +# flake8: noqa + +# import all apis into this package +# if you have many ampis here with many many models used in each api this may +# raise a RecursionError +# to avoid this, import only the api that you directly need like: +# from .api.pet_api import PetApi +# or import this package, but before doing it, use: +# import sys +# sys.setrecursionlimit(n) + +# import apis into api package +from petstore_api.api.another_fake_api import AnotherFakeApi +from petstore_api.api.default_api import DefaultApi +from petstore_api.api.fake_api import FakeApi +from petstore_api.api.fake_classname_tags_123_api import FakeClassnameTags123Api +from petstore_api.api.pet_api import PetApi +from petstore_api.api.store_api import StoreApi +from petstore_api.api.user_api import UserApi diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/__init__.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/__init__.py new file mode 100644 index 000000000000..cfe32b784926 --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/__init__.py @@ -0,0 +1,5 @@ +# we can not import model classes here because that would create a circular +# reference which would not work in python2 +# do not import all models into this module because that uses a lot of memory and stack frames +# if you need the ability to import all models from one package, import them with +# from {{packageName}.models import ModelA, ModelB diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/additional_properties_class.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/additional_properties_class.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/additional_properties_class.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/additional_properties_class.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/address.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/address.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/address.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/address.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/animal.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/animal.py similarity index 97% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/animal.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/animal.py index 641c9c16e279..7ba62dad1622 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/animal.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/animal.py @@ -34,15 +34,15 @@ validate_get_composed_info, ) try: - from petstore_api.models import cat + from petstore_api.model import cat except ImportError: cat = sys.modules[ - 'petstore_api.models.cat'] + 'petstore_api.model.cat'] try: - from petstore_api.models import dog + from petstore_api.model import dog except ImportError: dog = sys.modules[ - 'petstore_api.models.dog'] + 'petstore_api.model.dog'] class Animal(ModelNormal): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/api_response.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/api_response.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/api_response.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/api_response.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/apple.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/apple.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/apple.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/apple.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/apple_req.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/apple_req.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/apple_req.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/apple_req.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/array_of_array_of_number_only.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_of_array_of_number_only.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/array_of_array_of_number_only.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_of_array_of_number_only.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/array_of_number_only.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_of_number_only.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/array_of_number_only.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_of_number_only.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/array_test.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_test.py similarity index 98% rename from samples/client/petstore/python-experimental/petstore_api/models/array_test.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_test.py index 0eed8d054611..e2bc76832b27 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/array_test.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_test.py @@ -34,10 +34,10 @@ validate_get_composed_info, ) try: - from petstore_api.models import read_only_first + from petstore_api.model import read_only_first except ImportError: read_only_first = sys.modules[ - 'petstore_api.models.read_only_first'] + 'petstore_api.model.read_only_first'] class ArrayTest(ModelNormal): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/banana.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/banana.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/banana.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/banana.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/banana_req.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/banana_req.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/banana_req.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/banana_req.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/basque_pig.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/basque_pig.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/basque_pig.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/basque_pig.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/capitalization.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/capitalization.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/capitalization.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/capitalization.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/cat.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/cat.py similarity index 97% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/cat.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/cat.py index b80672252538..ab01b1f0a9c5 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/cat.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/cat.py @@ -34,20 +34,20 @@ validate_get_composed_info, ) try: - from petstore_api.models import address + from petstore_api.model import address except ImportError: address = sys.modules[ - 'petstore_api.models.address'] + 'petstore_api.model.address'] try: - from petstore_api.models import animal + from petstore_api.model import animal except ImportError: animal = sys.modules[ - 'petstore_api.models.animal'] + 'petstore_api.model.animal'] try: - from petstore_api.models import cat_all_of + from petstore_api.model import cat_all_of except ImportError: cat_all_of = sys.modules[ - 'petstore_api.models.cat_all_of'] + 'petstore_api.model.cat_all_of'] class Cat(ModelComposed): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/cat_all_of.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/cat_all_of.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/cat_all_of.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/cat_all_of.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/category.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/category.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/category.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/category.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/child_cat.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/child_cat.py similarity index 97% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/child_cat.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/child_cat.py index f838e61b4014..996f3e0098e2 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/child_cat.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/child_cat.py @@ -34,15 +34,15 @@ validate_get_composed_info, ) try: - from petstore_api.models import child_cat_all_of + from petstore_api.model import child_cat_all_of except ImportError: child_cat_all_of = sys.modules[ - 'petstore_api.models.child_cat_all_of'] + 'petstore_api.model.child_cat_all_of'] try: - from petstore_api.models import parent_pet + from petstore_api.model import parent_pet except ImportError: parent_pet = sys.modules[ - 'petstore_api.models.parent_pet'] + 'petstore_api.model.parent_pet'] class ChildCat(ModelComposed): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/child_cat_all_of.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/child_cat_all_of.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/child_cat_all_of.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/child_cat_all_of.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/class_model.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/class_model.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/class_model.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/class_model.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/client.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/client.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/client.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/client.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/complex_quadrilateral.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/complex_quadrilateral.py similarity index 97% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/complex_quadrilateral.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/complex_quadrilateral.py index 03497b55fb45..7cc5a70032a0 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/complex_quadrilateral.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/complex_quadrilateral.py @@ -34,15 +34,15 @@ validate_get_composed_info, ) try: - from petstore_api.models import quadrilateral_interface + from petstore_api.model import quadrilateral_interface except ImportError: quadrilateral_interface = sys.modules[ - 'petstore_api.models.quadrilateral_interface'] + 'petstore_api.model.quadrilateral_interface'] try: - from petstore_api.models import shape_interface + from petstore_api.model import shape_interface except ImportError: shape_interface = sys.modules[ - 'petstore_api.models.shape_interface'] + 'petstore_api.model.shape_interface'] class ComplexQuadrilateral(ModelComposed): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/danish_pig.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/danish_pig.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/danish_pig.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/danish_pig.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/dog.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/dog.py similarity index 98% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/dog.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/dog.py index e35c52bd69d0..a100eb3c70ef 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/dog.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/dog.py @@ -34,15 +34,15 @@ validate_get_composed_info, ) try: - from petstore_api.models import animal + from petstore_api.model import animal except ImportError: animal = sys.modules[ - 'petstore_api.models.animal'] + 'petstore_api.model.animal'] try: - from petstore_api.models import dog_all_of + from petstore_api.model import dog_all_of except ImportError: dog_all_of = sys.modules[ - 'petstore_api.models.dog_all_of'] + 'petstore_api.model.dog_all_of'] class Dog(ModelComposed): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/dog_all_of.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/dog_all_of.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/dog_all_of.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/dog_all_of.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/drawing.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/drawing.py similarity index 95% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/drawing.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/drawing.py index a9cf39773d6b..8d61b20887d1 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/drawing.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/drawing.py @@ -34,25 +34,25 @@ validate_get_composed_info, ) try: - from petstore_api.models import fruit + from petstore_api.model import fruit except ImportError: fruit = sys.modules[ - 'petstore_api.models.fruit'] + 'petstore_api.model.fruit'] try: - from petstore_api.models import nullable_shape + from petstore_api.model import nullable_shape except ImportError: nullable_shape = sys.modules[ - 'petstore_api.models.nullable_shape'] + 'petstore_api.model.nullable_shape'] try: - from petstore_api.models import shape + from petstore_api.model import shape except ImportError: shape = sys.modules[ - 'petstore_api.models.shape'] + 'petstore_api.model.shape'] try: - from petstore_api.models import shape_or_null + from petstore_api.model import shape_or_null except ImportError: shape_or_null = sys.modules[ - 'petstore_api.models.shape_or_null'] + 'petstore_api.model.shape_or_null'] class Drawing(ModelNormal): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/enum_arrays.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/enum_arrays.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/enum_arrays.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/enum_arrays.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/enum_class.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/enum_class.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/enum_class.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/enum_class.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/enum_test.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/enum_test.py similarity index 95% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/enum_test.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/enum_test.py index ba6118114b07..1320cc416e7d 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/enum_test.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/enum_test.py @@ -34,25 +34,25 @@ validate_get_composed_info, ) try: - from petstore_api.models import outer_enum + from petstore_api.model import outer_enum except ImportError: outer_enum = sys.modules[ - 'petstore_api.models.outer_enum'] + 'petstore_api.model.outer_enum'] try: - from petstore_api.models import outer_enum_default_value + from petstore_api.model import outer_enum_default_value except ImportError: outer_enum_default_value = sys.modules[ - 'petstore_api.models.outer_enum_default_value'] + 'petstore_api.model.outer_enum_default_value'] try: - from petstore_api.models import outer_enum_integer + from petstore_api.model import outer_enum_integer except ImportError: outer_enum_integer = sys.modules[ - 'petstore_api.models.outer_enum_integer'] + 'petstore_api.model.outer_enum_integer'] try: - from petstore_api.models import outer_enum_integer_default_value + from petstore_api.model import outer_enum_integer_default_value except ImportError: outer_enum_integer_default_value = sys.modules[ - 'petstore_api.models.outer_enum_integer_default_value'] + 'petstore_api.model.outer_enum_integer_default_value'] class EnumTest(ModelNormal): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/equilateral_triangle.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/equilateral_triangle.py similarity index 97% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/equilateral_triangle.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/equilateral_triangle.py index c601d01dde7f..44f69a5dced7 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/equilateral_triangle.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/equilateral_triangle.py @@ -34,15 +34,15 @@ validate_get_composed_info, ) try: - from petstore_api.models import shape_interface + from petstore_api.model import shape_interface except ImportError: shape_interface = sys.modules[ - 'petstore_api.models.shape_interface'] + 'petstore_api.model.shape_interface'] try: - from petstore_api.models import triangle_interface + from petstore_api.model import triangle_interface except ImportError: triangle_interface = sys.modules[ - 'petstore_api.models.triangle_interface'] + 'petstore_api.model.triangle_interface'] class EquilateralTriangle(ModelComposed): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/file.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/file.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/file.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/file.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/file_schema_test_class.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/file_schema_test_class.py similarity index 98% rename from samples/client/petstore/python-experimental/petstore_api/models/file_schema_test_class.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/file_schema_test_class.py index 79e5638ccc94..0a9471e9e420 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/file_schema_test_class.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/file_schema_test_class.py @@ -34,10 +34,10 @@ validate_get_composed_info, ) try: - from petstore_api.models import file + from petstore_api.model import file except ImportError: file = sys.modules[ - 'petstore_api.models.file'] + 'petstore_api.model.file'] class FileSchemaTestClass(ModelNormal): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/foo.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/foo.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/foo.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/foo.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/format_test.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/format_test.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/format_test.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/format_test.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/fruit.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/fruit.py similarity index 98% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/fruit.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/fruit.py index 1058c953ee60..244497b64a10 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/fruit.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/fruit.py @@ -34,15 +34,15 @@ validate_get_composed_info, ) try: - from petstore_api.models import apple + from petstore_api.model import apple except ImportError: apple = sys.modules[ - 'petstore_api.models.apple'] + 'petstore_api.model.apple'] try: - from petstore_api.models import banana + from petstore_api.model import banana except ImportError: banana = sys.modules[ - 'petstore_api.models.banana'] + 'petstore_api.model.banana'] class Fruit(ModelComposed): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/fruit_req.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/fruit_req.py similarity index 98% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/fruit_req.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/fruit_req.py index b8af0f35f432..11a7615749cc 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/fruit_req.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/fruit_req.py @@ -34,15 +34,15 @@ validate_get_composed_info, ) try: - from petstore_api.models import apple_req + from petstore_api.model import apple_req except ImportError: apple_req = sys.modules[ - 'petstore_api.models.apple_req'] + 'petstore_api.model.apple_req'] try: - from petstore_api.models import banana_req + from petstore_api.model import banana_req except ImportError: banana_req = sys.modules[ - 'petstore_api.models.banana_req'] + 'petstore_api.model.banana_req'] class FruitReq(ModelComposed): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/gm_fruit.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/gm_fruit.py similarity index 98% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/gm_fruit.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/gm_fruit.py index 9857b08c36c6..e2ebe6fd9d17 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/gm_fruit.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/gm_fruit.py @@ -34,15 +34,15 @@ validate_get_composed_info, ) try: - from petstore_api.models import apple + from petstore_api.model import apple except ImportError: apple = sys.modules[ - 'petstore_api.models.apple'] + 'petstore_api.model.apple'] try: - from petstore_api.models import banana + from petstore_api.model import banana except ImportError: banana = sys.modules[ - 'petstore_api.models.banana'] + 'petstore_api.model.banana'] class GmFruit(ModelComposed): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/grandparent_animal.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/grandparent_animal.py similarity index 97% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/grandparent_animal.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/grandparent_animal.py index ab2ba56caf37..b5af666f7530 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/grandparent_animal.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/grandparent_animal.py @@ -34,15 +34,15 @@ validate_get_composed_info, ) try: - from petstore_api.models import child_cat + from petstore_api.model import child_cat except ImportError: child_cat = sys.modules[ - 'petstore_api.models.child_cat'] + 'petstore_api.model.child_cat'] try: - from petstore_api.models import parent_pet + from petstore_api.model import parent_pet except ImportError: parent_pet = sys.modules[ - 'petstore_api.models.parent_pet'] + 'petstore_api.model.parent_pet'] class GrandparentAnimal(ModelNormal): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/has_only_read_only.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/has_only_read_only.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/has_only_read_only.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/has_only_read_only.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/health_check_result.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/health_check_result.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/health_check_result.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/health_check_result.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/inline_object.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/inline_object.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object1.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/inline_object1.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object1.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/inline_object1.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object2.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/inline_object2.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object2.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/inline_object2.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object3.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/inline_object3.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object3.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/inline_object3.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object4.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/inline_object4.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object4.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/inline_object4.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object5.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/inline_object5.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object5.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/inline_object5.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_response_default.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/inline_response_default.py similarity index 98% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_response_default.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/inline_response_default.py index 577dbfeb8517..f3abf4a7a193 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_response_default.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/inline_response_default.py @@ -34,10 +34,10 @@ validate_get_composed_info, ) try: - from petstore_api.models import foo + from petstore_api.model import foo except ImportError: foo = sys.modules[ - 'petstore_api.models.foo'] + 'petstore_api.model.foo'] class InlineResponseDefault(ModelNormal): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/isosceles_triangle.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/isosceles_triangle.py similarity index 97% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/isosceles_triangle.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/isosceles_triangle.py index ea5607fdfd9b..40c8878bb003 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/isosceles_triangle.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/isosceles_triangle.py @@ -34,15 +34,15 @@ validate_get_composed_info, ) try: - from petstore_api.models import shape_interface + from petstore_api.model import shape_interface except ImportError: shape_interface = sys.modules[ - 'petstore_api.models.shape_interface'] + 'petstore_api.model.shape_interface'] try: - from petstore_api.models import triangle_interface + from petstore_api.model import triangle_interface except ImportError: triangle_interface = sys.modules[ - 'petstore_api.models.triangle_interface'] + 'petstore_api.model.triangle_interface'] class IsoscelesTriangle(ModelComposed): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/list.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/list.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/list.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/list.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/mammal.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/mammal.py similarity index 97% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/mammal.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/mammal.py index 44f3e402c981..e0b9f314080d 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/mammal.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/mammal.py @@ -34,20 +34,20 @@ validate_get_composed_info, ) try: - from petstore_api.models import pig + from petstore_api.model import pig except ImportError: pig = sys.modules[ - 'petstore_api.models.pig'] + 'petstore_api.model.pig'] try: - from petstore_api.models import whale + from petstore_api.model import whale except ImportError: whale = sys.modules[ - 'petstore_api.models.whale'] + 'petstore_api.model.whale'] try: - from petstore_api.models import zebra + from petstore_api.model import zebra except ImportError: zebra = sys.modules[ - 'petstore_api.models.zebra'] + 'petstore_api.model.zebra'] class Mammal(ModelComposed): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/map_test.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/map_test.py similarity index 98% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/map_test.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/map_test.py index 45be8a1fecfd..a22af06ce4fd 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/map_test.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/map_test.py @@ -34,10 +34,10 @@ validate_get_composed_info, ) try: - from petstore_api.models import string_boolean_map + from petstore_api.model import string_boolean_map except ImportError: string_boolean_map = sys.modules[ - 'petstore_api.models.string_boolean_map'] + 'petstore_api.model.string_boolean_map'] class MapTest(ModelNormal): diff --git a/samples/client/petstore/python-experimental/petstore_api/models/mixed_properties_and_additional_properties_class.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/mixed_properties_and_additional_properties_class.py similarity index 98% rename from samples/client/petstore/python-experimental/petstore_api/models/mixed_properties_and_additional_properties_class.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/mixed_properties_and_additional_properties_class.py index 0e584ebd43e9..a0fcac2eb019 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/mixed_properties_and_additional_properties_class.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/mixed_properties_and_additional_properties_class.py @@ -34,10 +34,10 @@ validate_get_composed_info, ) try: - from petstore_api.models import animal + from petstore_api.model import animal except ImportError: animal = sys.modules[ - 'petstore_api.models.animal'] + 'petstore_api.model.animal'] class MixedPropertiesAndAdditionalPropertiesClass(ModelNormal): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/model200_response.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/model200_response.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/model200_response.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/model200_response.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/model_return.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/model_return.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/model_return.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/model_return.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/name.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/name.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/name.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/name.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/nullable_class.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/nullable_class.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/nullable_class.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/nullable_class.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/nullable_shape.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/nullable_shape.py similarity index 98% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/nullable_shape.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/nullable_shape.py index e62a3881c520..77778126a6f7 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/nullable_shape.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/nullable_shape.py @@ -34,15 +34,15 @@ validate_get_composed_info, ) try: - from petstore_api.models import quadrilateral + from petstore_api.model import quadrilateral except ImportError: quadrilateral = sys.modules[ - 'petstore_api.models.quadrilateral'] + 'petstore_api.model.quadrilateral'] try: - from petstore_api.models import triangle + from petstore_api.model import triangle except ImportError: triangle = sys.modules[ - 'petstore_api.models.triangle'] + 'petstore_api.model.triangle'] class NullableShape(ModelComposed): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/number_only.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/number_only.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/number_only.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/number_only.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/order.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/order.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/order.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/order.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_composite.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/outer_composite.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_composite.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/outer_composite.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_enum.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/outer_enum.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_enum.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/outer_enum.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_enum_default_value.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/outer_enum_default_value.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_enum_default_value.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/outer_enum_default_value.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_enum_integer.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/outer_enum_integer.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_enum_integer.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/outer_enum_integer.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_enum_integer_default_value.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/outer_enum_integer_default_value.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_enum_integer_default_value.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/outer_enum_integer_default_value.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/parent_pet.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/parent_pet.py similarity index 97% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/parent_pet.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/parent_pet.py index 89633120977e..26a44926fa3e 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/parent_pet.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/parent_pet.py @@ -34,15 +34,15 @@ validate_get_composed_info, ) try: - from petstore_api.models import child_cat + from petstore_api.model import child_cat except ImportError: child_cat = sys.modules[ - 'petstore_api.models.child_cat'] + 'petstore_api.model.child_cat'] try: - from petstore_api.models import grandparent_animal + from petstore_api.model import grandparent_animal except ImportError: grandparent_animal = sys.modules[ - 'petstore_api.models.grandparent_animal'] + 'petstore_api.model.grandparent_animal'] class ParentPet(ModelComposed): diff --git a/samples/client/petstore/python-experimental/petstore_api/models/pet.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/pet.py similarity index 97% rename from samples/client/petstore/python-experimental/petstore_api/models/pet.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/pet.py index c93acd53c96c..742d7cdf04a8 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/pet.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/pet.py @@ -34,15 +34,15 @@ validate_get_composed_info, ) try: - from petstore_api.models import category + from petstore_api.model import category except ImportError: category = sys.modules[ - 'petstore_api.models.category'] + 'petstore_api.model.category'] try: - from petstore_api.models import tag + from petstore_api.model import tag except ImportError: tag = sys.modules[ - 'petstore_api.models.tag'] + 'petstore_api.model.tag'] class Pet(ModelNormal): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/pig.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/pig.py similarity index 98% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/pig.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/pig.py index 5dd3fdb64ec1..2e02e4e88c98 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/pig.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/pig.py @@ -34,15 +34,15 @@ validate_get_composed_info, ) try: - from petstore_api.models import basque_pig + from petstore_api.model import basque_pig except ImportError: basque_pig = sys.modules[ - 'petstore_api.models.basque_pig'] + 'petstore_api.model.basque_pig'] try: - from petstore_api.models import danish_pig + from petstore_api.model import danish_pig except ImportError: danish_pig = sys.modules[ - 'petstore_api.models.danish_pig'] + 'petstore_api.model.danish_pig'] class Pig(ModelComposed): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/quadrilateral.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/quadrilateral.py similarity index 97% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/quadrilateral.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/quadrilateral.py index 0f4994064571..b0766c987164 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/quadrilateral.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/quadrilateral.py @@ -34,15 +34,15 @@ validate_get_composed_info, ) try: - from petstore_api.models import complex_quadrilateral + from petstore_api.model import complex_quadrilateral except ImportError: complex_quadrilateral = sys.modules[ - 'petstore_api.models.complex_quadrilateral'] + 'petstore_api.model.complex_quadrilateral'] try: - from petstore_api.models import simple_quadrilateral + from petstore_api.model import simple_quadrilateral except ImportError: simple_quadrilateral = sys.modules[ - 'petstore_api.models.simple_quadrilateral'] + 'petstore_api.model.simple_quadrilateral'] class Quadrilateral(ModelComposed): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/quadrilateral_interface.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/quadrilateral_interface.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/quadrilateral_interface.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/quadrilateral_interface.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/read_only_first.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/read_only_first.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/read_only_first.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/read_only_first.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/scalene_triangle.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/scalene_triangle.py similarity index 97% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/scalene_triangle.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/scalene_triangle.py index 6350bdea3bc5..2c58f1bb99ae 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/scalene_triangle.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/scalene_triangle.py @@ -34,15 +34,15 @@ validate_get_composed_info, ) try: - from petstore_api.models import shape_interface + from petstore_api.model import shape_interface except ImportError: shape_interface = sys.modules[ - 'petstore_api.models.shape_interface'] + 'petstore_api.model.shape_interface'] try: - from petstore_api.models import triangle_interface + from petstore_api.model import triangle_interface except ImportError: triangle_interface = sys.modules[ - 'petstore_api.models.triangle_interface'] + 'petstore_api.model.triangle_interface'] class ScaleneTriangle(ModelComposed): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/shape.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/shape.py similarity index 98% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/shape.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/shape.py index ef83ed3a31b7..9eec4b7705ed 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/shape.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/shape.py @@ -34,15 +34,15 @@ validate_get_composed_info, ) try: - from petstore_api.models import quadrilateral + from petstore_api.model import quadrilateral except ImportError: quadrilateral = sys.modules[ - 'petstore_api.models.quadrilateral'] + 'petstore_api.model.quadrilateral'] try: - from petstore_api.models import triangle + from petstore_api.model import triangle except ImportError: triangle = sys.modules[ - 'petstore_api.models.triangle'] + 'petstore_api.model.triangle'] class Shape(ModelComposed): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/shape_interface.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/shape_interface.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/shape_interface.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/shape_interface.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/shape_or_null.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/shape_or_null.py similarity index 98% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/shape_or_null.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/shape_or_null.py index 53043fdd60c4..8c00f44dfaac 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/shape_or_null.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/shape_or_null.py @@ -34,15 +34,15 @@ validate_get_composed_info, ) try: - from petstore_api.models import quadrilateral + from petstore_api.model import quadrilateral except ImportError: quadrilateral = sys.modules[ - 'petstore_api.models.quadrilateral'] + 'petstore_api.model.quadrilateral'] try: - from petstore_api.models import triangle + from petstore_api.model import triangle except ImportError: triangle = sys.modules[ - 'petstore_api.models.triangle'] + 'petstore_api.model.triangle'] class ShapeOrNull(ModelComposed): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/simple_quadrilateral.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/simple_quadrilateral.py similarity index 97% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/simple_quadrilateral.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/simple_quadrilateral.py index 8d8cf85fca1e..dd27bd66fea7 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/simple_quadrilateral.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/simple_quadrilateral.py @@ -34,15 +34,15 @@ validate_get_composed_info, ) try: - from petstore_api.models import quadrilateral_interface + from petstore_api.model import quadrilateral_interface except ImportError: quadrilateral_interface = sys.modules[ - 'petstore_api.models.quadrilateral_interface'] + 'petstore_api.model.quadrilateral_interface'] try: - from petstore_api.models import shape_interface + from petstore_api.model import shape_interface except ImportError: shape_interface = sys.modules[ - 'petstore_api.models.shape_interface'] + 'petstore_api.model.shape_interface'] class SimpleQuadrilateral(ModelComposed): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/special_model_name.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/special_model_name.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/special_model_name.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/special_model_name.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/string_boolean_map.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/string_boolean_map.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/string_boolean_map.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/string_boolean_map.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/tag.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/tag.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/tag.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/tag.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/triangle.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/triangle.py similarity index 96% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/triangle.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/triangle.py index 27b8ae122733..52c3218db1e3 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/triangle.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/triangle.py @@ -34,20 +34,20 @@ validate_get_composed_info, ) try: - from petstore_api.models import equilateral_triangle + from petstore_api.model import equilateral_triangle except ImportError: equilateral_triangle = sys.modules[ - 'petstore_api.models.equilateral_triangle'] + 'petstore_api.model.equilateral_triangle'] try: - from petstore_api.models import isosceles_triangle + from petstore_api.model import isosceles_triangle except ImportError: isosceles_triangle = sys.modules[ - 'petstore_api.models.isosceles_triangle'] + 'petstore_api.model.isosceles_triangle'] try: - from petstore_api.models import scalene_triangle + from petstore_api.model import scalene_triangle except ImportError: scalene_triangle = sys.modules[ - 'petstore_api.models.scalene_triangle'] + 'petstore_api.model.scalene_triangle'] class Triangle(ModelComposed): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/triangle_interface.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/triangle_interface.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/triangle_interface.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/triangle_interface.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/user.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/user.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/user.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/user.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/whale.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/whale.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/whale.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/whale.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/zebra.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/zebra.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/zebra.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/zebra.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/__init__.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/__init__.py index e02c66519259..7c58ced9f86a 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/__init__.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/__init__.py @@ -1,15 +1,95 @@ # coding: utf-8 # flake8: noqa -""" - 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 +# import all models into this package +# if you have many models here with many references from one model to another this may +# raise a RecursionError +# to avoid this, import only the models that you directly need like: +# from from petstore_api.model.pet import Pet +# or import this package, but before doing it, use: +# import sys +# sys.setrecursionlimit(n) - The version of the OpenAPI document: 1.0.0 - Generated by: https://openapi-generator.tech -""" - - -# we can not import model classes here because that would create a circular -# reference which would not work in python2 +from petstore_api.model.additional_properties_class import AdditionalPropertiesClass +from petstore_api.model.address import Address +from petstore_api.model.animal import Animal +from petstore_api.model.api_response import ApiResponse +from petstore_api.model.apple import Apple +from petstore_api.model.apple_req import AppleReq +from petstore_api.model.array_of_array_of_number_only import ArrayOfArrayOfNumberOnly +from petstore_api.model.array_of_number_only import ArrayOfNumberOnly +from petstore_api.model.array_test import ArrayTest +from petstore_api.model.banana import Banana +from petstore_api.model.banana_req import BananaReq +from petstore_api.model.basque_pig import BasquePig +from petstore_api.model.capitalization import Capitalization +from petstore_api.model.cat import Cat +from petstore_api.model.cat_all_of import CatAllOf +from petstore_api.model.category import Category +from petstore_api.model.child_cat import ChildCat +from petstore_api.model.child_cat_all_of import ChildCatAllOf +from petstore_api.model.class_model import ClassModel +from petstore_api.model.client import Client +from petstore_api.model.complex_quadrilateral import ComplexQuadrilateral +from petstore_api.model.danish_pig import DanishPig +from petstore_api.model.dog import Dog +from petstore_api.model.dog_all_of import DogAllOf +from petstore_api.model.drawing import Drawing +from petstore_api.model.enum_arrays import EnumArrays +from petstore_api.model.enum_class import EnumClass +from petstore_api.model.enum_test import EnumTest +from petstore_api.model.equilateral_triangle import EquilateralTriangle +from petstore_api.model.file import File +from petstore_api.model.file_schema_test_class import FileSchemaTestClass +from petstore_api.model.foo import Foo +from petstore_api.model.format_test import FormatTest +from petstore_api.model.fruit import Fruit +from petstore_api.model.fruit_req import FruitReq +from petstore_api.model.gm_fruit import GmFruit +from petstore_api.model.grandparent_animal import GrandparentAnimal +from petstore_api.model.has_only_read_only import HasOnlyReadOnly +from petstore_api.model.health_check_result import HealthCheckResult +from petstore_api.model.inline_object import InlineObject +from petstore_api.model.inline_object1 import InlineObject1 +from petstore_api.model.inline_object2 import InlineObject2 +from petstore_api.model.inline_object3 import InlineObject3 +from petstore_api.model.inline_object4 import InlineObject4 +from petstore_api.model.inline_object5 import InlineObject5 +from petstore_api.model.inline_response_default import InlineResponseDefault +from petstore_api.model.isosceles_triangle import IsoscelesTriangle +from petstore_api.model.list import List +from petstore_api.model.mammal import Mammal +from petstore_api.model.map_test import MapTest +from petstore_api.model.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass +from petstore_api.model.model200_response import Model200Response +from petstore_api.model.model_return import ModelReturn +from petstore_api.model.name import Name +from petstore_api.model.nullable_class import NullableClass +from petstore_api.model.nullable_shape import NullableShape +from petstore_api.model.number_only import NumberOnly +from petstore_api.model.order import Order +from petstore_api.model.outer_composite import OuterComposite +from petstore_api.model.outer_enum import OuterEnum +from petstore_api.model.outer_enum_default_value import OuterEnumDefaultValue +from petstore_api.model.outer_enum_integer import OuterEnumInteger +from petstore_api.model.outer_enum_integer_default_value import OuterEnumIntegerDefaultValue +from petstore_api.model.parent_pet import ParentPet +from petstore_api.model.pet import Pet +from petstore_api.model.pig import Pig +from petstore_api.model.quadrilateral import Quadrilateral +from petstore_api.model.quadrilateral_interface import QuadrilateralInterface +from petstore_api.model.read_only_first import ReadOnlyFirst +from petstore_api.model.scalene_triangle import ScaleneTriangle +from petstore_api.model.shape import Shape +from petstore_api.model.shape_interface import ShapeInterface +from petstore_api.model.shape_or_null import ShapeOrNull +from petstore_api.model.simple_quadrilateral import SimpleQuadrilateral +from petstore_api.model.special_model_name import SpecialModelName +from petstore_api.model.string_boolean_map import StringBooleanMap +from petstore_api.model.tag import Tag +from petstore_api.model.triangle import Triangle +from petstore_api.model.triangle_interface import TriangleInterface +from petstore_api.model.user import User +from petstore_api.model.whale import Whale +from petstore_api.model.zebra import Zebra diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/gm_mammal.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/gm_mammal.py deleted file mode 100644 index 40d056a494ec..000000000000 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/gm_mammal.py +++ /dev/null @@ -1,212 +0,0 @@ -# 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 re # noqa: F401 -import sys # noqa: F401 - -import six # noqa: F401 - -from petstore_api.model_utils import ( # noqa: F401 - ModelComposed, - ModelNormal, - ModelSimple, - date, - datetime, - file_type, - int, - none_type, - str, - validate_get_composed_info, -) -try: - from petstore_api.models import whale -except ImportError: - whale = sys.modules[ - 'petstore_api.models.whale'] -try: - from petstore_api.models import zebra -except ImportError: - zebra = sys.modules[ - 'petstore_api.models.zebra'] - - -class GmMammal(ModelComposed): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - ('lungs',): { - '2': 2, - }, - ('type',): { - 'PLAINS': "plains", - 'MOUNTAIN': "mountain", - 'GREVYS': "grevys", - }, - } - - validations = { - } - - additional_properties_type = None - - @staticmethod - def openapi_types(): - """ - This must be a class method so a model may have properties that are - of type self, this ensures that we don't create a cyclic import - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'class_name': (str,), # noqa: E501 - 'lungs': (int,), # noqa: E501 - 'has_baleen': (bool,), # noqa: E501 - 'has_teeth': (bool,), # noqa: E501 - 'type': (str,), # noqa: E501 - } - - @staticmethod - def discriminator(): - return { - 'class_name': { - 'whale': whale.Whale, - 'zebra': zebra.Zebra, - }, - } - - attribute_map = { - 'class_name': 'className', # noqa: E501 - 'lungs': 'lungs', # noqa: E501 - 'has_baleen': 'hasBaleen', # noqa: E501 - 'has_teeth': 'hasTeeth', # noqa: E501 - 'type': 'type', # noqa: E501 - } - - required_properties = set([ - '_data_store', - '_check_type', - '_json_variable_naming', - '_path_to_item', - '_configuration', - '_composed_instances', - '_var_name_to_model_instances', - '_additional_properties_model_instances', - ]) - - def __init__(self, class_name, _check_type=True, _json_variable_naming=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 - """gm_mammal.GmMammal - a model defined in OpenAPI - - Args: - class_name (str): - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the model in received_data - when deserializing a response - _json_variable_naming (bool): True if the data is from the server - False if the data is from the client (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - lungs (int): [optional] if omitted the server will use the default value of 2 # noqa: E501 - has_baleen (bool): [optional] # noqa: E501 - has_teeth (bool): [optional] # noqa: E501 - type (str): [optional] # noqa: E501 - """ - - self._data_store = {} - self._check_type = _check_type - self._json_variable_naming = _json_variable_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - - constant_args = { - '_check_type': _check_type, - '_path_to_item': _path_to_item, - '_json_variable_naming': _json_variable_naming, - '_configuration': _configuration, - } - model_args = { - 'class_name': class_name, - } - model_args.update(kwargs) - composed_info = validate_get_composed_info( - constant_args, model_args, self) - self._composed_instances = composed_info[0] - self._var_name_to_model_instances = composed_info[1] - self._additional_properties_model_instances = composed_info[2] - - self.class_name = class_name - for var_name, var_value in six.iteritems(kwargs): - setattr(self, var_name, var_value) - - @staticmethod - def _composed_schemas(): - # we need this here to make our import statements work - # we must store _composed_schemas in here so the code is only run - # when we invoke this method. If we kept this at the class - # level we would get an error beause the class level - # code would be run when this module is imported, and these composed - # classes don't exist yet because their module has not finished - # loading - return { - 'anyOf': [ - whale.Whale, - zebra.Zebra, - ], - 'allOf': [ - ], - 'oneOf': [ - ], - } - - @classmethod - def get_discriminator_class(cls, json_variable_naming, data): - """Returns the child class specified by the discriminator""" - discriminator = cls.discriminator() - discr_propertyname_py = list(discriminator.keys())[0] - discr_propertyname_js = cls.attribute_map[discr_propertyname_py] - if json_variable_naming: - class_name = data[discr_propertyname_js] - else: - class_name = data[discr_propertyname_py] - class_name_to_discr_class = discriminator[discr_propertyname_py] - return class_name_to_discr_class.get(class_name) diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_additional_properties_class.py b/samples/openapi3/client/petstore/python-experimental/test/test_additional_properties_class.py index 279baa3a454f..befc14455da2 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_additional_properties_class.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_additional_properties_class.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.additional_properties_class import AdditionalPropertiesClass class TestAdditionalPropertiesClass(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testAdditionalPropertiesClass(self): """Test AdditionalPropertiesClass""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.AdditionalPropertiesClass() # noqa: E501 + # model = AdditionalPropertiesClass() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_address.py b/samples/openapi3/client/petstore/python-experimental/test/test_address.py index 7aa36d745cf5..dcc33c22dbb3 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_address.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_address.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.address import Address class TestAddress(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testAddress(self): """Test Address""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.Address() # noqa: E501 + # model = Address() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_animal.py b/samples/openapi3/client/petstore/python-experimental/test/test_animal.py index 66f94c5eef4e..958f303f13e3 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_animal.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_animal.py @@ -11,10 +11,21 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import cat +except ImportError: + cat = sys.modules[ + 'petstore_api.model.cat'] +try: + from petstore_api.model import dog +except ImportError: + dog = sys.modules[ + 'petstore_api.model.dog'] +from petstore_api.model.animal import Animal class TestAnimal(unittest.TestCase): @@ -29,7 +40,7 @@ def tearDown(self): def testAnimal(self): """Test Animal""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.Animal() # noqa: E501 + # model = Animal() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_another_fake_api.py b/samples/openapi3/client/petstore/python-experimental/test/test_another_fake_api.py index d95798cfc5a4..f79966a26961 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_another_fake_api.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_another_fake_api.py @@ -16,14 +16,13 @@ import petstore_api from petstore_api.api.another_fake_api import AnotherFakeApi # noqa: E501 -from petstore_api.rest import ApiException class TestAnotherFakeApi(unittest.TestCase): """AnotherFakeApi unit test stubs""" def setUp(self): - self.api = petstore_api.api.another_fake_api.AnotherFakeApi() # noqa: E501 + self.api = AnotherFakeApi() # noqa: E501 def tearDown(self): pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_api_response.py b/samples/openapi3/client/petstore/python-experimental/test/test_api_response.py index a253e6f364cd..9db92633f626 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_api_response.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_api_response.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.api_response import ApiResponse class TestApiResponse(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testApiResponse(self): """Test ApiResponse""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.ApiResponse() # noqa: E501 + # model = ApiResponse() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_apple.py b/samples/openapi3/client/petstore/python-experimental/test/test_apple.py index 100866918919..9aedfc0b01d5 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_apple.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_apple.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.apple import Apple class TestApple(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testApple(self): """Test Apple""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.Apple() # noqa: E501 + # model = Apple() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_apple_req.py b/samples/openapi3/client/petstore/python-experimental/test/test_apple_req.py index 4cb5abcdede4..79650cd1c747 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_apple_req.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_apple_req.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.apple_req import AppleReq class TestAppleReq(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testAppleReq(self): """Test AppleReq""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.AppleReq() # noqa: E501 + # model = AppleReq() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_array_of_array_of_number_only.py b/samples/openapi3/client/petstore/python-experimental/test/test_array_of_array_of_number_only.py index e47430f6861a..4980ad17afb5 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_array_of_array_of_number_only.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_array_of_array_of_number_only.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.array_of_array_of_number_only import ArrayOfArrayOfNumberOnly class TestArrayOfArrayOfNumberOnly(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testArrayOfArrayOfNumberOnly(self): """Test ArrayOfArrayOfNumberOnly""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.ArrayOfArrayOfNumberOnly() # noqa: E501 + # model = ArrayOfArrayOfNumberOnly() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_array_of_number_only.py b/samples/openapi3/client/petstore/python-experimental/test/test_array_of_number_only.py index 1a65f69b9268..479c537cada7 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_array_of_number_only.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_array_of_number_only.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.array_of_number_only import ArrayOfNumberOnly class TestArrayOfNumberOnly(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testArrayOfNumberOnly(self): """Test ArrayOfNumberOnly""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.ArrayOfNumberOnly() # noqa: E501 + # model = ArrayOfNumberOnly() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_array_test.py b/samples/openapi3/client/petstore/python-experimental/test/test_array_test.py index ac1b486bb74e..2426b27b7e46 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_array_test.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_array_test.py @@ -11,10 +11,16 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import read_only_first +except ImportError: + read_only_first = sys.modules[ + 'petstore_api.model.read_only_first'] +from petstore_api.model.array_test import ArrayTest class TestArrayTest(unittest.TestCase): @@ -29,7 +35,7 @@ def tearDown(self): def testArrayTest(self): """Test ArrayTest""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.ArrayTest() # noqa: E501 + # model = ArrayTest() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_banana.py b/samples/openapi3/client/petstore/python-experimental/test/test_banana.py index 6efdcd07da1c..a989386b018c 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_banana.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_banana.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.banana import Banana class TestBanana(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testBanana(self): """Test Banana""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.Banana() # noqa: E501 + # model = Banana() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_banana_req.py b/samples/openapi3/client/petstore/python-experimental/test/test_banana_req.py index 5eeb0bc57c21..39d125e4a15e 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_banana_req.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_banana_req.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.banana_req import BananaReq class TestBananaReq(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testBananaReq(self): """Test BananaReq""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.BananaReq() # noqa: E501 + # model = BananaReq() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_basque_pig.py b/samples/openapi3/client/petstore/python-experimental/test/test_basque_pig.py index 46e9ff215dc8..b00c5f8a6aa5 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_basque_pig.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_basque_pig.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.basque_pig import BasquePig class TestBasquePig(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testBasquePig(self): """Test BasquePig""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.BasquePig() # noqa: E501 + # model = BasquePig() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_capitalization.py b/samples/openapi3/client/petstore/python-experimental/test/test_capitalization.py index 1cb91380a768..20d2649c01eb 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_capitalization.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_capitalization.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.capitalization import Capitalization class TestCapitalization(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testCapitalization(self): """Test Capitalization""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.Capitalization() # noqa: E501 + # model = Capitalization() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_cat.py b/samples/openapi3/client/petstore/python-experimental/test/test_cat.py index bd616261861d..1cb6b58cbd09 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_cat.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_cat.py @@ -11,10 +11,26 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import address +except ImportError: + address = sys.modules[ + 'petstore_api.model.address'] +try: + from petstore_api.model import animal +except ImportError: + animal = sys.modules[ + 'petstore_api.model.animal'] +try: + from petstore_api.model import cat_all_of +except ImportError: + cat_all_of = sys.modules[ + 'petstore_api.model.cat_all_of'] +from petstore_api.model.cat import Cat class TestCat(unittest.TestCase): @@ -29,7 +45,7 @@ def tearDown(self): def testCat(self): """Test Cat""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.Cat() # noqa: E501 + # model = Cat() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_cat_all_of.py b/samples/openapi3/client/petstore/python-experimental/test/test_cat_all_of.py index 136ed8da050a..a5bb91ac864e 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_cat_all_of.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_cat_all_of.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.cat_all_of import CatAllOf class TestCatAllOf(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testCatAllOf(self): """Test CatAllOf""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.CatAllOf() # noqa: E501 + # model = CatAllOf() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_category.py b/samples/openapi3/client/petstore/python-experimental/test/test_category.py index c2ab96f823b6..59b64e5924a8 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_category.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_category.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.category import Category class TestCategory(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testCategory(self): """Test Category""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.Category() # noqa: E501 + # model = Category() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_child_cat.py b/samples/openapi3/client/petstore/python-experimental/test/test_child_cat.py index c42c3b583aae..34c085515a80 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_child_cat.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_child_cat.py @@ -11,10 +11,21 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import child_cat_all_of +except ImportError: + child_cat_all_of = sys.modules[ + 'petstore_api.model.child_cat_all_of'] +try: + from petstore_api.model import parent_pet +except ImportError: + parent_pet = sys.modules[ + 'petstore_api.model.parent_pet'] +from petstore_api.model.child_cat import ChildCat class TestChildCat(unittest.TestCase): @@ -29,7 +40,7 @@ def tearDown(self): def testChildCat(self): """Test ChildCat""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.ChildCat() # noqa: E501 + # model = ChildCat() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_child_cat_all_of.py b/samples/openapi3/client/petstore/python-experimental/test/test_child_cat_all_of.py index 3304a81a2321..2a7aab100fbf 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_child_cat_all_of.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_child_cat_all_of.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.child_cat_all_of import ChildCatAllOf class TestChildCatAllOf(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testChildCatAllOf(self): """Test ChildCatAllOf""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.ChildCatAllOf() # noqa: E501 + # model = ChildCatAllOf() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_class_model.py b/samples/openapi3/client/petstore/python-experimental/test/test_class_model.py index 3ac7e553042e..060df39e4b5e 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_class_model.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_class_model.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.class_model import ClassModel class TestClassModel(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testClassModel(self): """Test ClassModel""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.ClassModel() # noqa: E501 + # model = ClassModel() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_client.py b/samples/openapi3/client/petstore/python-experimental/test/test_client.py index 683190363445..ab5e3a80d377 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_client.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_client.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.client import Client class TestClient(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testClient(self): """Test Client""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.Client() # noqa: E501 + # model = Client() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_complex_quadrilateral.py b/samples/openapi3/client/petstore/python-experimental/test/test_complex_quadrilateral.py index b1d4fc9079bd..0c0887509c8b 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_complex_quadrilateral.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_complex_quadrilateral.py @@ -11,10 +11,21 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import quadrilateral_interface +except ImportError: + quadrilateral_interface = sys.modules[ + 'petstore_api.model.quadrilateral_interface'] +try: + from petstore_api.model import shape_interface +except ImportError: + shape_interface = sys.modules[ + 'petstore_api.model.shape_interface'] +from petstore_api.model.complex_quadrilateral import ComplexQuadrilateral class TestComplexQuadrilateral(unittest.TestCase): @@ -29,7 +40,7 @@ def tearDown(self): def testComplexQuadrilateral(self): """Test ComplexQuadrilateral""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.ComplexQuadrilateral() # noqa: E501 + # model = ComplexQuadrilateral() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_danish_pig.py b/samples/openapi3/client/petstore/python-experimental/test/test_danish_pig.py index 0cbe8f8c102a..a82c352e84c1 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_danish_pig.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_danish_pig.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.danish_pig import DanishPig class TestDanishPig(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testDanishPig(self): """Test DanishPig""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.DanishPig() # noqa: E501 + # model = DanishPig() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_default_api.py b/samples/openapi3/client/petstore/python-experimental/test/test_default_api.py index 50e7c57bd0bf..5f4fb5230ac4 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_default_api.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_default_api.py @@ -16,14 +16,13 @@ import petstore_api from petstore_api.api.default_api import DefaultApi # noqa: E501 -from petstore_api.rest import ApiException class TestDefaultApi(unittest.TestCase): """DefaultApi unit test stubs""" def setUp(self): - self.api = petstore_api.api.default_api.DefaultApi() # noqa: E501 + self.api = DefaultApi() # noqa: E501 def tearDown(self): pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_dog.py b/samples/openapi3/client/petstore/python-experimental/test/test_dog.py index 37e9dd56d4ff..4a6fc61ad761 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_dog.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_dog.py @@ -11,10 +11,21 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import animal +except ImportError: + animal = sys.modules[ + 'petstore_api.model.animal'] +try: + from petstore_api.model import dog_all_of +except ImportError: + dog_all_of = sys.modules[ + 'petstore_api.model.dog_all_of'] +from petstore_api.model.dog import Dog class TestDog(unittest.TestCase): @@ -29,7 +40,7 @@ def tearDown(self): def testDog(self): """Test Dog""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.Dog() # noqa: E501 + # model = Dog() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_dog_all_of.py b/samples/openapi3/client/petstore/python-experimental/test/test_dog_all_of.py index 7f443eb9b60c..7ab4e8ae79d8 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_dog_all_of.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_dog_all_of.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.dog_all_of import DogAllOf class TestDogAllOf(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testDogAllOf(self): """Test DogAllOf""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.DogAllOf() # noqa: E501 + # model = DogAllOf() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_drawing.py b/samples/openapi3/client/petstore/python-experimental/test/test_drawing.py index 6897ce82676d..dbfba3ea700f 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_drawing.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_drawing.py @@ -11,17 +11,33 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import nullable_shape +except ImportError: + nullable_shape = sys.modules[ + 'petstore_api.model.nullable_shape'] +try: + from petstore_api.model import shape +except ImportError: + shape = sys.modules[ + 'petstore_api.model.shape'] +try: + from petstore_api.model import shape_or_null +except ImportError: + shape_or_null = sys.modules[ + 'petstore_api.model.shape_or_null'] +from petstore_api.model.drawing import Drawing class TestDrawing(unittest.TestCase): """Drawing unit test stubs""" def setUp(self): - self.api_client = petstore_api.ApiClient() + pass def tearDown(self): pass @@ -32,73 +48,79 @@ def test_create_instances(self): """ # Validate object can be created using pythonic names. - inst = petstore_api.Shape( + inst = shape.Shape( shape_type="Triangle", triangle_type="IsoscelesTriangle" ) - assert isinstance(inst, petstore_api.IsoscelesTriangle) + from petstore_api.model.isosceles_triangle import IsoscelesTriangle + assert isinstance(inst, IsoscelesTriangle) # Validate object can be created using OAS names. # For example, this can be used to construct objects on the client # when the input data is available as JSON documents. data = { - 'shapeType': "Triangle", - 'triangleType': "IsoscelesTriangle" + 'shapeType': "Triangle", + 'triangleType': "IsoscelesTriangle" } - inst = petstore_api.Shape(_spec_property_naming=True, **data) - assert isinstance(inst, petstore_api.IsoscelesTriangle) + inst = shape.Shape(_spec_property_naming=True, **data) + assert isinstance(inst, IsoscelesTriangle) def test_deserialize_oneof_reference(self): """ Validate the scenario when the type of a OAS property is 'oneOf', and the 'oneOf' schema is specified as a reference ($ref), not an inline 'oneOf' schema. """ - isosceles_triangle = petstore_api.Shape( + isosceles_triangle = shape.Shape( shape_type="Triangle", triangle_type="IsoscelesTriangle" ) - assert isinstance(isosceles_triangle, petstore_api.IsoscelesTriangle) - inst = petstore_api.Drawing( + from petstore_api.model.isosceles_triangle import IsoscelesTriangle + from petstore_api.model.triangle import Triangle + from petstore_api.model.equilateral_triangle import EquilateralTriangle + + assert isinstance(isosceles_triangle, IsoscelesTriangle) + inst = Drawing( # 'main_shape' has type 'Shape', which is a oneOf [triangle, quadrilateral] # composed schema. So we should be able to assign a petstore_api.Triangle # to a 'main_shape'. main_shape=isosceles_triangle, shapes=[ - petstore_api.Shape( + shape.Shape( shape_type="Triangle", triangle_type="EquilateralTriangle" ), - petstore_api.Triangle( + Triangle( shape_type="Triangle", triangle_type="IsoscelesTriangle" ), - petstore_api.EquilateralTriangle( + EquilateralTriangle( shape_type="Triangle", triangle_type="EquilateralTriangle" ), - petstore_api.Shape( + shape.Shape( shape_type="Quadrilateral", quadrilateral_type="ComplexQuadrilateral" ), ], ) - assert isinstance(inst, petstore_api.Drawing) - assert isinstance(inst.main_shape, petstore_api.IsoscelesTriangle) + from petstore_api.model.complex_quadrilateral import ComplexQuadrilateral + assert isinstance(inst, Drawing) + assert isinstance(inst.main_shape, IsoscelesTriangle) self.assertEqual(len(inst.shapes), 4) - assert isinstance(inst.shapes[0], petstore_api.EquilateralTriangle) - assert isinstance(inst.shapes[1], petstore_api.IsoscelesTriangle) - assert isinstance(inst.shapes[2], petstore_api.EquilateralTriangle) - assert isinstance(inst.shapes[3], petstore_api.ComplexQuadrilateral) + assert isinstance(inst.shapes[0], EquilateralTriangle) + assert isinstance(inst.shapes[1], IsoscelesTriangle) + assert isinstance(inst.shapes[2], EquilateralTriangle) + assert isinstance(inst.shapes[3], ComplexQuadrilateral) # Validate we cannot assign the None value to main_shape because the 'null' type # is not one of the allowed types in the 'Shape' schema. err_msg = ("Invalid type for variable '{}'. " - "Required value type is {} and passed type was {} at {}") + "Required value type is {} and passed type was {} at {}") with self.assertRaisesRegexp( - petstore_api.ApiTypeError, - err_msg.format("main_shape", "Shape", "NoneType", "\['main_shape'\]") + petstore_api.ApiTypeError, + err_msg.format("main_shape", "Shape", "NoneType", "\['main_shape'\]") ): - inst = petstore_api.Drawing( + inst = Drawing( # 'main_shape' has type 'Shape', which is a oneOf [triangle, quadrilateral] # So the None value should not be allowed and an exception should be raised. main_shape=None, @@ -115,11 +137,11 @@ def test_deserialize_oneof_reference_with_null_type(self): # Validate we can assign the None value to shape_or_null, because the 'null' type # is one of the allowed types in the 'ShapeOrNull' schema. - inst = petstore_api.Drawing( + inst = Drawing( # 'shape_or_null' has type 'ShapeOrNull', which is a oneOf [null, triangle, quadrilateral] shape_or_null=None, ) - assert isinstance(inst, petstore_api.Drawing) + assert isinstance(inst, Drawing) self.assertFalse(hasattr(inst, 'main_shape')) self.assertTrue(hasattr(inst, 'shape_or_null')) self.assertIsNone(inst.shape_or_null) @@ -135,16 +157,15 @@ def test_deserialize_oneof_reference_with_nullable_type(self): # Validate we can assign the None value to nullable_shape, because the NullableShape # has the 'nullable: true' attribute. - inst = petstore_api.Drawing( + inst = Drawing( # 'nullable_shape' has type 'NullableShape', which is a oneOf [triangle, quadrilateral] - # and the 'nullable: true' attribute. + # and the 'nullable: true' attribute. nullable_shape=None, ) - assert isinstance(inst, petstore_api.Drawing) + assert isinstance(inst, Drawing) self.assertFalse(hasattr(inst, 'main_shape')) self.assertTrue(hasattr(inst, 'nullable_shape')) self.assertIsNone(inst.nullable_shape) - if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_enum_arrays.py b/samples/openapi3/client/petstore/python-experimental/test/test_enum_arrays.py index 5f789287332a..143a23fe0d45 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_enum_arrays.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_enum_arrays.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.enum_arrays import EnumArrays class TestEnumArrays(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testEnumArrays(self): """Test EnumArrays""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.EnumArrays() # noqa: E501 + # model = EnumArrays() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_enum_class.py b/samples/openapi3/client/petstore/python-experimental/test/test_enum_class.py index f25e772ff26a..f910231c9d02 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_enum_class.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_enum_class.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.enum_class import EnumClass class TestEnumClass(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testEnumClass(self): """Test EnumClass""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.EnumClass() # noqa: E501 + # model = EnumClass() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_enum_test.py b/samples/openapi3/client/petstore/python-experimental/test/test_enum_test.py index 8238fb7a3ab9..6a98e49b9689 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_enum_test.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_enum_test.py @@ -11,10 +11,31 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import outer_enum +except ImportError: + outer_enum = sys.modules[ + 'petstore_api.model.outer_enum'] +try: + from petstore_api.model import outer_enum_default_value +except ImportError: + outer_enum_default_value = sys.modules[ + 'petstore_api.model.outer_enum_default_value'] +try: + from petstore_api.model import outer_enum_integer +except ImportError: + outer_enum_integer = sys.modules[ + 'petstore_api.model.outer_enum_integer'] +try: + from petstore_api.model import outer_enum_integer_default_value +except ImportError: + outer_enum_integer_default_value = sys.modules[ + 'petstore_api.model.outer_enum_integer_default_value'] +from petstore_api.model.enum_test import EnumTest class TestEnumTest(unittest.TestCase): @@ -29,7 +50,7 @@ def tearDown(self): def testEnumTest(self): """Test EnumTest""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.EnumTest() # noqa: E501 + # model = EnumTest() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_equilateral_triangle.py b/samples/openapi3/client/petstore/python-experimental/test/test_equilateral_triangle.py index cdef216105eb..8f286edfdcba 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_equilateral_triangle.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_equilateral_triangle.py @@ -11,10 +11,21 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import shape_interface +except ImportError: + shape_interface = sys.modules[ + 'petstore_api.model.shape_interface'] +try: + from petstore_api.model import triangle_interface +except ImportError: + triangle_interface = sys.modules[ + 'petstore_api.model.triangle_interface'] +from petstore_api.model.equilateral_triangle import EquilateralTriangle class TestEquilateralTriangle(unittest.TestCase): @@ -29,7 +40,7 @@ def tearDown(self): def testEquilateralTriangle(self): """Test EquilateralTriangle""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.EquilateralTriangle() # noqa: E501 + # model = EquilateralTriangle() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_fake_api.py b/samples/openapi3/client/petstore/python-experimental/test/test_fake_api.py index 581d1499eedf..f6678a59b240 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_fake_api.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_fake_api.py @@ -16,14 +16,13 @@ import petstore_api from petstore_api.api.fake_api import FakeApi # noqa: E501 -from petstore_api.rest import ApiException class TestFakeApi(unittest.TestCase): """FakeApi unit test stubs""" def setUp(self): - self.api = petstore_api.api.fake_api.FakeApi() # noqa: E501 + self.api = FakeApi() # noqa: E501 def tearDown(self): pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_fake_classname_tags_123_api.py b/samples/openapi3/client/petstore/python-experimental/test/test_fake_classname_tags_123_api.py index f54e0d06644f..c12e35eb5dea 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_fake_classname_tags_123_api.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_fake_classname_tags_123_api.py @@ -16,14 +16,13 @@ import petstore_api from petstore_api.api.fake_classname_tags_123_api import FakeClassnameTags123Api # noqa: E501 -from petstore_api.rest import ApiException class TestFakeClassnameTags123Api(unittest.TestCase): """FakeClassnameTags123Api unit test stubs""" def setUp(self): - self.api = petstore_api.api.fake_classname_tags_123_api.FakeClassnameTags123Api() # noqa: E501 + self.api = FakeClassnameTags123Api() # noqa: E501 def tearDown(self): pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_file.py b/samples/openapi3/client/petstore/python-experimental/test/test_file.py index af185e32e6e8..8d60f64e01cc 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_file.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_file.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.file import File class TestFile(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testFile(self): """Test File""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.File() # noqa: E501 + # model = File() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_file_schema_test_class.py b/samples/openapi3/client/petstore/python-experimental/test/test_file_schema_test_class.py index c2de4e866cda..9a4f6d38dfef 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_file_schema_test_class.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_file_schema_test_class.py @@ -11,10 +11,16 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import file +except ImportError: + file = sys.modules[ + 'petstore_api.model.file'] +from petstore_api.model.file_schema_test_class import FileSchemaTestClass class TestFileSchemaTestClass(unittest.TestCase): @@ -29,7 +35,7 @@ def tearDown(self): def testFileSchemaTestClass(self): """Test FileSchemaTestClass""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.FileSchemaTestClass() # noqa: E501 + # model = FileSchemaTestClass() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_foo.py b/samples/openapi3/client/petstore/python-experimental/test/test_foo.py index c54feb98c25a..8125de84ada3 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_foo.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_foo.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.foo import Foo class TestFoo(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testFoo(self): """Test Foo""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.Foo() # noqa: E501 + # model = Foo() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_format_test.py b/samples/openapi3/client/petstore/python-experimental/test/test_format_test.py index a9d39521e934..07f4f5e4c1f7 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_format_test.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_format_test.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.format_test import FormatTest class TestFormatTest(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testFormatTest(self): """Test FormatTest""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.FormatTest() # noqa: E501 + # model = FormatTest() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_fruit.py b/samples/openapi3/client/petstore/python-experimental/test/test_fruit.py index 1172373b9e1d..1eb9d09d5061 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_fruit.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_fruit.py @@ -11,10 +11,21 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import apple +except ImportError: + apple = sys.modules[ + 'petstore_api.model.apple'] +try: + from petstore_api.model import banana +except ImportError: + banana = sys.modules[ + 'petstore_api.model.banana'] +from petstore_api.model.fruit import Fruit class TestFruit(unittest.TestCase): @@ -33,7 +44,7 @@ def testFruit(self): # banana test length_cm = 20.3 color = 'yellow' - fruit = petstore_api.Fruit(length_cm=length_cm, color=color) + fruit = Fruit(length_cm=length_cm, color=color) # check its properties self.assertEqual(fruit.length_cm, length_cm) self.assertEqual(fruit['length_cm'], length_cm) @@ -79,7 +90,7 @@ def testFruit(self): # Per Python doc, if the named attribute does not exist, # default is returned if provided, otherwise AttributeError is raised. with self.assertRaises(AttributeError): - getattr(fruit, 'cultivar') + getattr(fruit, 'cultivar') # make sure that the ModelComposed class properties are correct # model._composed_schemas stores the anyOf/allOf/oneOf info @@ -89,15 +100,15 @@ def testFruit(self): 'anyOf': [], 'allOf': [], 'oneOf': [ - petstore_api.Apple, - petstore_api.Banana, + apple.Apple, + banana.Banana, ], } ) # model._composed_instances is a list of the instances that were # made from the anyOf/allOf/OneOf classes in model._composed_schemas for composed_instance in fruit._composed_instances: - if composed_instance.__class__ == petstore_api.Banana: + if composed_instance.__class__ == banana.Banana: banana_instance = composed_instance self.assertEqual( fruit._composed_instances, @@ -129,7 +140,7 @@ def testFruit(self): # including extra parameters raises an exception with self.assertRaises(petstore_api.ApiValueError): - fruit = petstore_api.Fruit( + fruit = Fruit( color=color, length_cm=length_cm, unknown_property='some value' @@ -137,7 +148,7 @@ def testFruit(self): # including input parameters for two oneOf instances raise an exception with self.assertRaises(petstore_api.ApiValueError): - fruit = petstore_api.Fruit( + fruit = Fruit( length_cm=length_cm, cultivar='granny smith' ) @@ -146,7 +157,7 @@ def testFruit(self): # apple test color = 'red' cultivar = 'golden delicious' - fruit = petstore_api.Fruit(color=color, cultivar=cultivar) + fruit = Fruit(color=color, cultivar=cultivar) # check its properties self.assertEqual(fruit.color, color) self.assertEqual(fruit['color'], color) @@ -166,7 +177,7 @@ def testFruit(self): # model._composed_instances is a list of the instances that were # made from the anyOf/allOf/OneOf classes in model._composed_schemas for composed_instance in fruit._composed_instances: - if composed_instance.__class__ == petstore_api.Apple: + if composed_instance.__class__ == apple.Apple: apple_instance = composed_instance self.assertEqual( fruit._composed_instances, @@ -191,20 +202,20 @@ def testFruit(self): def testFruitNullValue(self): # Since 'apple' is nullable, validate we can create an apple with the 'null' value. - apple = petstore_api.Apple(None) - self.assertIsNone(apple) + fruit = apple.Apple(None) + self.assertIsNone(fruit) # 'banana' is not nullable. with self.assertRaises(petstore_api.ApiTypeError): - banana = petstore_api.Banana(None) + banana.Banana(None) # Since 'fruit' has oneOf 'apple', 'banana' and 'apple' is nullable, # validate we can create a fruit with the 'null' value. - fruit = petstore_api.Fruit(None) + fruit = Fruit(None) self.assertIsNone(fruit) # Redo the same thing, this time passing a null Apple to the Fruit constructor. - fruit = petstore_api.Fruit(petstore_api.Apple(None)) + fruit = Fruit(apple.Apple(None)) self.assertIsNone(fruit) if __name__ == '__main__': diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_fruit_req.py b/samples/openapi3/client/petstore/python-experimental/test/test_fruit_req.py index f3e03faf271c..3a1aa8fc283b 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_fruit_req.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_fruit_req.py @@ -11,10 +11,21 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import apple_req +except ImportError: + apple_req = sys.modules[ + 'petstore_api.model.apple_req'] +try: + from petstore_api.model import banana_req +except ImportError: + banana_req = sys.modules[ + 'petstore_api.model.banana_req'] +from petstore_api.model.fruit_req import FruitReq class TestFruitReq(unittest.TestCase): @@ -32,7 +43,7 @@ def testFruitReq(self): # make an instance of Fruit, a composed schema oneOf model # banana test length_cm = 20.3 - fruit = petstore_api.FruitReq(length_cm=length_cm) + fruit = FruitReq(length_cm=length_cm) # check its properties self.assertEqual(fruit.length_cm, length_cm) self.assertEqual(fruit['length_cm'], length_cm) @@ -70,8 +81,8 @@ def testFruitReq(self): 'anyOf': [], 'allOf': [], 'oneOf': [ - petstore_api.AppleReq, - petstore_api.BananaReq, + apple_req.AppleReq, + banana_req.BananaReq, type(None), ], } @@ -79,7 +90,7 @@ def testFruitReq(self): # model._composed_instances is a list of the instances that were # made from the anyOf/allOf/OneOf classes in model._composed_schemas for composed_instance in fruit._composed_instances: - if composed_instance.__class__ == petstore_api.BananaReq: + if composed_instance.__class__ == banana_req.BananaReq: banana_instance = composed_instance self.assertEqual( fruit._composed_instances, @@ -111,14 +122,14 @@ def testFruitReq(self): # including extra parameters raises an exception with self.assertRaises(petstore_api.ApiValueError): - fruit = petstore_api.FruitReq( + fruit = FruitReq( length_cm=length_cm, unknown_property='some value' ) # including input parameters for two oneOf instances raise an exception with self.assertRaises(petstore_api.ApiValueError): - fruit = petstore_api.FruitReq( + fruit = FruitReq( length_cm=length_cm, cultivar='granny smith' ) @@ -126,7 +137,7 @@ def testFruitReq(self): # make an instance of Fruit, a composed schema oneOf model # apple test cultivar = 'golden delicious' - fruit = petstore_api.FruitReq(cultivar=cultivar) + fruit = FruitReq(cultivar=cultivar) # check its properties self.assertEqual(fruit.cultivar, cultivar) self.assertEqual(fruit['cultivar'], cultivar) @@ -142,7 +153,7 @@ def testFruitReq(self): # model._composed_instances is a list of the instances that were # made from the anyOf/allOf/OneOf classes in model._composed_schemas for composed_instance in fruit._composed_instances: - if composed_instance.__class__ == petstore_api.AppleReq: + if composed_instance.__class__ == apple_req.AppleReq: apple_instance = composed_instance self.assertEqual( fruit._composed_instances, diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_gm_fruit.py b/samples/openapi3/client/petstore/python-experimental/test/test_gm_fruit.py index c68121f1fd8f..9d13e90659d0 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_gm_fruit.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_gm_fruit.py @@ -11,10 +11,21 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import apple +except ImportError: + apple = sys.modules[ + 'petstore_api.model.apple'] +try: + from petstore_api.model import banana +except ImportError: + banana = sys.modules[ + 'petstore_api.model.banana'] +from petstore_api.model.gm_fruit import GmFruit class TestGmFruit(unittest.TestCase): @@ -33,7 +44,7 @@ def testGmFruit(self): # banana test length_cm = 20.3 color = 'yellow' - fruit = petstore_api.GmFruit(length_cm=length_cm, color=color) + fruit = GmFruit(length_cm=length_cm, color=color) # check its properties self.assertEqual(fruit.length_cm, length_cm) self.assertEqual(fruit['length_cm'], length_cm) @@ -73,8 +84,8 @@ def testGmFruit(self): fruit._composed_schemas, { 'anyOf': [ - petstore_api.Apple, - petstore_api.Banana, + apple.Apple, + banana.Banana, ], 'allOf': [], 'oneOf': [], @@ -83,7 +94,7 @@ def testGmFruit(self): # model._composed_instances is a list of the instances that were # made from the anyOf/allOf/OneOf classes in model._composed_schemas for composed_instance in fruit._composed_instances: - if composed_instance.__class__ == petstore_api.Banana: + if composed_instance.__class__ == banana.Banana: banana_instance = composed_instance self.assertEqual( fruit._composed_instances, @@ -115,7 +126,7 @@ def testGmFruit(self): # including extra parameters raises an exception with self.assertRaises(petstore_api.ApiValueError): - fruit = petstore_api.GmFruit( + fruit = GmFruit( color=color, length_cm=length_cm, unknown_property='some value' @@ -124,7 +135,7 @@ def testGmFruit(self): # including input parameters for both anyOf instances works cultivar = 'banaple' color = 'orange' - fruit = petstore_api.GmFruit( + fruit = GmFruit( color=color, cultivar=cultivar, length_cm=length_cm @@ -142,9 +153,9 @@ def testGmFruit(self): # model._composed_instances is a list of the instances that were # made from the anyOf/allOf/OneOf classes in model._composed_schemas for composed_instance in fruit._composed_instances: - if composed_instance.__class__ == petstore_api.Apple: + if composed_instance.__class__ == apple.Apple: apple_instance = composed_instance - elif composed_instance.__class__ == petstore_api.Banana: + elif composed_instance.__class__ == banana.Banana: banana_instance = composed_instance self.assertEqual( fruit._composed_instances, @@ -167,7 +178,7 @@ def testGmFruit(self): color = 'red' cultivar = 'golden delicious' origin = 'California' - fruit = petstore_api.GmFruit(color=color, cultivar=cultivar, origin=origin) + fruit = GmFruit(color=color, cultivar=cultivar, origin=origin) # check its properties self.assertEqual(fruit.color, color) self.assertEqual(fruit['color'], color) @@ -193,7 +204,7 @@ def testGmFruit(self): # model._composed_instances is a list of the instances that were # made from the anyOf/allOf/OneOf classes in model._composed_schemas for composed_instance in fruit._composed_instances: - if composed_instance.__class__ == petstore_api.Apple: + if composed_instance.__class__ == apple.Apple: apple_instance = composed_instance self.assertEqual( fruit._composed_instances, diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_grandparent_animal.py b/samples/openapi3/client/petstore/python-experimental/test/test_grandparent_animal.py index dc0d300cdaea..286ef176575b 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_grandparent_animal.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_grandparent_animal.py @@ -11,10 +11,21 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import child_cat +except ImportError: + child_cat = sys.modules[ + 'petstore_api.model.child_cat'] +try: + from petstore_api.model import parent_pet +except ImportError: + parent_pet = sys.modules[ + 'petstore_api.model.parent_pet'] +from petstore_api.model.grandparent_animal import GrandparentAnimal class TestGrandparentAnimal(unittest.TestCase): @@ -29,7 +40,7 @@ def tearDown(self): def testGrandparentAnimal(self): """Test GrandparentAnimal""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.GrandparentAnimal() # noqa: E501 + # model = GrandparentAnimal() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_has_only_read_only.py b/samples/openapi3/client/petstore/python-experimental/test/test_has_only_read_only.py index e042faf7c94c..9ebd7683b398 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_has_only_read_only.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_has_only_read_only.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.has_only_read_only import HasOnlyReadOnly class TestHasOnlyReadOnly(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testHasOnlyReadOnly(self): """Test HasOnlyReadOnly""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.HasOnlyReadOnly() # noqa: E501 + # model = HasOnlyReadOnly() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_health_check_result.py b/samples/openapi3/client/petstore/python-experimental/test/test_health_check_result.py index ebcc32f43964..11ff5f5cf636 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_health_check_result.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_health_check_result.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.health_check_result import HealthCheckResult class TestHealthCheckResult(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testHealthCheckResult(self): """Test HealthCheckResult""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.HealthCheckResult() # noqa: E501 + # model = HealthCheckResult() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_inline_object.py b/samples/openapi3/client/petstore/python-experimental/test/test_inline_object.py index fc2e177006a2..3b3eee80807c 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_inline_object.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_inline_object.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.inline_object import InlineObject class TestInlineObject(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testInlineObject(self): """Test InlineObject""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.InlineObject() # noqa: E501 + # model = InlineObject() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_inline_object1.py b/samples/openapi3/client/petstore/python-experimental/test/test_inline_object1.py index 12a62225defd..77d4b46553dd 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_inline_object1.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_inline_object1.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.inline_object1 import InlineObject1 class TestInlineObject1(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testInlineObject1(self): """Test InlineObject1""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.InlineObject1() # noqa: E501 + # model = InlineObject1() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_inline_object2.py b/samples/openapi3/client/petstore/python-experimental/test/test_inline_object2.py index 1651197f964b..b2310f152179 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_inline_object2.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_inline_object2.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.inline_object2 import InlineObject2 class TestInlineObject2(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testInlineObject2(self): """Test InlineObject2""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.InlineObject2() # noqa: E501 + # model = InlineObject2() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_inline_object3.py b/samples/openapi3/client/petstore/python-experimental/test/test_inline_object3.py index 2efbae377dde..afe7ca434286 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_inline_object3.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_inline_object3.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.inline_object3 import InlineObject3 class TestInlineObject3(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testInlineObject3(self): """Test InlineObject3""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.InlineObject3() # noqa: E501 + # model = InlineObject3() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_inline_object4.py b/samples/openapi3/client/petstore/python-experimental/test/test_inline_object4.py index 4f74d9cacacf..1b9bea4716dc 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_inline_object4.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_inline_object4.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.inline_object4 import InlineObject4 class TestInlineObject4(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testInlineObject4(self): """Test InlineObject4""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.InlineObject4() # noqa: E501 + # model = InlineObject4() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_inline_object5.py b/samples/openapi3/client/petstore/python-experimental/test/test_inline_object5.py index 895cc44ea290..ac72c53c1e3c 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_inline_object5.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_inline_object5.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.inline_object5 import InlineObject5 class TestInlineObject5(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testInlineObject5(self): """Test InlineObject5""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.InlineObject5() # noqa: E501 + # model = InlineObject5() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_inline_response_default.py b/samples/openapi3/client/petstore/python-experimental/test/test_inline_response_default.py index ecdd05f72fa4..b52167aea166 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_inline_response_default.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_inline_response_default.py @@ -11,10 +11,16 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import foo +except ImportError: + foo = sys.modules[ + 'petstore_api.model.foo'] +from petstore_api.model.inline_response_default import InlineResponseDefault class TestInlineResponseDefault(unittest.TestCase): @@ -29,7 +35,7 @@ def tearDown(self): def testInlineResponseDefault(self): """Test InlineResponseDefault""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.InlineResponseDefault() # noqa: E501 + # model = InlineResponseDefault() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_isosceles_triangle.py b/samples/openapi3/client/petstore/python-experimental/test/test_isosceles_triangle.py index 1f27f751d061..d89ae6ab78dd 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_isosceles_triangle.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_isosceles_triangle.py @@ -11,10 +11,21 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import shape_interface +except ImportError: + shape_interface = sys.modules[ + 'petstore_api.model.shape_interface'] +try: + from petstore_api.model import triangle_interface +except ImportError: + triangle_interface = sys.modules[ + 'petstore_api.model.triangle_interface'] +from petstore_api.model.isosceles_triangle import IsoscelesTriangle class TestIsoscelesTriangle(unittest.TestCase): @@ -29,7 +40,7 @@ def tearDown(self): def testIsoscelesTriangle(self): """Test IsoscelesTriangle""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.IsoscelesTriangle() # noqa: E501 + # model = IsoscelesTriangle() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_list.py b/samples/openapi3/client/petstore/python-experimental/test/test_list.py index 29979911a8e9..52156adfed2e 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_list.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_list.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.list import List class TestList(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testList(self): """Test List""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.List() # noqa: E501 + # model = List() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_mammal.py b/samples/openapi3/client/petstore/python-experimental/test/test_mammal.py index cc783f53ed64..2a8893d02fb3 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_mammal.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_mammal.py @@ -11,10 +11,21 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import whale +except ImportError: + whale = sys.modules[ + 'petstore_api.model.whale'] +try: + from petstore_api.model import zebra +except ImportError: + zebra = sys.modules[ + 'petstore_api.model.zebra'] +from petstore_api.model.mammal import Mammal class TestMammal(unittest.TestCase): @@ -30,8 +41,9 @@ def testMammal(self): """Test Mammal""" # tests that we can make a BasquePig by traveling through descendant discriminator in Pig - model = petstore_api.Mammal(class_name="BasquePig") - assert isinstance(model, petstore_api.BasquePig) + model = Mammal(class_name="BasquePig") + from petstore_api.model import basque_pig + assert isinstance(model, basque_pig.BasquePig) if __name__ == '__main__': diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_map_test.py b/samples/openapi3/client/petstore/python-experimental/test/test_map_test.py index 8592f21949bd..88b28ff93dac 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_map_test.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_map_test.py @@ -11,10 +11,16 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import string_boolean_map +except ImportError: + string_boolean_map = sys.modules[ + 'petstore_api.model.string_boolean_map'] +from petstore_api.model.map_test import MapTest class TestMapTest(unittest.TestCase): @@ -29,7 +35,7 @@ def tearDown(self): def testMapTest(self): """Test MapTest""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.MapTest() # noqa: E501 + # model = MapTest() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_mixed_properties_and_additional_properties_class.py b/samples/openapi3/client/petstore/python-experimental/test/test_mixed_properties_and_additional_properties_class.py index a4e89d3e8c07..4dcb5ad4268c 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_mixed_properties_and_additional_properties_class.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_mixed_properties_and_additional_properties_class.py @@ -11,10 +11,16 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import animal +except ImportError: + animal = sys.modules[ + 'petstore_api.model.animal'] +from petstore_api.model.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass class TestMixedPropertiesAndAdditionalPropertiesClass(unittest.TestCase): @@ -29,7 +35,7 @@ def tearDown(self): def testMixedPropertiesAndAdditionalPropertiesClass(self): """Test MixedPropertiesAndAdditionalPropertiesClass""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.MixedPropertiesAndAdditionalPropertiesClass() # noqa: E501 + # model = MixedPropertiesAndAdditionalPropertiesClass() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_model200_response.py b/samples/openapi3/client/petstore/python-experimental/test/test_model200_response.py index 149629fe1e8e..4012eaae3362 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_model200_response.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_model200_response.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.model200_response import Model200Response class TestModel200Response(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testModel200Response(self): """Test Model200Response""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.Model200Response() # noqa: E501 + # model = Model200Response() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_model_return.py b/samples/openapi3/client/petstore/python-experimental/test/test_model_return.py index e48b2c479839..54c98b33cd66 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_model_return.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_model_return.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.model_return import ModelReturn class TestModelReturn(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testModelReturn(self): """Test ModelReturn""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.ModelReturn() # noqa: E501 + # model = ModelReturn() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_name.py b/samples/openapi3/client/petstore/python-experimental/test/test_name.py index 1f6407683b29..6a9be99d1a57 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_name.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_name.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.name import Name class TestName(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testName(self): """Test Name""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.Name() # noqa: E501 + # model = Name() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_nullable_class.py b/samples/openapi3/client/petstore/python-experimental/test/test_nullable_class.py index 8af2cb8447ee..f73dc3d98bbb 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_nullable_class.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_nullable_class.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.nullable_class import NullableClass class TestNullableClass(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testNullableClass(self): """Test NullableClass""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.NullableClass() # noqa: E501 + # model = NullableClass() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_nullable_shape.py b/samples/openapi3/client/petstore/python-experimental/test/test_nullable_shape.py index 1e22479d4db4..d6bf001743bf 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_nullable_shape.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_nullable_shape.py @@ -11,10 +11,21 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import quadrilateral +except ImportError: + quadrilateral = sys.modules[ + 'petstore_api.model.quadrilateral'] +try: + from petstore_api.model import triangle +except ImportError: + triangle = sys.modules[ + 'petstore_api.model.triangle'] +from petstore_api.model.nullable_shape import NullableShape class TestNullableShape(unittest.TestCase): @@ -29,7 +40,7 @@ def tearDown(self): def testNullableShape(self): """Test NullableShape""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.NullableShape() # noqa: E501 + # model = NullableShape() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_number_only.py b/samples/openapi3/client/petstore/python-experimental/test/test_number_only.py index 732baf4b84ed..07aab1d78af7 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_number_only.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_number_only.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.number_only import NumberOnly class TestNumberOnly(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testNumberOnly(self): """Test NumberOnly""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.NumberOnly() # noqa: E501 + # model = NumberOnly() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_order.py b/samples/openapi3/client/petstore/python-experimental/test/test_order.py index 10ce38e954ea..604c67042c34 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_order.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_order.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.order import Order class TestOrder(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testOrder(self): """Test Order""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.Order() # noqa: E501 + # model = Order() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_outer_composite.py b/samples/openapi3/client/petstore/python-experimental/test/test_outer_composite.py index c191d04ec6b2..7da5c1f09b59 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_outer_composite.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_outer_composite.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.outer_composite import OuterComposite class TestOuterComposite(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testOuterComposite(self): """Test OuterComposite""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.OuterComposite() # noqa: E501 + # model = OuterComposite() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_outer_enum.py b/samples/openapi3/client/petstore/python-experimental/test/test_outer_enum.py index fbb8cb7ad5cf..ab9dac9d612b 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_outer_enum.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_outer_enum.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.outer_enum import OuterEnum class TestOuterEnum(unittest.TestCase): @@ -30,15 +31,14 @@ def testOuterEnum(self): """Test OuterEnum""" # Since 'OuterEnum' is nullable, validate the null value can be assigned # to OuterEnum. - inst = petstore_api.OuterEnum(None) + inst = OuterEnum(None) self.assertIsNone(inst) - inst = petstore_api.OuterEnum('approved') - assert isinstance(inst, petstore_api.OuterEnum) + inst = OuterEnum('approved') + assert isinstance(inst, OuterEnum) with self.assertRaises(petstore_api.ApiValueError): - inst = petstore_api.OuterEnum('garbage') - assert isinstance(inst, petstore_api.OuterEnum) + OuterEnum('garbage') if __name__ == '__main__': diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_outer_enum_default_value.py b/samples/openapi3/client/petstore/python-experimental/test/test_outer_enum_default_value.py index 80c9534a88e2..a0f6fb3cef51 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_outer_enum_default_value.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_outer_enum_default_value.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.outer_enum_default_value import OuterEnumDefaultValue class TestOuterEnumDefaultValue(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testOuterEnumDefaultValue(self): """Test OuterEnumDefaultValue""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.OuterEnumDefaultValue() # noqa: E501 + # model = OuterEnumDefaultValue() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_outer_enum_integer.py b/samples/openapi3/client/petstore/python-experimental/test/test_outer_enum_integer.py index 60724eefd711..9e0fa2975b4b 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_outer_enum_integer.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_outer_enum_integer.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.outer_enum_integer import OuterEnumInteger class TestOuterEnumInteger(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testOuterEnumInteger(self): """Test OuterEnumInteger""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.OuterEnumInteger() # noqa: E501 + # model = OuterEnumInteger() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_outer_enum_integer_default_value.py b/samples/openapi3/client/petstore/python-experimental/test/test_outer_enum_integer_default_value.py index 8eca8fa69ac1..6eb78f95b0cf 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_outer_enum_integer_default_value.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_outer_enum_integer_default_value.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.outer_enum_integer_default_value import OuterEnumIntegerDefaultValue class TestOuterEnumIntegerDefaultValue(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testOuterEnumIntegerDefaultValue(self): """Test OuterEnumIntegerDefaultValue""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.OuterEnumIntegerDefaultValue() # noqa: E501 + # model = OuterEnumIntegerDefaultValue() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_parent_pet.py b/samples/openapi3/client/petstore/python-experimental/test/test_parent_pet.py index 8db04124d66e..15262872e195 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_parent_pet.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_parent_pet.py @@ -11,10 +11,21 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import child_cat +except ImportError: + child_cat = sys.modules[ + 'petstore_api.model.child_cat'] +try: + from petstore_api.model import grandparent_animal +except ImportError: + grandparent_animal = sys.modules[ + 'petstore_api.model.grandparent_animal'] +from petstore_api.model.parent_pet import ParentPet class TestParentPet(unittest.TestCase): @@ -32,8 +43,9 @@ def testParentPet(self): # test that we can make a ParentPet from a ParentPet # which requires that we travel back through ParentPet's allOf descendant # GrandparentAnimal, and we use the descendant's discriminator to make ParentPet - model = petstore_api.ParentPet(pet_type="ParentPet") - assert isinstance(model, petstore_api.ParentPet) + model = ParentPet(pet_type="ParentPet") + assert isinstance(model, ParentPet) + if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_pet.py b/samples/openapi3/client/petstore/python-experimental/test/test_pet.py index db9e3729f505..fb8586e4090c 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_pet.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_pet.py @@ -11,10 +11,21 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import category +except ImportError: + category = sys.modules[ + 'petstore_api.model.category'] +try: + from petstore_api.model import tag +except ImportError: + tag = sys.modules[ + 'petstore_api.model.tag'] +from petstore_api.model.pet import Pet class TestPet(unittest.TestCase): @@ -29,7 +40,7 @@ def tearDown(self): def testPet(self): """Test Pet""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.Pet() # noqa: E501 + # model = Pet() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_pet_api.py b/samples/openapi3/client/petstore/python-experimental/test/test_pet_api.py index 77665df879f1..3f2d3a8847ca 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_pet_api.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_pet_api.py @@ -16,14 +16,13 @@ import petstore_api from petstore_api.api.pet_api import PetApi # noqa: E501 -from petstore_api.rest import ApiException class TestPetApi(unittest.TestCase): """PetApi unit test stubs""" def setUp(self): - self.api = petstore_api.api.pet_api.PetApi() # noqa: E501 + self.api = PetApi() # noqa: E501 def tearDown(self): pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_pig.py b/samples/openapi3/client/petstore/python-experimental/test/test_pig.py index afdd210da7d9..f98bed3f1910 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_pig.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_pig.py @@ -11,10 +11,21 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import basque_pig +except ImportError: + basque_pig = sys.modules[ + 'petstore_api.model.basque_pig'] +try: + from petstore_api.model import danish_pig +except ImportError: + danish_pig = sys.modules[ + 'petstore_api.model.danish_pig'] +from petstore_api.model.pig import Pig class TestPig(unittest.TestCase): @@ -29,7 +40,7 @@ def tearDown(self): def testPig(self): """Test Pig""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.Pig() # noqa: E501 + # model = Pig() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_quadrilateral.py b/samples/openapi3/client/petstore/python-experimental/test/test_quadrilateral.py index 9bb838811892..149b9a0070b6 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_quadrilateral.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_quadrilateral.py @@ -11,10 +11,21 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import complex_quadrilateral +except ImportError: + complex_quadrilateral = sys.modules[ + 'petstore_api.model.complex_quadrilateral'] +try: + from petstore_api.model import simple_quadrilateral +except ImportError: + simple_quadrilateral = sys.modules[ + 'petstore_api.model.simple_quadrilateral'] +from petstore_api.model.quadrilateral import Quadrilateral class TestQuadrilateral(unittest.TestCase): @@ -28,10 +39,10 @@ def tearDown(self): def testQuadrilateral(self): """Test Quadrilateral""" - complex_quadrilateral = petstore_api.Quadrilateral(shape_type="Quadrilateral", quadrilateral_type="ComplexQuadrilateral") - assert isinstance(complex_quadrilateral, petstore_api.ComplexQuadrilateral) - simple_quadrilateral = petstore_api.Quadrilateral(shape_type="Quadrilateral", quadrilateral_type="SimpleQuadrilateral") - assert isinstance(simple_quadrilateral, petstore_api.SimpleQuadrilateral) + instance = Quadrilateral(shape_type="Quadrilateral", quadrilateral_type="ComplexQuadrilateral") + assert isinstance(instance, complex_quadrilateral.ComplexQuadrilateral) + instance = Quadrilateral(shape_type="Quadrilateral", quadrilateral_type="SimpleQuadrilateral") + assert isinstance(instance, simple_quadrilateral.SimpleQuadrilateral) if __name__ == '__main__': diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_quadrilateral_interface.py b/samples/openapi3/client/petstore/python-experimental/test/test_quadrilateral_interface.py index 7a48ce64a9df..0b2e32dc37af 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_quadrilateral_interface.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_quadrilateral_interface.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.quadrilateral_interface import QuadrilateralInterface class TestQuadrilateralInterface(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testQuadrilateralInterface(self): """Test QuadrilateralInterface""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.QuadrilateralInterface() # noqa: E501 + # model = QuadrilateralInterface() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_read_only_first.py b/samples/openapi3/client/petstore/python-experimental/test/test_read_only_first.py index 553768f3303a..c2dcde240e77 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_read_only_first.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_read_only_first.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.read_only_first import ReadOnlyFirst class TestReadOnlyFirst(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testReadOnlyFirst(self): """Test ReadOnlyFirst""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.ReadOnlyFirst() # noqa: E501 + # model = ReadOnlyFirst() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_scalene_triangle.py b/samples/openapi3/client/petstore/python-experimental/test/test_scalene_triangle.py index 8452fc183137..f5f1ccb3efa0 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_scalene_triangle.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_scalene_triangle.py @@ -11,10 +11,21 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import shape_interface +except ImportError: + shape_interface = sys.modules[ + 'petstore_api.model.shape_interface'] +try: + from petstore_api.model import triangle_interface +except ImportError: + triangle_interface = sys.modules[ + 'petstore_api.model.triangle_interface'] +from petstore_api.model.scalene_triangle import ScaleneTriangle class TestScaleneTriangle(unittest.TestCase): @@ -29,7 +40,7 @@ def tearDown(self): def testScaleneTriangle(self): """Test ScaleneTriangle""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.ScaleneTriangle() # noqa: E501 + # model = ScaleneTriangle() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_shape.py b/samples/openapi3/client/petstore/python-experimental/test/test_shape.py index e06fd0cb6faf..4424679aeccb 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_shape.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_shape.py @@ -11,10 +11,21 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import quadrilateral +except ImportError: + quadrilateral = sys.modules[ + 'petstore_api.model.quadrilateral'] +try: + from petstore_api.model import triangle +except ImportError: + triangle = sys.modules[ + 'petstore_api.model.triangle'] +from petstore_api.model.shape import Shape class TestShape(unittest.TestCase): @@ -28,67 +39,71 @@ def tearDown(self): def testShape(self): """Test Shape""" - equilateral_triangle = petstore_api.Triangle( + from petstore_api.model import complex_quadrilateral + from petstore_api.model import simple_quadrilateral + from petstore_api.model import equilateral_triangle + from petstore_api.model import isosceles_triangle + from petstore_api.model import scalene_triangle + tri = triangle.Triangle( shape_type="Triangle", triangle_type="EquilateralTriangle" ) - assert isinstance(equilateral_triangle, petstore_api.EquilateralTriangle) + assert isinstance(tri, equilateral_triangle.EquilateralTriangle) - isosceles_triangle = petstore_api.Triangle( + tri = triangle.Triangle( shape_type="Triangle", triangle_type="IsoscelesTriangle" ) - assert isinstance(isosceles_triangle, petstore_api.IsoscelesTriangle) + assert isinstance(tri, isosceles_triangle.IsoscelesTriangle) - scalene_triangle = petstore_api.Triangle( + tri = triangle.Triangle( shape_type="Triangle", triangle_type="ScaleneTriangle" ) - assert isinstance(scalene_triangle, petstore_api.ScaleneTriangle) + assert isinstance(tri, scalene_triangle.ScaleneTriangle) - complex_quadrilateral = petstore_api.Shape( + quad = Shape( shape_type="Quadrilateral", quadrilateral_type="ComplexQuadrilateral" ) - assert isinstance(complex_quadrilateral, petstore_api.ComplexQuadrilateral) + assert isinstance(quad, complex_quadrilateral.ComplexQuadrilateral) - simple_quadrilateral = petstore_api.Shape( + quad = Shape( shape_type="Quadrilateral", quadrilateral_type="SimpleQuadrilateral" ) - assert isinstance(simple_quadrilateral, petstore_api.SimpleQuadrilateral) + assert isinstance(quad, simple_quadrilateral.SimpleQuadrilateral) # No discriminator provided. err_msg = ("Cannot deserialize input data due to missing discriminator. " - "The discriminator property '{}' is missing at path: ()" - ) + "The discriminator property '{}' is missing at path: ()" + ) with self.assertRaisesRegexp( - petstore_api.ApiValueError, - err_msg.format("shapeType") + petstore_api.ApiValueError, + err_msg.format("shapeType") ): - petstore_api.Shape() + Shape() # invalid shape_type (first discriminator). 'Circle' does not exist in the model. err_msg = ("Cannot deserialize input data due to invalid discriminator " - "value. The OpenAPI document has no mapping for discriminator " - "property '{}'='{}' at path: ()" - ) + "value. The OpenAPI document has no mapping for discriminator " + "property '{}'='{}' at path: ()" + ) with self.assertRaisesRegexp( - petstore_api.ApiValueError, - err_msg.format("shapeType", "Circle") + petstore_api.ApiValueError, + err_msg.format("shapeType", "Circle") ): - petstore_api.Shape(shape_type="Circle") + Shape(shape_type="Circle") # invalid quadrilateral_type (second discriminator) with self.assertRaisesRegexp( - petstore_api.ApiValueError, - err_msg.format("quadrilateralType", "Triangle") + petstore_api.ApiValueError, + err_msg.format("quadrilateralType", "Triangle") ): - petstore_api.Shape( + Shape( shape_type="Quadrilateral", quadrilateral_type="Triangle" ) - if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_shape_interface.py b/samples/openapi3/client/petstore/python-experimental/test/test_shape_interface.py index a768951489a0..c8b0270f9fc5 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_shape_interface.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_shape_interface.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.shape_interface import ShapeInterface class TestShapeInterface(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testShapeInterface(self): """Test ShapeInterface""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.ShapeInterface() # noqa: E501 + # model = ShapeInterface() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_shape_or_null.py b/samples/openapi3/client/petstore/python-experimental/test/test_shape_or_null.py index b04d847204bc..e3bfa41e7e84 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_shape_or_null.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_shape_or_null.py @@ -11,10 +11,21 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import quadrilateral +except ImportError: + quadrilateral = sys.modules[ + 'petstore_api.model.quadrilateral'] +try: + from petstore_api.model import triangle +except ImportError: + triangle = sys.modules[ + 'petstore_api.model.triangle'] +from petstore_api.model.shape_or_null import ShapeOrNull class TestShapeOrNull(unittest.TestCase): @@ -29,7 +40,7 @@ def tearDown(self): def testShapeOrNull(self): """Test ShapeOrNull""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.ShapeOrNull() # noqa: E501 + # model = ShapeOrNull() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_simple_quadrilateral.py b/samples/openapi3/client/petstore/python-experimental/test/test_simple_quadrilateral.py index f51722093445..b08ddf1c6781 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_simple_quadrilateral.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_simple_quadrilateral.py @@ -11,10 +11,21 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import quadrilateral_interface +except ImportError: + quadrilateral_interface = sys.modules[ + 'petstore_api.model.quadrilateral_interface'] +try: + from petstore_api.model import shape_interface +except ImportError: + shape_interface = sys.modules[ + 'petstore_api.model.shape_interface'] +from petstore_api.model.simple_quadrilateral import SimpleQuadrilateral class TestSimpleQuadrilateral(unittest.TestCase): @@ -29,7 +40,7 @@ def tearDown(self): def testSimpleQuadrilateral(self): """Test SimpleQuadrilateral""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.SimpleQuadrilateral() # noqa: E501 + # model = SimpleQuadrilateral() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_special_model_name.py b/samples/openapi3/client/petstore/python-experimental/test/test_special_model_name.py index 7de520d9cefe..6124525f5170 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_special_model_name.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_special_model_name.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.special_model_name import SpecialModelName class TestSpecialModelName(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testSpecialModelName(self): """Test SpecialModelName""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.SpecialModelName() # noqa: E501 + # model = SpecialModelName() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_store_api.py b/samples/openapi3/client/petstore/python-experimental/test/test_store_api.py index 81848d24a67e..0d9cc3dd36ea 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_store_api.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_store_api.py @@ -16,14 +16,13 @@ import petstore_api from petstore_api.api.store_api import StoreApi # noqa: E501 -from petstore_api.rest import ApiException class TestStoreApi(unittest.TestCase): """StoreApi unit test stubs""" def setUp(self): - self.api = petstore_api.api.store_api.StoreApi() # noqa: E501 + self.api = StoreApi() # noqa: E501 def tearDown(self): pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_string_boolean_map.py b/samples/openapi3/client/petstore/python-experimental/test/test_string_boolean_map.py index af071721eba3..e2e9d8b420b8 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_string_boolean_map.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_string_boolean_map.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.string_boolean_map import StringBooleanMap class TestStringBooleanMap(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testStringBooleanMap(self): """Test StringBooleanMap""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.StringBooleanMap() # noqa: E501 + # model = StringBooleanMap() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_tag.py b/samples/openapi3/client/petstore/python-experimental/test/test_tag.py index 27c2be5391ab..b0a09d94a785 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_tag.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_tag.py @@ -15,6 +15,7 @@ import unittest import petstore_api +from petstore_api.model.tag import Tag class TestTag(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testTag(self): """Test Tag""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.Tag() # noqa: E501 + # model = Tag() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_triangle.py b/samples/openapi3/client/petstore/python-experimental/test/test_triangle.py index 42037a1ec79b..65ae20743e14 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_triangle.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_triangle.py @@ -11,10 +11,26 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import equilateral_triangle +except ImportError: + equilateral_triangle = sys.modules[ + 'petstore_api.model.equilateral_triangle'] +try: + from petstore_api.model import isosceles_triangle +except ImportError: + isosceles_triangle = sys.modules[ + 'petstore_api.model.isosceles_triangle'] +try: + from petstore_api.model import scalene_triangle +except ImportError: + scalene_triangle = sys.modules[ + 'petstore_api.model.scalene_triangle'] +from petstore_api.model.triangle import Triangle class TestTriangle(unittest.TestCase): @@ -28,12 +44,12 @@ def tearDown(self): def testTriangle(self): """Test Triangle""" - equilateral_triangle = petstore_api.Triangle(shape_type="Triangle", triangle_type="EquilateralTriangle") - assert isinstance(equilateral_triangle, petstore_api.EquilateralTriangle) - isosceles_triangle = petstore_api.Triangle(shape_type="Triangle", triangle_type="IsoscelesTriangle") - assert isinstance(isosceles_triangle, petstore_api.IsoscelesTriangle) - scalene_triangle = petstore_api.Triangle(shape_type="Triangle", triangle_type="ScaleneTriangle") - assert isinstance(scalene_triangle, petstore_api.ScaleneTriangle) + tri = Triangle(shape_type="Triangle", triangle_type="EquilateralTriangle") + assert isinstance(tri, equilateral_triangle.EquilateralTriangle) + tri = Triangle(shape_type="Triangle", triangle_type="IsoscelesTriangle") + assert isinstance(tri, isosceles_triangle.IsoscelesTriangle) + tri = Triangle(shape_type="Triangle", triangle_type="ScaleneTriangle") + assert isinstance(tri, scalene_triangle.ScaleneTriangle) if __name__ == '__main__': diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_triangle_interface.py b/samples/openapi3/client/petstore/python-experimental/test/test_triangle_interface.py index 4d87e647e61e..e087651a7d55 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_triangle_interface.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_triangle_interface.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.triangle_interface import TriangleInterface class TestTriangleInterface(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testTriangleInterface(self): """Test TriangleInterface""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.TriangleInterface() # noqa: E501 + # model = TriangleInterface() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_user.py b/samples/openapi3/client/petstore/python-experimental/test/test_user.py index 3df641e29b6a..7241bb589c52 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_user.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_user.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.user import User class TestUser(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testUser(self): """Test User""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.User() # noqa: E501 + # model = User() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_user_api.py b/samples/openapi3/client/petstore/python-experimental/test/test_user_api.py index 6df730fba2b1..df306da07761 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_user_api.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_user_api.py @@ -16,14 +16,13 @@ import petstore_api from petstore_api.api.user_api import UserApi # noqa: E501 -from petstore_api.rest import ApiException class TestUserApi(unittest.TestCase): """UserApi unit test stubs""" def setUp(self): - self.api = petstore_api.api.user_api.UserApi() # noqa: E501 + self.api = UserApi() # noqa: E501 def tearDown(self): pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_whale.py b/samples/openapi3/client/petstore/python-experimental/test/test_whale.py index 35d68f0cda02..3ad793af3e43 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_whale.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_whale.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.whale import Whale class TestWhale(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testWhale(self): """Test Whale""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.Whale() # noqa: E501 + # model = Whale() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_zebra.py b/samples/openapi3/client/petstore/python-experimental/test/test_zebra.py index 6013bd9a9a20..fe3245cced48 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_zebra.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_zebra.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.zebra import Zebra class TestZebra(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testZebra(self): """Test Zebra""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.Zebra() # noqa: E501 + # model = Zebra() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/tests/test_api_validation.py b/samples/openapi3/client/petstore/python-experimental/tests/test_api_validation.py index a8a7276142bc..edf48ad0160b 100644 --- a/samples/openapi3/client/petstore/python-experimental/tests/test_api_validation.py +++ b/samples/openapi3/client/petstore/python-experimental/tests/test_api_validation.py @@ -21,6 +21,7 @@ from collections import namedtuple import petstore_api +from petstore_api.model import format_test import petstore_api.configuration HOST = 'http://petstore.swagger.io/v2' @@ -50,7 +51,7 @@ def checkRaiseRegex(self, expected_exception, expected_regex): def test_multiple_of(self): - inst = petstore_api.FormatTest( + inst = format_test.FormatTest( byte='3', date=datetime.date(2000, 1, 1), password="abcdefghijkl", @@ -58,10 +59,10 @@ def test_multiple_of(self): number=65.0, float=62.4 ) - assert isinstance(inst, petstore_api.FormatTest) + assert isinstance(inst, format_test.FormatTest) with self.checkRaiseRegex(petstore_api.exceptions.ApiValueError, "Invalid value for `integer`, value must be a multiple of `2`"): - inst = petstore_api.FormatTest( + inst = format_test.FormatTest( byte='3', date=datetime.date(2000, 1, 1), password="abcdefghijkl", @@ -80,8 +81,8 @@ def test_multiple_of_deserialization(self): 'float': 62.4, } response = MockResponse(data=json.dumps(data)) - deserialized = self.api_client.deserialize(response, (petstore_api.FormatTest,), True) - self.assertTrue(isinstance(deserialized, petstore_api.FormatTest)) + deserialized = self.api_client.deserialize(response, (format_test.FormatTest,), True) + self.assertTrue(isinstance(deserialized, format_test.FormatTest)) with self.checkRaiseRegex(petstore_api.exceptions.ApiValueError, "Invalid value for `integer`, value must be a multiple of `2`"): data = { @@ -93,7 +94,7 @@ def test_multiple_of_deserialization(self): 'float': 62.4, } response = MockResponse(data=json.dumps(data)) - deserialized = self.api_client.deserialize(response, (petstore_api.FormatTest,), True) + deserialized = self.api_client.deserialize(response, (format_test.FormatTest,), True) # Disable JSON schema validation. No error should be raised during deserialization. config = petstore_api.Configuration() @@ -109,8 +110,8 @@ def test_multiple_of_deserialization(self): 'float': 62.4, } response = MockResponse(data=json.dumps(data)) - deserialized = api_client.deserialize(response, (petstore_api.FormatTest,), True) - self.assertTrue(isinstance(deserialized, petstore_api.FormatTest)) + deserialized = api_client.deserialize(response, (format_test.FormatTest,), True) + self.assertTrue(isinstance(deserialized, format_test.FormatTest)) # Disable JSON schema validation but for a different keyword. # An error should be raised during deserialization. @@ -128,4 +129,4 @@ def test_multiple_of_deserialization(self): 'float': 62.4, } response = MockResponse(data=json.dumps(data)) - deserialized = api_client.deserialize(response, (petstore_api.FormatTest,), True) + deserialized = api_client.deserialize(response, (format_test.FormatTest,), True) diff --git a/samples/openapi3/client/petstore/python-experimental/tests/test_deserialization.py b/samples/openapi3/client/petstore/python-experimental/tests/test_deserialization.py index a34df3425672..23e597d9bf54 100644 --- a/samples/openapi3/client/petstore/python-experimental/tests/test_deserialization.py +++ b/samples/openapi3/client/petstore/python-experimental/tests/test_deserialization.py @@ -16,6 +16,20 @@ import datetime import petstore_api +from petstore_api.model import ( + shape, + equilateral_triangle, + animal, + dog, + apple, + mammal, + whale, + zebra, + banana, + fruit_req, + drawing, + banana_req, +) MockResponse = namedtuple('MockResponse', 'data') @@ -46,8 +60,8 @@ def test_deserialize_shape(self): } response = MockResponse(data=json.dumps(data)) - deserialized = self.deserialize(response, (petstore_api.Shape,), True) - self.assertTrue(isinstance(deserialized, petstore_api.EquilateralTriangle)) + deserialized = self.deserialize(response, (shape.Shape,), True) + self.assertTrue(isinstance(deserialized, equilateral_triangle.EquilateralTriangle)) self.assertEqual(deserialized.shape_type, shape_type) self.assertEqual(deserialized.triangle_type, triangle_type) @@ -67,7 +81,7 @@ def test_deserialize_shape(self): petstore_api.ApiValueError, err_msg.format("quadrilateralType", "Triangle") ): - self.deserialize(response, (petstore_api.Shape,), True) + self.deserialize(response, (shape.Shape,), True) def test_deserialize_animal(self): """ @@ -86,8 +100,8 @@ def test_deserialize_animal(self): } response = MockResponse(data=json.dumps(data)) - deserialized = self.deserialize(response, (petstore_api.Animal,), True) - self.assertTrue(isinstance(deserialized, petstore_api.Dog)) + deserialized = self.deserialize(response, (animal.Animal,), True) + self.assertTrue(isinstance(deserialized, dog.Dog)) self.assertEqual(deserialized.class_name, class_name) self.assertEqual(deserialized.color, color) self.assertEqual(deserialized.breed, breed) @@ -98,15 +112,15 @@ def test_regex_constraint(self): """ # Test with valid regex pattern. - inst = petstore_api.Apple( + inst = apple.Apple( cultivar="Akane" ) - assert isinstance(inst, petstore_api.Apple) + assert isinstance(inst, apple.Apple) - inst = petstore_api.Apple( + inst = apple.Apple( origin="cHiLe" ) - assert isinstance(inst, petstore_api.Apple) + assert isinstance(inst, apple.Apple) # Test with invalid regex pattern. err_msg = ("Invalid value for `{}`, must match regular expression `{}`$") @@ -114,7 +128,7 @@ def test_regex_constraint(self): petstore_api.ApiValueError, err_msg.format("cultivar", "[^`]*") ): - inst = petstore_api.Apple( + inst = apple.Apple( cultivar="!@#%@$#Akane" ) @@ -123,7 +137,7 @@ def test_regex_constraint(self): petstore_api.ApiValueError, err_msg.format("origin", "[^`]*") ): - inst = petstore_api.Apple( + inst = apple.Apple( origin="!@#%@$#Chile" ) @@ -143,8 +157,8 @@ def test_deserialize_mammal(self): 'className': class_name } response = MockResponse(data=json.dumps(data)) - deserialized = self.deserialize(response, (petstore_api.Mammal,), True) - self.assertTrue(isinstance(deserialized, petstore_api.Whale)) + deserialized = self.deserialize(response, (mammal.Mammal,), True) + self.assertTrue(isinstance(deserialized, whale.Whale)) self.assertEqual(deserialized.has_baleen, has_baleen) self.assertEqual(deserialized.has_teeth, has_teeth) self.assertEqual(deserialized.class_name, class_name) @@ -157,8 +171,8 @@ def test_deserialize_mammal(self): 'className': class_name } response = MockResponse(data=json.dumps(data)) - deserialized = self.deserialize(response, (petstore_api.Mammal,), True) - self.assertTrue(isinstance(deserialized, petstore_api.Zebra)) + deserialized = self.deserialize(response, (mammal.Mammal,), True) + self.assertTrue(isinstance(deserialized, zebra.Zebra)) self.assertEqual(deserialized.type, zebra_type) self.assertEqual(deserialized.class_name, class_name) @@ -170,8 +184,8 @@ def test_deserialize_float_value(self): 'lengthCm': 3.1415 } response = MockResponse(data=json.dumps(data)) - deserialized = self.deserialize(response, (petstore_api.Banana,), True) - self.assertTrue(isinstance(deserialized, petstore_api.Banana)) + deserialized = self.deserialize(response, (banana.Banana,), True) + self.assertTrue(isinstance(deserialized, banana.Banana)) self.assertEqual(deserialized.length_cm, 3.1415) # Float value is serialized without decimal point @@ -179,8 +193,8 @@ def test_deserialize_float_value(self): 'lengthCm': 3 } response = MockResponse(data=json.dumps(data)) - deserialized = self.deserialize(response, (petstore_api.Banana,), True) - self.assertTrue(isinstance(deserialized, petstore_api.Banana)) + deserialized = self.deserialize(response, (banana.Banana,), True) + self.assertTrue(isinstance(deserialized, banana.Banana)) self.assertEqual(deserialized.length_cm, 3.0) def test_deserialize_fruit_null_value(self): @@ -192,10 +206,10 @@ def test_deserialize_fruit_null_value(self): # Unmarshal 'null' value data = None response = MockResponse(data=json.dumps(data)) - deserialized = self.deserialize(response, (petstore_api.FruitReq, type(None)), True) + deserialized = self.deserialize(response, (fruit_req.FruitReq, type(None)), True) self.assertEqual(type(deserialized), type(None)) - inst = petstore_api.FruitReq(None) + inst = fruit_req.FruitReq(None) self.assertIsNone(inst) def test_deserialize_with_additional_properties(self): @@ -220,8 +234,8 @@ def test_deserialize_with_additional_properties(self): 'size': 'medium', } response = MockResponse(data=json.dumps(data)) - deserialized = self.deserialize(response, (petstore_api.Dog,), True) - self.assertEqual(type(deserialized), petstore_api.Dog) + deserialized = self.deserialize(response, (dog.Dog,), True) + self.assertEqual(type(deserialized), dog.Dog) self.assertEqual(deserialized.class_name, 'Dog') self.assertEqual(deserialized.breed, 'golden retriever') @@ -238,8 +252,8 @@ def test_deserialize_with_additional_properties(self): 'p2': [ 'a', 'b', 123], } response = MockResponse(data=json.dumps(data)) - deserialized = self.deserialize(response, (petstore_api.Mammal,), True) - self.assertEqual(type(deserialized), petstore_api.Zebra) + deserialized = self.deserialize(response, (mammal.Mammal,), True) + self.assertEqual(type(deserialized), zebra.Zebra) self.assertEqual(deserialized.class_name, 'zebra') self.assertEqual(deserialized.type, 'plains') self.assertEqual(deserialized.p1, True) @@ -259,8 +273,8 @@ def test_deserialize_with_additional_properties(self): 'unknown-group': 'abc', } response = MockResponse(data=json.dumps(data)) - deserialized = self.deserialize(response, (petstore_api.BananaReq,), True) - self.assertEqual(type(deserialized), petstore_api.BananaReq) + deserialized = self.deserialize(response, (banana_req.BananaReq,), True) + self.assertEqual(type(deserialized), banana_req.BananaReq) self.assertEqual(deserialized.lengthCm, 21) self.assertEqual(deserialized.p1, True) @@ -286,4 +300,4 @@ def test_deserialize_with_additional_properties_and_reference(self): ], } response = MockResponse(data=json.dumps(data)) - deserialized = self.deserialize(response, (petstore_api.Drawing,), True) + deserialized = self.deserialize(response, (drawing.Drawing,), True) diff --git a/samples/openapi3/client/petstore/python-experimental/tests/test_discard_unknown_properties.py b/samples/openapi3/client/petstore/python-experimental/tests/test_discard_unknown_properties.py index a85ae29c46e2..976a3da2df4f 100644 --- a/samples/openapi3/client/petstore/python-experimental/tests/test_discard_unknown_properties.py +++ b/samples/openapi3/client/petstore/python-experimental/tests/test_discard_unknown_properties.py @@ -12,18 +12,12 @@ """ from collections import namedtuple import json -import os import re -import shutil import unittest -from six.moves.urllib.parse import urlencode, urlparse import petstore_api +from petstore_api.model import cat, dog, isosceles_triangle, banana_req from petstore_api import Configuration, signing -from petstore_api.rest import ( - RESTClientObject, - RESTResponse -) from petstore_api.model_utils import ( file_type, @@ -57,7 +51,7 @@ def test_deserialize_banana_req_do_not_discard_unknown_properties(self): # Deserializing with strict validation raises an exception because the 'unknown_property' # is undeclared. with self.assertRaises(petstore_api.exceptions.ApiAttributeError) as cm: - deserialized = api_client.deserialize(response, ((petstore_api.BananaReq),), True) + deserialized = api_client.deserialize(response, ((banana_req.BananaReq),), True) self.assertTrue(re.match("BananaReq has no attribute 'unknown_property' at.*", str(cm.exception)), 'Exception message: {0}'.format(str(cm.exception))) @@ -83,7 +77,7 @@ def test_deserialize_isosceles_triangle_do_not_discard_unknown_properties(self): # Deserializing with strict validation raises an exception because the 'unknown_property' # is undeclared. with self.assertRaises(petstore_api.ApiValueError) as cm: - deserialized = api_client.deserialize(response, ((petstore_api.IsoscelesTriangle),), True) + deserialized = api_client.deserialize(response, ((isosceles_triangle.IsoscelesTriangle),), True) self.assertTrue(re.match('.*Not all inputs were used.*unknown_property.*', str(cm.exception)), 'Exception message: {0}'.format(str(cm.exception))) @@ -107,8 +101,8 @@ def test_deserialize_banana_req_discard_unknown_properties(self): # The 'unknown_property' is undeclared, which would normally raise an exception, but # when discard_unknown_keys is set to True, the unknown properties are discarded. response = MockResponse(data=json.dumps(data)) - deserialized = api_client.deserialize(response, ((petstore_api.BananaReq),), True) - self.assertTrue(isinstance(deserialized, petstore_api.BananaReq)) + deserialized = api_client.deserialize(response, ((banana_req.BananaReq),), True) + self.assertTrue(isinstance(deserialized, banana_req.BananaReq)) # Check the 'unknown_property' and 'more-unknown' properties are not present in the # output. self.assertIn("length_cm", deserialized.to_dict().keys()) @@ -133,8 +127,8 @@ def test_deserialize_cat_do_not_discard_unknown_properties(self): # Deserializing with strict validation does not raise an exception because the even though # the 'dynamic-property' is undeclared, the 'Cat' schema defines the additionalProperties # attribute. - deserialized = api_client.deserialize(response, ((petstore_api.Cat),), True) - self.assertTrue(isinstance(deserialized, petstore_api.Cat)) + deserialized = api_client.deserialize(response, ((cat.Cat),), True) + self.assertTrue(isinstance(deserialized, cat.Cat)) self.assertIn('color', deserialized.to_dict()) self.assertEqual(deserialized['color'], 'black') @@ -156,8 +150,8 @@ def test_deserialize_cat_discard_unknown_properties(self): # The 'my_additional_property' is undeclared, but 'Cat' has a 'Address' type through # the allOf: [ $ref: '#/components/schemas/Address' ]. response = MockResponse(data=json.dumps(data)) - deserialized = api_client.deserialize(response, ((petstore_api.Cat),), True) - self.assertTrue(isinstance(deserialized, petstore_api.Cat)) + deserialized = api_client.deserialize(response, ((cat.Cat),), True) + self.assertTrue(isinstance(deserialized, cat.Cat)) # Check the 'unknown_property' and 'more-unknown' properties are not present in the # output. self.assertIn("declawed", deserialized.to_dict().keys()) diff --git a/samples/openapi3/client/petstore/python-experimental/tests/test_http_signature.py b/samples/openapi3/client/petstore/python-experimental/tests/test_http_signature.py index 9864cf1a2139..e8f0dd186a98 100644 --- a/samples/openapi3/client/petstore/python-experimental/tests/test_http_signature.py +++ b/samples/openapi3/client/petstore/python-experimental/tests/test_http_signature.py @@ -25,6 +25,8 @@ from six.moves.urllib.parse import urlencode, urlparse import petstore_api +from petstore_api.model import category, tag, pet +from petstore_api.api.pet_api import PetApi from petstore_api import Configuration, signing from petstore_api.rest import ( RESTClientObject, @@ -211,13 +213,13 @@ def tearDownClass(cls): @classmethod def setUpModels(cls): - cls.category = petstore_api.Category() + cls.category = category.Category() cls.category.id = id_gen() cls.category.name = "dog" - cls.tag = petstore_api.Tag() + cls.tag = tag.Tag() cls.tag.id = id_gen() cls.tag.name = "python-pet-tag" - cls.pet = petstore_api.Pet( + cls.pet = pet.Pet( name="hello kity", photo_urls=["http://foo.bar.com/1", "http://foo.bar.com/2"] ) @@ -286,7 +288,7 @@ def test_valid_http_signature(self): config.access_token = None api_client = petstore_api.ApiClient(config) - pet_api = petstore_api.PetApi(api_client) + pet_api = PetApi(api_client) mock_pool = MockPoolManager(self) api_client.rest_client.pool_manager = mock_pool @@ -317,7 +319,7 @@ def test_valid_http_signature_with_defaults(self): config.access_token = None api_client = petstore_api.ApiClient(config) - pet_api = petstore_api.PetApi(api_client) + pet_api = PetApi(api_client) mock_pool = MockPoolManager(self) api_client.rest_client.pool_manager = mock_pool @@ -353,7 +355,7 @@ def test_valid_http_signature_rsassa_pkcs1v15(self): config.access_token = None api_client = petstore_api.ApiClient(config) - pet_api = petstore_api.PetApi(api_client) + pet_api = PetApi(api_client) mock_pool = MockPoolManager(self) api_client.rest_client.pool_manager = mock_pool @@ -389,7 +391,7 @@ def test_valid_http_signature_rsassa_pss(self): config.access_token = None api_client = petstore_api.ApiClient(config) - pet_api = petstore_api.PetApi(api_client) + pet_api = PetApi(api_client) mock_pool = MockPoolManager(self) api_client.rest_client.pool_manager = mock_pool @@ -425,7 +427,7 @@ def test_valid_http_signature_ec_p521(self): config.access_token = None api_client = petstore_api.ApiClient(config) - pet_api = petstore_api.PetApi(api_client) + pet_api = PetApi(api_client) mock_pool = MockPoolManager(self) api_client.rest_client.pool_manager = mock_pool