Код: Выделить всё
from fastapi import APIRouter, UploadFile, File
from app.models.schemas.files import FileInResponse
router = APIRouter()
@router.post("", name="files:create-file", response_model=FileInResponse)
async def create(file: UploadFile = File(...)) -> FileInResponse:
pass
< /code>
Как вы можете видеть, я использую специальную модель Pydantic для результата методаFileInResponse
Код: Выделить всё
from pathlib import Path
from pydantic import BaseModel
class FileInResponse(BaseModel):
path: Path
Подробнее здесь: https://stackoverflow.com/questions/707 ... by-fastapi