DEV Community

Abhay kumar
Abhay kumar

Posted on

A passing 200 OK doesn't mean your API didn't break

Here's a bug that ships to production constantly, with every test green:

The backend renames one field.

Before:
{ "subscription": "Premium" }

After:
{ "plan": "Premium" }

✅ Endpoint returns 200
✅ Unit tests pass
✅ Build is green
❌ The mobile app reads response.subscription → undefined → crash

Functional tests check that a response came back. They don't check its
shape. That gap is exactly what contract testing closes — it verifies the
response still matches what consumers expect (fields, types, structure).

A few rules that prevent most of these incidents:
• Never rename or remove a field without versioning
• number → string is a breaking change, even if your language coerces it
• Add new fields; don't replace old ones
• Run schema checks in CI, not just on your laptop

I wrote a full breakdown — contract vs integration testing, consumer-driven
contracts, the 5 most common breakages, and how to catch drift automatically:

👉 https://www.orbittest.dev/blog/contract-testing-explained

How does your team catch breaking API changes today? Curious what's working.

Top comments (0)