Implement Deprecation Warning System and Router Registry Cleanup
- Added DeprecationParams dependency to log warnings when legacy routes are accessed. - Updated setup_routers to apply deprecation warnings to non-V3 legacy endpoints. - Exempted core infrastructure, special routers, and routers currently in use from deprecation warnings. - Cleaned up 24 unused router imports from the registry.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from fastapi import Depends, Header, HTTPException, Query, Response, status
|
||||
from fastapi import Depends, Header, HTTPException, Query, Request, Response, status
|
||||
from typing import Optional, Union
|
||||
import logging
|
||||
import asyncio
|
||||
@@ -7,6 +7,13 @@ from app.models.auth_models import AccountContext
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
# --- Deprecation Dependency ---
|
||||
|
||||
class DeprecationParams:
|
||||
"""Logs a warning when a legacy/deprecated route is accessed."""
|
||||
def __init__(self, request: Request):
|
||||
log.warning(f"!!! DEPRECATED ROUTE ACCESSED: [{request.method}] {request.url.path} from {request.client.host if request.client else 'Unknown'}")
|
||||
|
||||
# --- Account Context Dependencies ---
|
||||
|
||||
def get_account_context_optional(
|
||||
|
||||
Reference in New Issue
Block a user