-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
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
import fastapi
import httpx
from pydantic import UUID4
app = fastapi.FastAPI()
@app.get("/")
async def get(my_param: UUID4 = fastapi.Query(None, nullable=True)):
return {"my_param": my_param}
async def test_can_get():
async with httpx.AsyncClient(app=app, base_url="http://mytesthost.com") as client:
res = await client.get("/", params={"my_param": None})
assert res.status_code == 200, res.contentDescription
- Run the test and expect it to pass
- The test fails
Error:
{"detail":[{"loc":["query","my_param"],"msg":"value is not a valid uuid","type":"type_error.uuid"}]}
Operating System
macOS
Operating System Details
No response
FastAPI Version
0.74.1
Python Version
3.9.9
Additional Context
No response