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

$patch remove keyword from required #40

Open
mostafahatem20 opened this issue Apr 24, 2021 · 1 comment
Open

$patch remove keyword from required #40

mostafahatem20 opened this issue Apr 24, 2021 · 1 comment

Comments

@mostafahatem20
Copy link

I saw in the tests how to add an attribute to the required keyword { "op": "add", "path": "/required/-", "value": "q" }
but I want to ask how can i remove a keyword from being required I tried
{ "op": "remove", "path": "/required/-q"} but it did not work i seem to get it wrong so if anyone can help I would be grateful.
Thank you

@pieterjandesmedt
Copy link

pieterjandesmedt commented Apr 28, 2021

Value-based array operations are not supported yet in JSON patch. See this issue: json-patch/json-patch2#18
You need to remove values in an array based on index.

An example target JSON document:

   { "foo": [ "bar", "qux", "baz" ] }

A JSON Patch document:

   [
     { "op": "remove", "path": "/foo/1" }
   ]

The resulting JSON document:

   { "foo": [ "bar", "baz" ] }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants