remove hardcoded PetApi (#7483)

This commit is contained in:
William Cheng
2020-09-23 02:45:29 +08:00
committed by GitHub
parent 04b39cc86b
commit 8c78f13a41
15 changed files with 50 additions and 32 deletions

View File

@@ -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
# from dynamic_servers.apis import UsageApi

View File

@@ -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)

View File

@@ -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:
#