Skip to content

UploadFile doesn't get recognized #231

@bbaabemhp

Description

@bbaabemhp

Hi guys,

I have one FastAPI endpoint with the following details:

from typing import Annotated

from fastapi import APIRouter, Depends, File, HTTPException, UploadFile

@router.post("/upload", tags=["Frontend-related"])
async def upload_tickets( 
    file: Annotated[UploadFile, File(description="Excel file with tickets")],  
    ticket_service: Annotated[TicketServiceFacade, Depends(get_ticket_service_facade)], 
) -> dict: 
    """
    Upload and process tickets from an Excel file.

    Parameters
    ----------
    file : Annotated[UploadFile, File(description="Excel file with tickets")]
        The uploaded Excel file containing ticket data.
    ticket_service : Annotated[TicketServiceFacade, Depends(get_ticket_service_facade)]
        The ticket service facade instance.

    Returns
    -------
    dict
        Processed ticket data.

    Raises
    ------
    HTTPException
        If required columns are missing from the uploaded file.
    """

But I always get the same error:

18: DOC105: Function `upload_tickets`: Argument names match, but type hints in these args do not match: file

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions