It inspects function signatures at startup: parameter types decide conversion and validation, whether a parameter is path, query or body, and what appears in the OpenAPI schema; defaults and Optional types decide whether a parameter is required.
Annotated adds metadata (Query, Path, Header, Depends) cleanly, and return annotations can serve as response models.
Type hints give editor autocomplete and make errors visible early, but note that plain Python itself does not enforce them at runtime; FastAPI and Pydantic do.
Loading…