What is a tolerant reader?
The Tolerant Reader pattern is an integration design approach. In this pattern, a client that consumes data handles changes gracefully, such as added fields or minor structure modifications. This pattern promotes forward compatibility and reduces the need for immediate updates whenever the data or service evolves.
Real-world scenario
Consider a request to
GET /organizations/{organization_id}. Initially, the response might be:
doingBusinessAs and address may be added:
Implementing a tolerant reader
Below is an example Python code snippet that processes additional fields gracefully.
get methods safely access values. This allows for flexibility when new fields appear, such as phoneNumber. The code remains functional even if a field is absent.
