Closed kdrvn closed 5 years ago
As I am looking into writing a fix for this issue, I am wondering if the JsonPatchDocument
constructor should have an override with a JsonSerializerSettings
parameter to be used for comparing the test operation's value and the tested value. As these settings can influence how the objects are serialized for comparison and influence the outcome, it would be useful to be able to change them without setting the JsonConvert.DefaultSettings
.
Thanks for contacting us, @kdrvn. Will you be interested in submitting a PR for the proposal?
I will give it a try.
Hi. Thanks for contacting us. We're closing this issue as there was not much community interest in this ask for quite a while now.
Functional impact
When controlling data serialization using a contract resolver (and the contract resolver is not registered for the JsonConvert's default settings), test operations in patch requests fail.
Minimal repro steps
Issue noticed in
Microsoft.AspNetCore.JsonPatch 2.1.1
.Example code:
Expected result
ApplyTo method does not throw an error, test operation was successful.
Actual result
ApplyTo method throw an error, due to failed test operation.
Further technical details
Each implementation of the
IAdapter
interface uses the static JsonConvert class with the default serializer settings. The provided ContractResolver is not being used when serializing values being compared.DictionaryAdapterOfU DynamicObjectAdapter ListAdapter PocoAdapter