INNER CODE UNIT · Python

merge_router_tags

CaddyGlow/ccproxy-api · ccproxy/api/app.py:44

def merge_router_tags(
    router: APIRouter,
    spec_tags: list[str] | None = None,
    default_tags: list[str] | None = None,
) -> list[str | Enum] | None:
    """Merge router tags with spec tags, removing duplicates while preserving order.

    Args:
        router: FastAPI router instance
        spec_tags: Tags from route specification
        default_tags: Fallback tags if no other tags exist

    Returns:
        Deduplicated list of tags, or None if no tags
    """
    router_tags: list[str | Enum] = list(router.tags) if router.tags else []
    spec_tags_list: list[str | Enum] = list(spec_tags) if spec_tags else []
    default_tags_list: list[str | Enum] = list(default_tags) if default_tags else []

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…