By Orch8 Engineering · Editorial policy
Keep API Schema Changes From Breaking Workflows
Validate vendor responses at a shared boundary and hand workflows a stable internal data shape. Test new and old response variants, unknown fields, missing values, and empty results before changing the adapter used by production workflows.
What is the practical answer?
Validate vendor responses at a shared boundary and hand workflows a stable internal data shape. Test new and old response variants, unknown fields, missing values, and empty results before changing the adapter used by production workflows. Suppose a billing endpoint changes customer.email to customer.contact.email. Fourteen independent expressions can each fail differently: some produce an empty string, some route to the wrong branch, and some throw a hard error. Put the translation in one adapter that accepts the supported variants and returns a named internal schema. Distinguish cases the adapter must handle. A missing email, explicit null, and an empty string may imply different business actions. Unknown response fields can be harmless in an additive API change, while a changed type on a field used for decisions requires a clear failure. Keep version or capability metadata on responses where the upstream API provides it.
Evidence: JSON Schema constraints and validation · Reddit discussion of recurring production mistakes
- Receive vendor responseInput
- Normalize supported variantsProcess
- Validate the internal contractDecision
- Release safe downstream inputExternal action
Use a stable internal representation#
| What you find | What to do |
|---|---|
| Unknown additive field arrives | accept it only if your schema contract allows it. |
| Required field is missing or incompatible | stop before the business write. |
| Two supported provider versions return different shapes | normalize both to the same internal response. |
Roll out the adapter with representative fixtures#
Capture redacted responses for successful, empty, paginated, and provider-error cases. Validate the response structurally first and then check invariants specific to the workflow. Compare old and new adapter outputs in a shadow run that cannot write externally. Pin the adapter version or keep a compatibility period until consumers can migrate safely.
Use consumer fixtures to define compatibility#
Write fixtures that capture the fields the workflow actually consumes. A vendor might return a new nested property without breaking consumers, while returning a string where a number used to appear can change routing. Put sample data and expected internal fields together so reviewers see the behavior independently of the vendor’s raw JSON shape.
Run two adapter versions against the fixtures and record differences. For an additive rollout, allow both supported inputs until each downstream consumer has migrated. If a previously optional value becomes critical, decide whether missing values should block the workflow or route to a named fallback. Record the adapter version on failed runs so an operator can reproduce historical behavior.
Verify it with a failure drill#
Replay fixture responses with the old location, new location, explicit null, and a numeric value in the email field.
- Verify supported shapes normalize to the same contract, while invalid or absent values reach the intended review or failure path before a downstream write.
Sources and further reading
Official references support technical claims; community discussions are used only as problem signals.