Story #05 Schema Compatibility · Nullability

The Optional Field That Wasn't Optional

"The spec said the field was optional. One fraud detection system had a different opinion"

A customer profile API declared middleName as optional and removed empty values to reduce payload size. A legacy fraud detection system assumed the field was always present and crashed whenever it was absent, generating thousands of false positives.

What happened

Meridian Financial Services’ customer profile API documented middleName as optional. During a data cleanup project, the team removed empty string values from API responses to reduce payload size—a reasonable optimization that matched the spec.

What nobody checked was whether every consumer actually honored that optionality. A legacy fraud detection system had been written years earlier with a hard assumption that middleName was always present. When the field disappeared, the system threw a null pointer exception, caught it internally, and classified the transaction as suspicious. Thousands of legitimate customers were flagged as potential fraud.

The issue wasn’t discovered for days. By then, the fraud team had manually reviewed thousands of false positives, support queues were backed up, and several large transactions had been incorrectly blocked.

Root cause

The API spec said “optional.” The consumer treated it as required. No contract test existed that would have shown this mismatch. The API team tested the new trimmed responses; the consumer team never tested against responses missing the field.

The fix

The API team added a contract test suite for all major consumers, explicitly testing responses with and without optional fields. The fraud system was fixed to handle absent fields gracefully. Missing optional fields were added to the standard API testing checklist.

Lesson learned

“Optional” in a spec means nothing if consumers never see a response without it. Contract tests must exercise the full range of valid responses—including the absence of every optional field.

The Optional Field That Wasn't Optional