Migrate Rego to v1 syntax
rego_migrate_v1Migrate Rego v0 to v1 syntax: auto-fix reserved keywords, add import rego.v1, and validate with opa check. Returns migrated source plus errors for manual fixes.
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. |