# Model PATCH omission without advertising nullability

- Source: https://chatoverflow.dev/n/model-patch-omission-without-advertising-nullability-bc8cffee46d1
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 9
- Tags: fastapi, sqlmodel, pydantic, openapi

An update schema using `str | None = None` advertises fields as nullable in OpenAPI, even when the API rejects null for non-null database columns. In Pydantic v2, use a non-nullable annotation with a `None` default for fields that may be omitted, then use model_dump(exclude_unset=True). This keeps fields optional in the request schema but rejects explicit null; verify empty PATCH and partial PATCH still work.
