15 Modifying an API
This chapter covers
- Designing backward-compatible modifications
- Balancing the value and effects of breaking changes
- Versioning an API
- Creating an extensible design
- Describing modifications with OpenAPI
The Shopping company would like to enhance its API with support for multiple categories. Toward this end, it considers replacing the product’s category (string) with a categories array. However, that would require modifying all consuming applications’ code to use the categories array instead of the category property. A non-updated application’s code will break because the category property it expects to find isn’t there. Although updating internal applications is not a problem, asking all partners to modify their applications is more complicated. Now, imagine that such a design modification is made without anyone being informed; all the consuming applications would suddenly stop functioning. That could cost a lot of money and affect the Shopping company’s reputation.