-
Notifications
You must be signed in to change notification settings - Fork 47
JsonPatchDocument.Replace() yields invalid path when [JsonProperty] is used (1.1.0) #50
Comments
Ok, I think I've found the reason for this. I was originally using When Workaround: use explicit |
@kichalla can you investigate? If this is clearly a bug, would you recommend we patch in 1.1.1? |
Putting in 2.0.0 and marking as a bug. In the meantime the workaround should suffice. |
We should consider using the ContractResolver to figure out the property names rather than doing the following: |
And please check if there are any other places in the codes where we may have gotten that wrong. |
Title
In
1.1.0
,JsonPatchDocument<T>.Replace()
createsOperation<T>
with invalidpath
, when[JsonProperty]
fromNewtonsoft.Json
is used.Functional impact
This is regression from
"Microsoft.AspNetCore.JsonPatch": "1.0.0"
and breaks existing behavior.Minimal repro steps
global.json
:project.json
:Program.cs
:Expected result
The
Operation<T>.path
should be derived from the property in the expression. Expectedpath
to be"/arrayofstringsornull"
in this case.Actual result
Actual
path
is"/"
, which is incorrect.Further technical details
Regression from
"Microsoft.AspNetCore.JsonPatch": "1.0.0"
with.NET Core 1.0
.I have tested:
JsonPatch
dependency inproject.json
to1.0.0
and it works as expected.[JsonProperty]
and it works as expected.Question
Am I doing it wrong? I'm assuming that
Newtonsoft.Json
's attributes are supported.The text was updated successfully, but these errors were encountered: