Closed anderseknert closed 3 months ago
Here's how we can do it: add the new if-object-literal
rule, and when we do, keep the if-empty-object
rule around but make it disabled by default + update its docs to say that it's been replaced by if-object-literal
. But if people have enabled it manually in configuration, it'll keep working as before.
Came across this old issue in the OPA backlog: https://github.com/open-policy-agent/opa/issues/5294 And since that's unlikely to be fixed in OPA, we should at least make sure Regal flags it.
Note that we currently have the if-empty-object rule to cover the case OPA previously would fail for being an empty rule body.. but doesn't do anymore. While we could retrofit that rule to cover any object following an
if
, we'd have to do so much work around the docs, redirects and whatnot, that it's probably a better option to add a new rule that checks forif
followed by a non-empty object.Question is if there is ever a valid
if { ..object.. }
case? I can't think of one now, but happy to be proven wrong.