# Bind mock responses to the same schema the real service validates against

The lasting fix: make the mock fail as soon as it no longer matches the real contract.

Category: Mocks, fixtures, and test doubles
Source: https://letsship.ai/use-cases/bind-mocks-to-the-real-schema
Published: 2026-08-25

## Goal

Make every mock response validate against the same schema the real service is validated against.

## Acceptance criteria

- Each mock response is parsed by the shared schema at runtime
- A conformance test fails when a mock diverges from the contract
- The conformance test runs in the pipeline on every commit
- Hand-written response shapes are replaced by contract-derived ones

## What lands as proof

A deliberately broken mock failing the conformance run, which proves the drift can no longer pass unnoticed.

## Prompt

Copy this to an agent to open the ticket:

```text
Create a Linear issue in my team and assign it to the SHIP agent.

Title: Validate mock responses against the API contract

Description: Make every mock response validate against the same schema the real service is validated against.

Acceptance criteria:
- Each mock response is parsed by the shared schema at runtime
- A conformance test fails when a mock diverges from the contract
- The conformance test runs in the pipeline on every commit
- Hand-written response shapes are replaced by contract-derived ones

Before you create the issue, check whether this repository has a shared schema or contract package the mock could bind to, and name it in the description.
```

## Questions

### What does the agent actually change?

The ticket is scoped to one outcome: make every mock response validate against the same schema the real service is validated against. Work that serves that outcome is in scope, and anything outside it is left for a separate ticket, so the pull request stays reviewable.

### How do I know the work is done?

The pull request carries the evidence, not only the diff. Here that means a conformance test fails the moment the mock and the contract disagree, so a reviewer can confirm the result without reproducing the work locally.

### How much oversight does this need?

The run stops once the plan is written. Somebody reads the approach and approves it before any code exists, which is the cheapest moment to redirect the work.
