Closed TAGC closed 7 years ago
@TAGC The support has not been removed is handled by the following: https://github.com/aspnet/JsonPatch/blob/dev/src/Microsoft.AspNetCore.JsonPatch/Internal/ObjectVisitor.cs#L58 https://github.com/aspnet/JsonPatch/blob/dev/src/Microsoft.AspNetCore.JsonPatch/Internal/ExpandoObjectAdapter.cs
Also we have bunch of tests for 'dynamic' here: https://github.com/aspnet/JsonPatch/tree/dev/test/Microsoft.AspNetCore.JsonPatch.Test/Dynamic
Could you share your repro code?
I think I know where the problem is:
if (targetObject is ExpandoObject)
{
return new ExpandoObjectAdapter();
}
You seem to handle dynamic patching only for instances of ExpandoObject
whereas I've created my own class that subclasses DynamicObject
directly.
I have an early version of this class here which you can use to reproduce the issue.
Looks like this is already covered by #38.
Yes, looks to be a dup of https://github.com/aspnet/JsonPatch/issues/38.
I've been developing code that relies on dynamic JSON patching. In my ".NET Core library" project everything works as expected, and all tests pass. However, when I package up this project and use it as a dependency within an ASP.NET Core web application (.NETCore App 1.1.0), the exact same operations result in errors like this:
It had me scratching my head for a while but I believe I've tracked the root of this issue down to the fact that my library uses Microsoft.AspNetCore.JsonPatch v1.0.0 whereas my web application would be using Microsoft.AspNetCore.JsonPatch v1.1.0.
Homing in on
Microsoft.AspNetCore.JsonPatch.Adapters.ObjectAdapter.Add(String path, Object value, Object objectToApplyTo, Operation operation)
I compared the differences between the two versions.From v1.0.0, it looks like it's handling dynamic paths:
However, from v1.1.0 this method seems to omit all dynamic path support:
Why has this been done?