ASP.NET Core Web API Interview Question #194
How should backward-compatible API changes be deployed?
Senior API Design, Architecture, Scalability & Production Scenarios Senior Advanced
Quick Interview Answer
Prefer additive changes when they do not alter existing semantics. For incompatible changes, introduce a new contract or version and keep the older contract available during a documented migration period.
Detailed Explanation
Prefer additive changes when they do not alter existing semantics. For incompatible changes, introduce a new contract or version and keep the older contract available during a documented migration period.
Database changes should also support mixed application versions during rolling deployment. Contract tests and OpenAPI comparison can detect accidental breaking changes before release.
Code Example
// Existing:
GET /api/v1/products
// Incompatible redesign:
GET /api/v2/products
// Deploy schema changes using expand-and-contract
// when old and new application versions overlap.