Open
Description
There is currently no logic to handle omitempty
and zero value properly. The same applies if all elements of a map or slice are deleted.
Example
type Person struct {
Name string `json:"name"`
Age int `json:"age,omitempty"`
}
original := &Person{
Name: "John Doe",
Age: 42,
}
updated := &Person{
Name: "John Doe",
}
patch, _ := jsonpatch.CreateJSONPatch(updated, original)
Expected result
[{"op":"remove","path":"/age"}]
Actual result
[{"op":"replace","path":"/age","value":0}]