-
Notifications
You must be signed in to change notification settings - Fork 27
Open
Description
Validation fails when one file is provided in file.
from pydantic import BaseModel
from quart import Quart
from quart_schema import QuartSchema
from quart_schema.pydantic import File
app = Quart(__name__)
app.config["MAX_CONTENT_LENGTH"] = 150 * 1024 * 1024 # 150MB limit for rag file upload
QuartSchema(app)
class SomeOtherArguments(BaseModel):
name: str
class Upload(SomeOtherArguments):
file: list[File] # Work around: `list[File] | File`
@rag_blueprint.post("/upload")
@validate_request(Upload, source=DataSource.FORM_MULTIPART)
async def rag_create(data: Upload):
return {}, 200
Error:
{
"errors": "74956 validation errors for Upload\nfile.0\n Value error, Expected FileStorage, received: <class 'bytes'> ...
}
When the work around list[File] | File is used, the docs no longer handled the filed as a file, but just as a string:

Metadata
Metadata
Assignees
Labels
No labels