Adapters and connectors that map upstream payloads.
Schema changes cause parsing failures or incorrect mapping. This playbook emphasizes tolerant parsing, version pinning, and adapter-side mapping updates.
- Parsing errors or missing required fields
- Contract test failures
- Capture failing payload samples.
- Compare with expected schema and mapping.
- Identify version or field changes upstream.
- Check whether the change is additive within the current major or requires a major schema bump.
- Add tolerant parsing for optional fields.
- Apply mapping hotfix in adapter layer.
- Pin upstream API version if available.
- Preserve canonical envelope compatibility by keeping additive changes within the same major version.
- Treat missing canonical
schema_versionas implicit1.0only during controlled migration windows.
- Add contract tests and schema validation.
- Monitor upstream change logs.
- Run
python scripts/ops/check_event_schema_contracts.pybefore merge for canonical retail and connector envelope changes.
- Capture sample payloads in logs for failures.
- Update mapping to handle optional/renamed fields.
- Add or update
schema_versioncontract tests for explicit-write and legacy-read coverage. - Bump the canonical major version before introducing breaking envelope changes.
from pydantic import BaseModel, ConfigDict
class ProductPayload(BaseModel):
model_config = ConfigDict(extra="ignore")
sku: str
name: str
price: float | None = Nonedef map_product(payload: dict) -> dict:
return {
"sku": payload.get("sku") or payload.get("id"),
"name": payload.get("name") or payload.get("title"),
"price": payload.get("price") or payload.get("unit_price"),
}flowchart TD
A[Schema error detected] --> B[Capture payload sample]
B --> C[Update mapping + parser]
C --> D[Add contract test]
D --> E[Monitor upstream changes]
Notify integration owner with sample payload and impact.