File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed
fastapi_router_controller/lib Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change 11from fastapi import APIRouter
22
33OPEN_API_TAGS = []
4- __app_classes__ = []
4+ __app_controllers__ = []
55__router_params__ = [
66 'response_model' ,
77 'status_code' ,
@@ -67,7 +67,7 @@ def wrapper(cls):
6767 self .__get_parent_routes (cls .__router__ )
6868
6969 cls .__router__ = self .router
70- cls .router = lambda _ : Controller .__parse_controller_router (cls )
70+ cls .router = lambda it_self : Controller .__parse_controller_router (it_self )
7171 return cls
7272
7373 return wrapper
@@ -77,7 +77,7 @@ def use(_):
7777 A decorator function to mark a Class to be automatically loaded by the Controller
7878 '''
7979 def wrapper (cls ):
80- __app_classes__ .append (cls )
80+ __app_controllers__ .append (cls () )
8181 return cls
8282
8383 return wrapper
@@ -101,10 +101,9 @@ def routers():
101101 '''
102102 routers = []
103103
104- for app_class in __app_classes__ :
105- controller = app_class ()
104+ for app_controller in __app_controllers__ :
106105 routers .append (
107- controller .router ()
106+ app_controller .router ()
108107 )
109108
110109 return routers
You can’t perform that action at this time.
0 commit comments