-
Notifications
You must be signed in to change notification settings - Fork 452
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🥅 Allow fetching historic snapshots with bad
json0
paths
`json0` recently merged a [breaking change][1] which enforces some stricter type checking. Apart from this stricter type checking, no other changes were made, so any client that only ever submits well-formed ops should be able to upgrade directly without any trouble. However, if clients submitted some bad ops (that are no longer allowed under the stricter checking), then `fetchSnapshot()` will fail when trying to apply these ops to rebuild the snapshot. This failure can be surprising if the only "bad" thing about the ops was that they had [bad path types][2], because at the time when they were submitted, the snapshot would have been correctly updated. This change rescues from this particular failure by coercing paths into the correct type: `number` for arrays, and `string` for objects. Note that we use the exact same check for arrays and objects as `json0` to ensure consistency. Also note that we don't attempt to rescue new ops being submitted, because these should correctly be rejected. [1]: ottypes/json0#40 [2]: ottypes/json0#37
- Loading branch information
1 parent
e982eb6
commit 53a2238
Showing
4 changed files
with
86 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters