Contract testing a nutrition API with millions of messy records

A schema can remain valid while every client still breaks. Changing search from a JSON array to {"results": [...]}, converting null to zero, or renaming carbs_g is enough to break a mobile release that cannot update immediately.

Freeze the consumer-visible shape

An OpenAPI document is necessary, but a small executable fixture catches accidental differences between the document and the running service. Store one representative response and assert keys, types and nullability.

EXPECTED_KEYS = {