fastapi
fastapi copied to clipboard
Added the ability to transfer Pydantic model to FormData
Fixed error 422 when creating Pydantic model from FormData. Example temporal workaround on StackOverflow
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Comparison is base (
e77ea63
) 100.00% compared to head (e6ec56d
) 100.00%. Report is 2321 commits behind head on master.
Additional details and impacted files
@@ Coverage Diff @@
## master #2139 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 239 240 +1
Lines 7079 7104 +25
=========================================
+ Hits 7079 7104 +25
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
📝 Docs preview for commit e6ec56d2c992c4dd47de943af588cd60f9877cd6 at: https://5f7cddf0dd4b3c014cae6e71--fastapi.netlify.app
Hey, I'd be interest to have this merged, is there anything blocking this to be merged ? Thank you !
I tried
from fastapi import FastAPI, Form, Depends, UploadFile
from pydantic import BaseModel
app = FastAPI()
class SimpleModel(BaseModel):
no: int = Form(...)
nm: str = Form(...)
f: UploadFile = Form(...)
@app.post("/form")
async def form_post(form_data: SimpleModel = Depends()):
fp = await form_data.f.read()
print(fp)
It works with current (0.86) version. Is this PR still needed?