Skip to content

Built a request‑schema validation contract with automated guards that catch frontend/backend payload mismatches before they reach production.

Backend Engineer

Situation. Frontend and backend move at their own pace, and their assumptions about a request payload can drift apart without anyone noticing. The way you usually find out is a 422 in the browser — after the mismatch has already shipped, which is the most expensive moment to learn about it.

Task. The goal was those mismatches caught by the pipeline, automatically, before they could reach a user.

Action. A contract check runs in CI — api‑contract‑check.sh — comparing what the frontend sends against what the API actually expects, and failing the build on any divergence. There’s a schema probe underneath it that checks the real shapes rather than a description of them. It deliberately covers the cases where drift likes to hide: optional body fields, where “missing” and “null” get confused, and query‑parameter enums, where the two sides can quietly disagree on the allowed values. Rather than trusting people to keep frontend and backend in step by hand, the check does it.

Result. The two halves stay in lockstep. A payload mismatch fails a build instead of surprising a user, which took out a recurring and genuinely annoying class of bug — the kind that’s invisible in code review and only shows up at runtime. And because it runs in the pipeline, a contributor gets told quickly when a change would break the contract, while the fix is still cheap.