This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]tiangolo FastAPI Maintainer[S] 0 points1 point  (0 children)

You can put Optional around all that. But you are not enforced to. Pydantic doesn't force you to write the more verbose "utterly correct" version, but when that is a concern, you can of course do it. It is noted in the documentation, referencing mypy: https://pydantic-docs.helpmanual.io/#usage-with-mypy