Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upUpdate docs with parameters that default to None to use Optional #1561
Labels
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment


First check
Example
Here's a self-contained minimal, reproducible, example with my use case:
Description
qcan beNoneand thatq.lower()could raise an error.The solution you would like
I would like the examples in the docs to use
Optional:By using
Optionalthe editor would be able to warn thatq.lower()could raise an error ifqisNone.Describe alternatives you've considered
To leave it as is.
Environment
To know the FastAPI version use:
python -c "import fastapi; print(fastapi.__version__)"To know the Python version use:
Additional context
I was waiting to first introduce🎉
Optionalin the docs, but it was done in #1377The new docs are here: https://fastapi.tiangolo.com/python-types/#optional
Now it's a good moment to update all the examples that have a default of
Nonein all the docs to also useOptional.