Consider the following minimalistic test:
[Fact]
public void Test()
{
Class1 obj = new();
var sourcePatch = new JsonPatchDocument<Class1>().Replace(c => c.Id, 1000);
var deserealizedPatch = JsonSerializer.Deserialize<JsonPatchDocument<Class1>>(JsonSerializer.Serialize(sourcePatch));
sourcePatch.ApplyTo(obj); // success
deserealizedPatch.ApplyTo(obj); // JsonPatchTestOperationException: The value '1000' is invalid for target location.
}
public class Class1
{
public int? Id { get; set; }
}
When I try to patch a NULLABLE property by deserialized JsonPatchDocument, I get an error JsonPatchTestOperationException: The value '1000' is invalid for target location
Consider the following minimalistic test:
When I try to patch a NULLABLE property by deserialized JsonPatchDocument, I get an error JsonPatchTestOperationException: The value '1000' is invalid for target location