Skip to content

Commit 7b2557f

Browse files
committed
Set RoutersJSONAPI class on AtomicViewHandler
1 parent f456dbc commit 7b2557f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

fastapi_jsonapi/atomic/atomic_handler.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
Callable,
1212
List,
1313
Optional,
14+
Type,
1415
TypedDict,
1516
Union,
1617
)
@@ -64,6 +65,8 @@ async def wrapper(*a, operation: OperationBase, **kw):
6465

6566

6667
class AtomicViewHandler:
68+
jsonapi_routers_cls: Type[RoutersJSONAPI] = RoutersJSONAPI
69+
6770
def __init__(
6871
self,
6972
request: Request,
@@ -82,10 +85,10 @@ async def prepare_one_operation(self, operation: AtomicOperation):
8285
"""
8386
operation_type = operation.ref and operation.ref.type or operation.data and operation.data.type
8487
assert operation_type
85-
if operation_type not in RoutersJSONAPI.all_jsonapi_routers:
88+
if operation_type not in self.jsonapi_routers_cls.all_jsonapi_routers:
8689
msg = f"Unknown resource type {operation_type!r}. Register it via RoutersJSONAPI"
8790
raise ValueError(msg)
88-
jsonapi = RoutersJSONAPI.all_jsonapi_routers[operation_type]
91+
jsonapi = self.jsonapi_routers_cls.all_jsonapi_routers[operation_type]
8992

9093
one_operation = OperationBase.prepare(
9194
action=operation.op,

0 commit comments

Comments
 (0)