Migrate Rego to v1 syntax
rego_migrate_v1Migrate Rego v0 to Rego v1 syntax: auto-fix reserved keywords, add import rego.v1, then validate with opa check to report remaining issues for manual fix.
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 cannot be parsed, or uses a built-in that v1 removed and so fails type checking in the first phase, returns INVALID_REGO with opa's own message.
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. |