spakky-fastapi 2.0.0__py3-none-any.whl → 2.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- spakky_fastapi/post_processors/register_routes.py +9 -13
- {spakky_fastapi-2.0.0.dist-info → spakky_fastapi-2.0.1.dist-info}/METADATA +1 -1
- {spakky_fastapi-2.0.0.dist-info → spakky_fastapi-2.0.1.dist-info}/RECORD +5 -5
- {spakky_fastapi-2.0.0.dist-info → spakky_fastapi-2.0.1.dist-info}/WHEEL +0 -0
- {spakky_fastapi-2.0.0.dist-info → spakky_fastapi-2.0.1.dist-info}/entry_points.txt +0 -0
@@ -9,11 +9,9 @@ from fastapi.exceptions import FastAPIError
|
|
9
9
|
from fastapi.utils import create_model_field # type: ignore
|
10
10
|
from spakky.pod.annotations.order import Order
|
11
11
|
from spakky.pod.annotations.pod import Pod
|
12
|
-
from spakky.pod.interfaces.
|
13
|
-
from spakky.pod.interfaces.aware.application_context_aware import (
|
14
|
-
IApplicationContextAware,
|
15
|
-
)
|
12
|
+
from spakky.pod.interfaces.aware.container_aware import IContainerAware
|
16
13
|
from spakky.pod.interfaces.aware.logger_aware import ILoggerAware
|
14
|
+
from spakky.pod.interfaces.container import IContainer
|
17
15
|
from spakky.pod.interfaces.post_processor import IPostProcessor
|
18
16
|
|
19
17
|
from spakky_fastapi.routes.route import Route
|
@@ -23,23 +21,21 @@ from spakky_fastapi.stereotypes.api_controller import ApiController
|
|
23
21
|
|
24
22
|
@Order(0)
|
25
23
|
@Pod()
|
26
|
-
class RegisterRoutesPostProcessor(
|
27
|
-
IPostProcessor, ILoggerAware, IApplicationContextAware
|
28
|
-
):
|
24
|
+
class RegisterRoutesPostProcessor(IPostProcessor, ILoggerAware, IContainerAware):
|
29
25
|
__logger: Logger
|
30
|
-
|
26
|
+
__container: IContainer
|
31
27
|
|
32
28
|
def set_logger(self, logger: Logger) -> None:
|
33
29
|
self.__logger = logger
|
34
30
|
|
35
|
-
def
|
36
|
-
self.
|
31
|
+
def set_container(self, container: IContainer) -> None:
|
32
|
+
self.__container = container
|
37
33
|
|
38
34
|
def post_process(self, pod: object) -> object:
|
39
35
|
if not ApiController.exists(pod):
|
40
36
|
return pod
|
41
37
|
|
42
|
-
fast_api = self.
|
38
|
+
fast_api = self.__container.get(FastAPI)
|
43
39
|
controller = ApiController.get(pod)
|
44
40
|
router: APIRouter = APIRouter(prefix=controller.prefix, tags=controller.tags)
|
45
41
|
for name, method in getmembers(pod, callable):
|
@@ -71,7 +67,7 @@ class RegisterRoutesPostProcessor(
|
|
71
67
|
*args: Any,
|
72
68
|
method_name: str = name,
|
73
69
|
controller_type: type[object] = controller.type_,
|
74
|
-
context:
|
70
|
+
context: IContainer = self.__container,
|
75
71
|
**kwargs: Any,
|
76
72
|
) -> Any:
|
77
73
|
controller_instance = context.get(controller_type)
|
@@ -94,7 +90,7 @@ class RegisterRoutesPostProcessor(
|
|
94
90
|
*args: Any,
|
95
91
|
method_name: str = name,
|
96
92
|
controller_type: type[object] = controller.type_,
|
97
|
-
context:
|
93
|
+
context: IContainer = self.__container,
|
98
94
|
**kwargs: Any,
|
99
95
|
) -> Any:
|
100
96
|
controller_instance = context.get(controller_type)
|
@@ -6,7 +6,7 @@ spakky_fastapi/middlewares/error_handling.py,sha256=KXMivDNY8ly87GcTyvCTuIsOSzMa
|
|
6
6
|
spakky_fastapi/middlewares/manage_context.py,sha256=K9jFih1uU3LQzwLbj8kpLgPPln_KKM0D02qv7tzea-E,901
|
7
7
|
spakky_fastapi/post_processors/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
8
8
|
spakky_fastapi/post_processors/add_builtin_middlewares.py,sha256=ePyVYV5CssbRIGxakS85RvsGmHr8LVMFkcu-_QttSCc,1185
|
9
|
-
spakky_fastapi/post_processors/register_routes.py,sha256=
|
9
|
+
spakky_fastapi/post_processors/register_routes.py,sha256=dtJ6zmNdEmXPkfqf003P7toMQTBkIwvKZ4270sRec0I,4503
|
10
10
|
spakky_fastapi/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
11
11
|
spakky_fastapi/routes/__init__.py,sha256=ZYkuBMCeCeIwe2Oym8oL6CpzM1kWdjpXyqerFzT-ACQ,360
|
12
12
|
spakky_fastapi/routes/delete.py,sha256=Mu-newjej3_SAPaWEuwbPkRc7lS9WuUgGY4PuiUSVD8,2428
|
@@ -20,7 +20,7 @@ spakky_fastapi/routes/route.py,sha256=LhUOq9wZJjHc8C0A59BrraipBsb_5gX_WDI6wkcUO9
|
|
20
20
|
spakky_fastapi/routes/websocket.py,sha256=UA9qVduqAbGyToOUo4giPhdy9lKWJkHhrNF9LnKMRgU,703
|
21
21
|
spakky_fastapi/stereotypes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
22
22
|
spakky_fastapi/stereotypes/api_controller.py,sha256=gnUVdQnK2miMMwBgQ88bbMajMAvmBwjwS3semtLBkBY,222
|
23
|
-
spakky_fastapi-2.0.
|
24
|
-
spakky_fastapi-2.0.
|
25
|
-
spakky_fastapi-2.0.
|
26
|
-
spakky_fastapi-2.0.
|
23
|
+
spakky_fastapi-2.0.1.dist-info/METADATA,sha256=Fv5iezr-kTO2NSeYuKThxWd4kZSRIWod_ZsWF3WaBZ8,1850
|
24
|
+
spakky_fastapi-2.0.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
25
|
+
spakky_fastapi-2.0.1.dist-info/entry_points.txt,sha256=m_VotPZLovg4sBMBm_XK5ateHrUizil9dQ11-2v-ZMw,57
|
26
|
+
spakky_fastapi-2.0.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|