Код: Выделить всё
@router.post("/upload")
async def upload_contents(
an_int: Annotated[int, Form()],
a_string: Annotated[str, Form()],
some_files: Annotated[list[UploadFile], File()]
):
У меня есть пробовал такие вещи, как:
Код: Выделить всё
@router.post("/upload")
async def upload_contents(
an_int: Annotated[int, Form()],
a_string: Annotated[Union[str, None], Form()],
some_files: Annotated[list[UploadFile], File()]
):
Код: Выделить всё
@router.post("/upload")
async def upload_contents(
an_int: Annotated[int, Form()],
a_string: Optional[Annotated[str], Form()]],
some_files: Annotated[list[UploadFile], File()]
):
Подробнее здесь: https://stackoverflow.com/questions/760 ... nal-fields