open-policy-agent / opa

Open Policy Agent (OPA) is an open source, general-purpose policy engine.
https://www.openpolicyagent.org
Apache License 2.0
9.52k stars 1.32k forks source link

Extend METADATA scopes to include "file" scope #6932

Open tsandall opened 1 month ago

tsandall commented 1 month ago

Currently we have subpackages, package, document, and rule scoped annotations. These each of their own valid use cases however none of them are ideal for applying annotations to all nodes in the current file. The package scope can work however if multiple files contribute to the same package then we generate an error. It would be useful to have a file scope. The file scope annotation should precede the package directive (however the 'package' scope directive should still be the default.)

anderseknert commented 4 weeks ago

Some thoughts: