Skip to content

How to preserve missing values in diff #28

Open
@GFoley83

Description

@GFoley83

I'm confused about how to preserve missing values from when diffing two objects.

Take for example these two json blocks:

{
  "Name": "John",
  "Age": 34,
  "Origin": "Scotland",  
  "Pets": [
    {
      "Type": "Cat",
      "Name": "MooMoo",
      "Age": 3.4
    },
    {
      "Type": "Squirrel",
      "Name": "Sandy",
      "Age": 7
    }
  ]
}
{
  "Origin": "Ireland"
}

When I run a patch, I would like to end up with:

{
  "Name": "John",
  "Age": 34,
  "Origin": "Ireland",   // UPDATED HERE  
  "Pets": [
    {
      "Type": "Cat",
      "Name": "MooMoo",
      "Age": 3.4
    },
    {
      "Type": "Squirrel",
      "Name": "Sandy",
      "Age": 7
    }
  ]
}

Basically all the missing values are preserved and only the values that conflict are updated, but I can seem to achieve this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions