mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-10-21 14:38:46 +00:00
Revert to json-patch 4.12.0
This commit is contained in:
42
vendor/github.com/evanphx/json-patch/patch.go
generated
vendored
42
vendor/github.com/evanphx/json-patch/patch.go
generated
vendored
@@ -568,6 +568,29 @@ func (p Patch) replace(doc *container, op Operation) error {
|
||||
return errors.Wrapf(err, "replace operation failed to decode path")
|
||||
}
|
||||
|
||||
if path == "" {
|
||||
val := op.value()
|
||||
|
||||
if val.which == eRaw {
|
||||
if !val.tryDoc() {
|
||||
if !val.tryAry() {
|
||||
return errors.Wrapf(err, "replace operation value must be object or array")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch val.which {
|
||||
case eAry:
|
||||
*doc = &val.ary
|
||||
case eDoc:
|
||||
*doc = &val.doc
|
||||
case eRaw:
|
||||
return errors.Wrapf(err, "replace operation hit impossible case")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
con, key := findObject(doc, path)
|
||||
|
||||
if con == nil {
|
||||
@@ -634,6 +657,25 @@ func (p Patch) test(doc *container, op Operation) error {
|
||||
return errors.Wrapf(err, "test operation failed to decode path")
|
||||
}
|
||||
|
||||
if path == "" {
|
||||
var self lazyNode
|
||||
|
||||
switch sv := (*doc).(type) {
|
||||
case *partialDoc:
|
||||
self.doc = *sv
|
||||
self.which = eDoc
|
||||
case *partialArray:
|
||||
self.ary = *sv
|
||||
self.which = eAry
|
||||
}
|
||||
|
||||
if self.equal(op.value()) {
|
||||
return nil
|
||||
}
|
||||
|
||||
return errors.Wrapf(ErrTestFailed, "testing value %s failed", path)
|
||||
}
|
||||
|
||||
con, key := findObject(doc, path)
|
||||
|
||||
if con == nil {
|
||||
|
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
@@ -202,7 +202,7 @@ github.com/emicklei/go-restful/v3/log
|
||||
# github.com/euank/go-kmsg-parser v2.0.0+incompatible
|
||||
## explicit
|
||||
github.com/euank/go-kmsg-parser/kmsgparser
|
||||
# github.com/evanphx/json-patch v5.6.0+incompatible
|
||||
# github.com/evanphx/json-patch v4.12.0+incompatible
|
||||
## explicit
|
||||
github.com/evanphx/json-patch
|
||||
# github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d
|
||||
|
Reference in New Issue
Block a user