API Design · Middle · Question 29 of 75
How can you evolve a field's format without a new major version?
- 1Change the format in place and notify clients afterwards
- 2Return both formats randomly
- ✓Correct answer: Add a new field with the new format, keep the old one, mark it deprecated, and remove it only after clients migrate
Explanation
Expand and contract works for APIs as for databases. Track usage of the deprecated field before removal.