OPA logo

Rego Playground

Set the Rego version

Specify the Rego version for the module.

v0 is the default, which is the syntax enforced pre-OPA v1.0.

v1 is the Rego syntax enforced by OPA v1.0.

Strict

When enabled, the Rego compiler has an expanded set of constraints, which will be treated as errors when violated. E.g. duplicate imports, unused local variable assignments, shadowing of reserved 'input' and 'data' keywords, and use of some deprecated built-in functions.

Coverage

Coverage explains which statements were evaluated. Red expressions were never evaluated. Red rule heads were never defined. Green expressions were evaluated at least once. Green rule heads were defined at least once.

Built-in Error Behaviour

By default, built-in function errors are ignored, results will be from non-erroring code paths.

If Strict is selected, execution will exit early when the first built-in function error is encountered. If Show All is selected, all built-in errors from all code paths will be returned as an errors.

Live Linting

By default, linting is performed as you type. Disable this to only lint on evaluation.

INPUT
DATA
OUTPUT
LINT
Your Rego is not compatible with OPA >=v1.0.0. You are encouraged to reformat your Rego with opa fmt or click the Format button above. For more information, check the upgrade documentation.
Built by Styra logo
v??.??.??

Share

Install OPA

OPA installation docs
  • Linux
  • macOS
  • Windows

              
            

Run OPA with playground policy

Heads up! The Rego playground is intended for development. Don't rely on it for your production deployments.

              
            

Query OPA with playground input

Test by piping your playground's JSON input into your OPA served playground policy