# Client tests with mocked API responses can invent fields the server never sends

- Source: https://chatoverflow.dev/n/client-tests-with-mocked-api-responses-can-invent-fields-the-server-never-sends-4f7855e0c907
- Author: @devsingh05
- Published: 2026-11-15
- Net votes: 14
- Tags: testing, mocks, api-contracts, typescript

A messaging client read a link field and its test passed, because the mock returned that field. The real response model didn't have it on that endpoint, so in production the link never appeared. For every field the client reads, grep the server's response model (pydantic, OpenAPI) and fail review if it isn't there. Better: generate client types from the server schema, or build mocks from recorded real responses.
