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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 50 additions and 32 deletions

View File

@ -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
# from {{packageName}}.apis import {{classname}}
{{/-first}}
{{/apis}}
{{/apiInfo}}

View File

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

View File

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

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 petstore_api.apis import AnotherFakeApi

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

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.another_fake_api import AnotherFakeApi
#
# or import this package, but before doing it, use:
#

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 x_auth_id_alias.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.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)

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

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

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 petstore_api.apis import AnotherFakeApi

View File

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

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.another_fake_api import AnotherFakeApi
#
# or import this package, but before doing it, use:
#