from . import FrameworkAdapter from fastapi.responses import JSONResponse from typing import Callable # FastAPIAdapter is a class that implements the FrameworkAdapter interface for FastAPI. class FastAPIAdapter(FrameworkAdapter): def __init__(self, app): self.app = app def register_route(self,path: str, handler: Callable): async def wrapper(): data, status_code = await handler() return JSONResponse(content=data, status_code=status_code) self.app.add_api_route(path, wrapper, methods=["GET"])