Add ability to write JSON Merge Patch JSON from MutableJsonDocument change list#38058
Add ability to write JSON Merge Patch JSON from MutableJsonDocument change list#38058annelo-msft merged 32 commits intoAzure:mainfrom
Conversation
|
API change check API changes are not detected in this pull request. |
heaths
left a comment
There was a problem hiding this comment.
A few thoughts, but overall LGTM. But would it be worth storing changes against elements as a trie (actually, even a tree split on path separators would be good enough) instead of parsing and comparing (effectively) JSON paths each time? I wouldn't hold the PR up for it, but maybe something to consider. A lot of time is spent comparing paths and making sure, as you said in a comment, "a" isn't treated as an ancestor of "abc". That said, I'm not sure it's faster or uses less memory (probably not the latter). I'm only concerned with large JSON documents, though. Maybe, practically, that isn't an issue currently.
sdk/core/Azure.Core/tests/DynamicData/MutableJsonDocumentWriteToTests.cs
Show resolved
Hide resolved
sdk/core/Azure.Core/src/DynamicData/MutableJsonElement.WriteTo.MergePatch.cs
Show resolved
Hide resolved
sdk/core/Azure.Core/src/DynamicData/MutableJsonDocument.ChangeTracker.cs
Show resolved
Hide resolved
sdk/core/Azure.Core/src/DynamicData/MutableJsonDocument.ChangeTracker.cs
Show resolved
Hide resolved
sdk/core/Azure.Core/src/DynamicData/MutableJsonDocument.ChangeTracker.cs
Show resolved
Hide resolved
The goal of this implementation is to avoid allocating data structures, with the hypothesis that span operations will outperform an allocating implementation for the majority case. I didn't implement both to compare performance, but until we know we have a perf issue here, I'd prefer to stick with this approach. |
This is the first change addressing #27402, and implements the core functionality described in the issue, i.e. writing JSON Merge Patch JSON from the MutableJsonDocument change list.
These types will need to be moved to internal shared source with a few helper types added in order to generate convenience APIs for Merge Patch operations as described in #37341.