diff --git a/docs/content/v0-compatibility.md b/docs/content/v0-compatibility.md index ea48888171f..87ba7e77396 100644 --- a/docs/content/v0-compatibility.md +++ b/docs/content/v0-compatibility.md @@ -114,10 +114,8 @@ r := rego.New( ) ``` -Finally, another option is to import the `v0` package instead. This can even be -used alongside the `v1` package in the same program if required. The program -below will evaluate the same Rego using both the v0 and v1 Rego packages, v1 is -running in v0 compatibility mode with `SetRegoVersion`: +Finally, another option is to import the `v0` package instead. The program +below imports the v0 package instead: ```go package main @@ -128,13 +126,10 @@ import ( "fmt" v0rego "github.com/open-policy-agent/opa/rego" - v1ast "github.com/open-policy-agent/opa/v1/ast" - v1rego "github.com/open-policy-agent/opa/v1/rego" + // v1rego "github.com/open-policy-agent/opa/v1/rego" ) func main() { - // we have a v0 Rego module, we want to evaluate it using the v1 rego - // package and the v0 rego package in the same program. module := `package example messages[msg] { @@ -142,16 +137,6 @@ messages[msg] { } ` - rv1 := v1rego.New( - v1rego.Query("data.example.messages"), - v1rego.SetRegoVersion(v1ast.RegoV0), - v1rego.Module("example.rego", module), - ) - - rs, _ := rv1.Eval(context.TODO()) - bs, _ := json.Marshal(rs) - fmt.Println(string(bs)) - rv0 := v0rego.New( v0rego.Query("data.example.messages"), v0rego.Module("example.rego", module), @@ -164,6 +149,12 @@ messages[msg] { } ``` +{{< danger >}} +**Note**: Using v0 packages and v1 packages in the same program is considered an +anti-pattern and is not recommended or supported. Any interoperability between +the two packages is not guaranteed and should be considered unsupported. +{{< /danger >}} + ### v0.x compatibility mode in the OPA Go SDK {{< info >}}