Format Rego
rego_formatFormats Rego policy source code with opa fmt, returning canonical formatting and a changed flag. Warns or blocks when string interpolation could trigger an OPA formatting bug in versions 1.12.0/1.12.1.
Instructions
Format Rego source code using opa fmt. Returns the formatted source and a changed flag indicating whether the input was already canonical. When the source uses string interpolation ($"..." or $... syntax) and OPA v1.12.0 or v1.12.1 is detected, the tool warns about or blocks formatting due to a known OPA bug that corrupts { escape sequences (fixed in OPA v1.12.2).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| source | Yes | Rego source code to format. |