Need help with json.patch built-in #361
-
Hi folks, I am having a hard time getting the json.patch built-in to work with my rule. Let's say I got this object:
As part of a comprehension, I'd like to dynamically patch that object. For the sake of simplicity, I'm trying to go with a very simple example to get to a working solution. However, I did not have much success so far.
then I'm trying with this:
However, when printing Looking at the output of I do not get any error messages. Am I missing something? Thank you in advance for help. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi there! 👋 Variables in Rego are immutable, so you can't change the value of See example of working policy here: https://play.openpolicyagent.org/p/vQQQopNORc |
Beta Was this translation helpful? Give feedback.
Hi there! 👋 Variables in Rego are immutable, so you can't change the value of
required_approvals
. You can however assign the result of the patch operation to a new var. I'm surprised you did not see an error message about that. If you can share your policy in full, I'd be happy to take a look.See example of working policy here: https://play.openpolicyagent.org/p/vQQQopNORc