INNER CODE UNIT · Python

_verify_fastapi_compatibility

JasperSui/fastapi-injectable · src/fastapi_injectable/main.py:37

def _verify_fastapi_compatibility(solve: Callable[..., Any]) -> None:
    """Fail fast if FastAPI's private dependency-resolution API has drifted.

    Introspects ``solve_dependencies`` and raises ``FastAPICompatibilityError``
    (naming the installed FastAPI version and the supported range) when an
    expected keyword parameter is missing.

    Args:
        solve: FastAPI's ``solve_dependencies`` callable (injected for testing).
    """
    try:
        params = inspect.signature(solve).parameters
    except (ValueError, TypeError):  # pragma: no cover - builtins expose no signature
        return

    missing = [name for name in _REQUIRED_SOLVE_DEPENDENCIES_PARAMS if name not in params]
    if not missing:
        return

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…