Skip to content

remove operation does not fail when the target does not exist #2

@oktoberfest6

Description

@oktoberfest6

Hi,

according to https://datatracker.ietf.org/doc/html/rfc6902/#section-4.2
"The target location MUST exist for the operation to be successful"

If the target location does not exist the current implementation does nothing (which is good) but does not fail (which is bad).

local jsonpatch = require('jsonpatch')

local o = { key = "value" }

local operations = {
	{ op = "remove", path = "/otherkey", value = "othervalue" },
}

print("object before")
for k,v in pairs(o) do print(k, v) end
print("err:", jsonpatch.apply(o, operations))
print("object after")
for k,v in pairs(o) do print(k, v) end

result of execution

object before
key	value
err:	nil
object after
key	value

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions