-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
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.
- After submitting this, I commit to one of:
- Read open issues with questions until I find 2 issues where I can help someone and add a comment to help there.
- I already hit the "watch" button in this repository to receive notifications and I commit to help at least 2 people that ask questions in the future.
- Implement a Pull Request for a confirmed bug.
Go to /8000/docs and make a post request
Environment
- OS: [macOS]:
- FastAPI Version [e.g. 0.3.0]:
To know the FastAPI version use:
0.63.0- Python version:
3.9.4
Additional context
Hello everyone I'm getting a 422 error from using the OpenAPI docs and here's my models and my function header
class ImageProperty(BaseModel):
text: str = Field(..., max_length=256)
characteristics: str = Field(..., max_length=256)
permissions: Optional[PermissionsEnum] = Field(PermissionsEnum.public)
class ImagesProperty(BaseModel):
images: List[ImageProperty]
@router.post("/add/")
async def add_images(api_key: str, images_property: ImagesProperty, images_upload: List[UploadFile] = File(...)):When I put the information into the interactive docs this is the curl request
curl -X 'POST' \
'http://127.0.0.1:8000/add/?api_key=stringstring' \
-H 'accept: application/json' \
-H 'Content-Type: multipart/form-data' \
-F 'images_property={
"images":[
{
"text":"asdas",
"characteristics":"asdfsd",
"permissions":"public"
}
]
}' \
-F 'images_upload=@Screen Shot 2021-04-27 at 6.15.26 PM.png;type=image/png'
This is the response for the 422
{
"detail": [
{
"loc": [
"body",
"images_property"
],
"msg": "value is not a valid dict",
"type": "type_error.dict"
}
]
}