You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
"JsonPatchTestOperationException: The value '1000' is invalid for target location." for nullable valuetype-props #32
[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
changed the title [-]JsonPatchTestOperationException: The value '1000' is invalid for target location. for nullable [/-][+]"JsonPatchTestOperationException: The value '1000' is invalid for target location." for nullable valuetype-props[/+]on Aug 6, 2024
Activity
[-]JsonPatchTestOperationException: The value '1000' is invalid for target location. for nullable [/-][+]"JsonPatchTestOperationException: The value '1000' is invalid for target location." for nullable valuetype-props[/+]Havunen commentedon Aug 7, 2024
Hi,
This sounds like a bug. I will take a look
Havunen commentedon Aug 7, 2024
The test case you provided here does not reproduce the error? Do you maybe have incorrect using statement or something similar in the real code?
Added a test case for Github#32 #32
Havunen commentedon Aug 7, 2024
CI run also green: 06aaa85
Rgaroth commentedon Aug 7, 2024
Yes, it was a custom converter JsonConverter in JsonSerializerOptions, i am sorry...
Try and convert from decimal to the underlying type value, if the typ…
Try and convert from decimal to the underlying type value, if the typ…