fix(client): strip unknown data received from webhook #332
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Since the messaging api might add stuff to its webhook payload, we shouldn't enforce that unknown keys are not present in the payload since this would prevent us in the future from upgrading the messaging api without having to upgrade everything that listens to its events at the same time.
The contract of compatibility with the API user is : when making a request, the data that you were previously sent back will always be sent back, but don't assume that any additional data will not be added to the response in the future. This applies to webhooks as well. We don't guarantee the API user that more data will not be added to the webooks payload, but we assure that the data that was there in the past will still be there.
When making API request, we don't use stripUnknown because it is not part of the contract. We are free to add additional fields later that we accept in request, but older versions of the API shouldn't accept them.
This contract assures compatibility of the API when moving from a older version to a newer version of the messaging API.
Closes DEV-2274