Migrate Rego to v1 syntax
rego_migrate_v1Migrates Rego v0 policies to v1 syntax by auto-fixing reserved keywords and adding import rego.v1, then validates and reports any manual fixes needed.
Instructions
Migrate Rego v0 source to Rego v1 syntax in two phases: (1) opa fmt --rego-v1 auto-fixes reserved keywords (if, contains, every, in in rule heads) and adds import rego.v1; (2) opa check --v1-compatible validates the migrated source and reports any remaining issues that cannot be auto-fixed (e.g. removed builtins, semantic conflicts). Returns the migrated source and a changed flag even when check finds remaining errors -- this lets you inspect what changed and fix the remainder manually. If the source is completely unparseable, returns INVALID_REGO.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| source | Yes | Rego v0 source to migrate to Rego v1 syntax. `opa fmt --rego-v1` auto-fixes reserved keywords and adds `import rego.v1`; any remaining issues are returned in `errors` so you can resolve them manually. |