Skip to content

Can not run "add" on root object #188

Closed

Description

@randmonkey

If I create a JSON patch to run "add" on root path like this:

[
{"op":"add","path":"","value":{"foo":"bar"}}
]

It could not set the entire document to {"foo":"bar"} as expected.
According to https://datatracker.ietf.org/doc/html/rfc6902#section-4.1, the add op MUST set the entire content of target document to the specified value. While actually:

  • If the original document is empty (empty raw JSON), the result is also empty
  • If the original document has any content (empty array [], empty object {}, non-empty array ["a","b"] or non-empty object {"k":"v"}), the applying will return error add operation does not apply: doc is missing path: "": missing value.

Activity

  1. added 2 commits that reference this issue on Jan 11, 2024
    c0449e0
    c645ff4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions