API Versioning with Document DB
Context
You have a document database, let's say DynamoDB. It has about 10m of person's name data, for example:
The data is accessible through a highly scalable API and being consumed by 100+ other services. Over the course of few years there are some significant changes that require several iterations of the data and API, but all versions have to be maintained due to various legacy clients. The iterations are summarised as follow:
V2: Suffixes are now mandatory
V3: Title is now forbidden
V4: Givenname to change to Firstname
V5: Tony Stark Jr is now the supreme leader of earth, all Stark lastname must be capitalised
Forces
- You only have one Document DB
- All versions must be maintained
Solution
V2: Suffixes are now mandatory
V3: Title is now forbidden
V4: Givenname to change to Firstname
Updating a field is even more complex, but despite maintaining backward compatibility, it is better to maintain the currency of the DB. Maintaining the currency of the DB is important because when we don't know when we can decomission the old versions, it is better to update the DB now, than later when the version is decommisioned
Updating value is probably rare and done on case by case basis but whenever logical, it is generally advisable to maintain the currency of the database. In this scenario, this is best achieved with a versioned new field
Comments
Post a Comment