Response model: API safety and clarity
Suppose you have a User model with 20 fields including hashed_password. When someone requests a profile, you only need username and bio. Instead of manually scrubbing a dict before return, you tell FastAPI: use this reduced schema for the response. FastAPI filters out the rest even if your function returned a full object with secrets.