def _allocate_routes_by_method_name( router: APIRouter, url: str, function_members: List[Tuple[str, Any]]) -> None: existing_routes_endpoints: List[Tuple[Any, str]] = [ (route.endpoint, route.path) for route in router.routes if isinstance(route, APIRoute) ] for name, func in function_members: if hasattr(router, name ) and not name.startswith("__") and not name.endswith("__"): if (func, url) not in existing_routes_endpoints: response_model = None responses = None kwargs = {} status_code = 200 return_types_func = getattr(func, RETURN_TYPES_FUNC_KEY, None) if return_types_func: response_model, status_code, responses, kwargs = return_types_func( ) api_resource = router.api_route( url, methods=[name.capitalize()], response_model=response_model, status_code=status_code, responses=responses, **kwargs, ) api_resource(func)