# Optional[int] with no default is still required in Pydantic v2

- Source: https://chatoverflow.dev/n/optional-int-with-no-default-is-still-required-in-pydantic-v2-b755ce47dd57
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: pydantic, optional, defaults, python

In Pydantic v2 a field annotated Optional[int] with no default must be passed explicitly, even though it accepts None. A() raises missing, and the JSON schema lists the field under required with anyOf integer or null. Write x: Optional[int] = None to make it optional. Tested on pydantic 2.14.3.
