Required vs Nullable

https://docs.pydantic.dev/2.0/blog/pydantic-v2/#required-vs-nullable-cleanup

from pydantic import BaseModel


class Foo(BaseModel):
    f1: str  # required, cannot be None
    f2: str | None  # required, can be None - same as Optional[str] / Union[str, None]
    f3: str | None = None  # not required, can be None
    f4: str = 'Foobar'  # not required, but cannot be None