prefer-schema-for-api-payload
Require Zod (or similar) schema validation on response.json() / JSON.parse() results before property access.
Why
External JSON is untrusted at runtime even when its expected TypeScript shape is known statically.
Fix
For external payloads, parse through a schema or establish runtime validation before reading fields. Review validator implementations separately rather than recursively requiring another schema.
Examples
async function load(response: Response) { const body = await response.json(); return body.id;}async function load(response: Response) { const body = UserSchema.parse(await response.json()); return body.id;}