-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
Closed
Labels
Description
First Check
- I added a very descriptive title to this issue.
- I used the GitHub search to find a similar issue and didn't find it.
- I searched the FastAPI documentation, with the integrated search.
- I already searched in Google "How to X in FastAPI" and didn't find any information.
- I already read and followed all the tutorial in the docs and didn't find an answer.
- I already checked if it is not related to FastAPI but to Pydantic.
- I already checked if it is not related to FastAPI but to Swagger UI.
- I already checked if it is not related to FastAPI but to ReDoc.
Commit to Help
- I commit to help with one of those options 👆
Example Code
@menu.post("/add-menu")
async def addmenu(
ItemName: str = Form(...),
ItemShortDesc: str = Form(...),
ItemPrice: str = Form(...),
ItemCategory: list = Form(...),
ItemStatus: str = Form(...),
ItemChoices: list[dict[str,str]] = Form(...)):
return ItemChoicesDescription
POST Method using FastAPI Request Form
Request Body | application/x-www-form-urlencoded
I am trying to do,
- "list" of "dict" using request form - error Code:422
- Only "dict" using request form - error Code:422
- without "dict" - Its Worked
I got the below error, error Code:422
"detail": [
{
"loc": [
"body",
"ItemChoices",
0
],
"msg": "value is not a valid dict",
"type": "type_error.dict"
}
]
}
How can I use "dict" or "list" of "dict" in FastAPI request form? Please help me out of any possible chance.
Operating System
Linux
Operating System Details
No response
FastAPI Version
0.73.0
Python Version
python3.9
Additional Context
Reactions are currently unavailable
