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 index 1d37d339514..8a9e6b91b95 100644 --- 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 @@ -1,3 +1,9 @@ +{{#apiInfo}} +{{#apis}} +{{#-first}} # 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 apis from one package, import them with -# from {{packageName}.apis import DefaultApi, PetApi \ No newline at end of file +# from {{packageName}}.apis import {{classname}} +{{/-first}} +{{/apis}} +{{/apiInfo}} 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 index da3937f8c54..32d101a97d1 100644 --- 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 @@ -1,3 +1,6 @@ +{{#apiInfo}} +{{#apis}} +{{#-first}} # coding: utf-8 # flake8: noqa @@ -7,7 +10,7 @@ # raise a `RecursionError`. # In order to avoid this, import only the API that you directly need like: # -# from {{packagename}}.api.pet_api import PetApi +# from {{packagename}}.api.{{classVarName}} import {{classname}} # # or import this package, but before doing it, use: # @@ -15,8 +18,7 @@ # sys.setrecursionlimit(n) # Import APIs into API package: -{{#apiInfo}} -{{#apis}} +{{/-first}} from {{apiPackage}}.{{classVarName}} import {{classname}} {{/apis}} {{/apiInfo}} diff --git a/modules/openapi-generator/src/main/resources/python/python-experimental/api_client.mustache b/modules/openapi-generator/src/main/resources/python/python-experimental/api_client.mustache index de4e2d478e0..fd3d0b8a200 100644 --- a/modules/openapi-generator/src/main/resources/python/python-experimental/api_client.mustache +++ b/modules/openapi-generator/src/main/resources/python/python-experimental/api_client.mustache @@ -750,11 +750,13 @@ class Endpoint(object): def __call__(self, *args, **kwargs): """ This method is invoked when endpoints are called Example: - pet_api = PetApi() - pet_api.add_pet # this is an instance of the class Endpoint - pet_api.add_pet() # this invokes pet_api.add_pet.__call__() +{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}} + api_instance = {{classname}}() + api_instance.{{operationId}} # this is an instance of the class Endpoint + api_instance.{{operationId}}() # this invokes api_instance.{{operationId}}.__call__() which then invokes the callable functions stored in that endpoint at - pet_api.add_pet.callable or self.callable in this class + api_instance.{{operationId}}.callable or self.callable in this class +{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}} """ return self.callable(self, *args, **kwargs) diff --git a/samples/client/petstore/python-experimental/petstore_api/api/__init__.py b/samples/client/petstore/python-experimental/petstore_api/api/__init__.py index 1d37d339514..840e9f0cd90 100644 --- a/samples/client/petstore/python-experimental/petstore_api/api/__init__.py +++ b/samples/client/petstore/python-experimental/petstore_api/api/__init__.py @@ -1,3 +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 apis from one package, import them with -# from {{packageName}.apis import DefaultApi, PetApi \ No newline at end of file +# from petstore_api.apis import AnotherFakeApi diff --git a/samples/client/petstore/python-experimental/petstore_api/api_client.py b/samples/client/petstore/python-experimental/petstore_api/api_client.py index d8d39c50433..11aa326965b 100644 --- a/samples/client/petstore/python-experimental/petstore_api/api_client.py +++ b/samples/client/petstore/python-experimental/petstore_api/api_client.py @@ -729,11 +729,13 @@ class Endpoint(object): def __call__(self, *args, **kwargs): """ This method is invoked when endpoints are called Example: - pet_api = PetApi() - pet_api.add_pet # this is an instance of the class Endpoint - pet_api.add_pet() # this invokes pet_api.add_pet.__call__() + + api_instance = AnotherFakeApi() + api_instance.call_123_test_special_tags # this is an instance of the class Endpoint + api_instance.call_123_test_special_tags() # this invokes api_instance.call_123_test_special_tags.__call__() which then invokes the callable functions stored in that endpoint at - pet_api.add_pet.callable or self.callable in this class + api_instance.call_123_test_special_tags.callable or self.callable in this class + """ return self.callable(self, *args, **kwargs) diff --git a/samples/client/petstore/python-experimental/petstore_api/apis/__init__.py b/samples/client/petstore/python-experimental/petstore_api/apis/__init__.py index 2dda59f02ea..278ce6b70bd 100644 --- a/samples/client/petstore/python-experimental/petstore_api/apis/__init__.py +++ b/samples/client/petstore/python-experimental/petstore_api/apis/__init__.py @@ -7,7 +7,7 @@ # raise a `RecursionError`. # In order to avoid this, import only the API that you directly need like: # -# from .api.pet_api import PetApi +# from .api.another_fake_api import AnotherFakeApi # # or import this package, but before doing it, use: # diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/python-experimental/x_auth_id_alias/api/__init__.py b/samples/openapi3/client/extensions/x-auth-id-alias/python-experimental/x_auth_id_alias/api/__init__.py index 1d37d339514..d5440bc8148 100644 --- a/samples/openapi3/client/extensions/x-auth-id-alias/python-experimental/x_auth_id_alias/api/__init__.py +++ b/samples/openapi3/client/extensions/x-auth-id-alias/python-experimental/x_auth_id_alias/api/__init__.py @@ -1,3 +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 apis from one package, import them with -# from {{packageName}.apis import DefaultApi, PetApi \ No newline at end of file +# from x_auth_id_alias.apis import UsageApi diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/python-experimental/x_auth_id_alias/api_client.py b/samples/openapi3/client/extensions/x-auth-id-alias/python-experimental/x_auth_id_alias/api_client.py index 9f3792c96b7..f99907a757f 100644 --- a/samples/openapi3/client/extensions/x-auth-id-alias/python-experimental/x_auth_id_alias/api_client.py +++ b/samples/openapi3/client/extensions/x-auth-id-alias/python-experimental/x_auth_id_alias/api_client.py @@ -729,11 +729,13 @@ class Endpoint(object): def __call__(self, *args, **kwargs): """ This method is invoked when endpoints are called Example: - pet_api = PetApi() - pet_api.add_pet # this is an instance of the class Endpoint - pet_api.add_pet() # this invokes pet_api.add_pet.__call__() + + api_instance = UsageApi() + api_instance.any_key # this is an instance of the class Endpoint + api_instance.any_key() # this invokes api_instance.any_key.__call__() which then invokes the callable functions stored in that endpoint at - pet_api.add_pet.callable or self.callable in this class + api_instance.any_key.callable or self.callable in this class + """ return self.callable(self, *args, **kwargs) diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/python-experimental/x_auth_id_alias/apis/__init__.py b/samples/openapi3/client/extensions/x-auth-id-alias/python-experimental/x_auth_id_alias/apis/__init__.py index c1333f3c2ad..de191957909 100644 --- a/samples/openapi3/client/extensions/x-auth-id-alias/python-experimental/x_auth_id_alias/apis/__init__.py +++ b/samples/openapi3/client/extensions/x-auth-id-alias/python-experimental/x_auth_id_alias/apis/__init__.py @@ -7,7 +7,7 @@ # raise a `RecursionError`. # In order to avoid this, import only the API that you directly need like: # -# from .api.pet_api import PetApi +# from .api.usage_api import UsageApi # # or import this package, but before doing it, use: # diff --git a/samples/openapi3/client/features/dynamic-servers/python-experimental/dynamic_servers/api/__init__.py b/samples/openapi3/client/features/dynamic-servers/python-experimental/dynamic_servers/api/__init__.py index 1d37d339514..9148df5be49 100644 --- a/samples/openapi3/client/features/dynamic-servers/python-experimental/dynamic_servers/api/__init__.py +++ b/samples/openapi3/client/features/dynamic-servers/python-experimental/dynamic_servers/api/__init__.py @@ -1,3 +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 apis from one package, import them with -# from {{packageName}.apis import DefaultApi, PetApi \ No newline at end of file +# from dynamic_servers.apis import UsageApi diff --git a/samples/openapi3/client/features/dynamic-servers/python-experimental/dynamic_servers/api_client.py b/samples/openapi3/client/features/dynamic-servers/python-experimental/dynamic_servers/api_client.py index c7a8c3070aa..6e7150a6d1a 100644 --- a/samples/openapi3/client/features/dynamic-servers/python-experimental/dynamic_servers/api_client.py +++ b/samples/openapi3/client/features/dynamic-servers/python-experimental/dynamic_servers/api_client.py @@ -729,11 +729,13 @@ class Endpoint(object): def __call__(self, *args, **kwargs): """ This method is invoked when endpoints are called Example: - pet_api = PetApi() - pet_api.add_pet # this is an instance of the class Endpoint - pet_api.add_pet() # this invokes pet_api.add_pet.__call__() + + api_instance = UsageApi() + api_instance.custom_server # this is an instance of the class Endpoint + api_instance.custom_server() # this invokes api_instance.custom_server.__call__() which then invokes the callable functions stored in that endpoint at - pet_api.add_pet.callable or self.callable in this class + api_instance.custom_server.callable or self.callable in this class + """ return self.callable(self, *args, **kwargs) diff --git a/samples/openapi3/client/features/dynamic-servers/python-experimental/dynamic_servers/apis/__init__.py b/samples/openapi3/client/features/dynamic-servers/python-experimental/dynamic_servers/apis/__init__.py index 74230e156de..6bd9b9a956a 100644 --- a/samples/openapi3/client/features/dynamic-servers/python-experimental/dynamic_servers/apis/__init__.py +++ b/samples/openapi3/client/features/dynamic-servers/python-experimental/dynamic_servers/apis/__init__.py @@ -7,7 +7,7 @@ # raise a `RecursionError`. # In order to avoid this, import only the API that you directly need like: # -# from .api.pet_api import PetApi +# from .api.usage_api import UsageApi # # or import this package, but before doing it, use: # diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/api/__init__.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/api/__init__.py index 1d37d339514..840e9f0cd90 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/api/__init__.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/api/__init__.py @@ -1,3 +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 apis from one package, import them with -# from {{packageName}.apis import DefaultApi, PetApi \ No newline at end of file +# from petstore_api.apis import AnotherFakeApi diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/api_client.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/api_client.py index 543569a3afd..ac0fb625b16 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/api_client.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/api_client.py @@ -736,11 +736,13 @@ class Endpoint(object): def __call__(self, *args, **kwargs): """ This method is invoked when endpoints are called Example: - pet_api = PetApi() - pet_api.add_pet # this is an instance of the class Endpoint - pet_api.add_pet() # this invokes pet_api.add_pet.__call__() + + api_instance = AnotherFakeApi() + api_instance.call_123_test_special_tags # this is an instance of the class Endpoint + api_instance.call_123_test_special_tags() # this invokes api_instance.call_123_test_special_tags.__call__() which then invokes the callable functions stored in that endpoint at - pet_api.add_pet.callable or self.callable in this class + api_instance.call_123_test_special_tags.callable or self.callable in this class + """ return self.callable(self, *args, **kwargs) 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 index 27522f8152a..5a98862bba0 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/apis/__init__.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/apis/__init__.py @@ -7,7 +7,7 @@ # raise a `RecursionError`. # In order to avoid this, import only the API that you directly need like: # -# from .api.pet_api import PetApi +# from .api.another_fake_api import AnotherFakeApi # # or import this package, but before doing it, use: #