Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON Patch not working with PATCH method #694

Open
linkdd opened this issue Mar 9, 2021 · 0 comments
Open

JSON Patch not working with PATCH method #694

linkdd opened this issue Mar 9, 2021 · 0 comments

Comments

@linkdd
Copy link

linkdd commented Mar 9, 2021

Suppose I have a custom resource like this:

---
apiVersion: example.com/v1
kind: Example
metadata:
  # ...
spec:
  foo: "bar"

When calling the following method:

client.apis['example.com'].v1.namespace('default').examples('name').patch({
  body: [ { op: "add", path: "/spec/foo", value: "baz" } ],
  headers: {
    'content-type': 'application/json-patch+json'
  }
})

A 422 error is received with the following error message:

"" is invalid: patch: Invalid value: "[{\"op\":\"add\",\"path\":\"/spec/foo\",\"value\": \"baz\"}]": couldn't get version/kind; json parse error: json: cannot unmarshal array into Go value of type struct { APIVersion string "json:\"apiVersion,omitempty\""; Kind string "json:\"kind,omitempty\"" }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant