This message was deleted.
# opal
s
This message was deleted.
t
So, i want to use PATCH method for updating OPA data, the REST API of OPA works correctly, posting an example of data
Copy code
{
  "1234": {
    "abcd": "ef"
  }
}
i want to remove the key
abcd
and so the OPA API request is
Copy code
curl --location --request PATCH '<http://localhost:8181/v1/data/1234>' \
--header 'Content-Type: application/json-patch+json' \
--data-raw '[{
    "op":"remove",
    "path": "/abcd"
}]'
and i am confused how to make the same request happen with the data update trigger API of OPAL server, the following does not work
Copy code
curl --location --request POST '<http://localhost:7002/data/config>' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <token>' \
--data-raw '{
  "entries": [
    {
      "url": "",
      "data": [
        { "op": "remove", "path": "/abcd" }
       ],
      "config": {},
      "topics": [
        "policy_data"
      ],
      "dst_path": "/1234",
      "save_method": "PATCH"
    }
  ],
  "reason": "laboris fugiat commodo",
  "callback": {
    "callbacks": []
  }
}'
i don’t think data is where i should be specifying the JSON patch request but i don’t see any other place to specify it, am i missing something?
o
Hi @Thilak Reddy, the PATCH operation is not currently supported in data updates. The code currently basically ignores the save method This could be a rather easy fix, would you be interested in creating and contributing it? CC: @Ro'e Katz, @Shaul Kremer
t
Got it @Or Weis, i will try to add it
💜 2
Hi @Or Weis i tried implementing the patch save method support, here is the pull request, can someone take a look?
o
@Thilak Reddy this looks great! I only gave it a skim now- but it really look in the right direction. I’ve asked @Ro'e Katz to do a thorough code review. Meanwhile I’d ask that you also add a docs entry and a test , and add a comment on the PR that you are authorizing the contribution of it to open-source. 🙏 @Filip , let’s make sure @Thilak Reddy gets an awesome swag package, to celebrate this awesome contribution
💜 1
f
Absolutely 🙂
t
Thanks @Or Weis, I have added tests and added a section in docs for patch data event in this page
o
💪 @Ro'e Katz ball’s at your court 😉
t
and add a comment on the PR that you are authorizing the contribution of it to open-source.
curious to know if there is any reason, doesn’t raising a pull request by default mean i am contributing to open source? 🤔
o
Personally, I would say yes - but it’s better to be safe an sorry - and some OSS organizations like the CNCF (Which we might consider collaborating with in the future) require that additional sign-off
t
interesting, sure will add the comment
💜 1
r
Sorry for not getting to it yet, I’ll try to take a look tomorrow!
🙏 1
@Thilak Reddy Got to it now (better later then never I guess). https://github.com/permitio/opal/pull/483#pullrequestreview-1521580051
1
t
have answered questions and updated the PR with some changes @Ro'e Katz
💜 1
r
@Thilak Reddy, looks great to me. Approved & merged. Well done! 🙂 opal
💜 1
o
partycat
💜 1
t
Awesome, thanks @Or Weis for always being so quick on replies and thanks @Ro'e Katz for the review