Skip to content

Commit

Permalink
docs: add sdk note about v0 compatibility
Browse files Browse the repository at this point in the history
Signed-off-by: Charlie Egan <[email protected]>
  • Loading branch information
charlieegan3 authored and ashutosh-narkar committed Dec 18, 2024
1 parent b0a9eaf commit 74f4637
Showing 1 changed file with 34 additions and 3 deletions.
37 changes: 34 additions & 3 deletions docs/content/v0-compatibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,37 @@ the two packages is not guaranteed and should be considered unsupported.

### v0.x compatibility mode in the OPA Go SDK

{{< info >}}
TODO
{{< /info >}}
In OPA 1.0, the recommended

[SDK package](https://pkg.go.dev/github.com/open-policy-agent/opa/v1/sdk)
import for most users is `github.com/open-policy-agent/opa/v1/sdk`.

Those who need to support v0 bundles should set the Rego version on bundle
manifests as outlined above wherever possible. For users unable to do this, use
of a v0 import of the SDK package is required. For example:

```go
package main

import (
"bytes"
"context"
"fmt"

"github.com/open-policy-agent/opa/sdk" // <-- import v0 sdk package
)

func main() {
opa, _ := sdk.New(ctx, sdk.Options{
ID: "opa-1",
Config: bytes.NewReader(config),
})

defer opa.Stop(ctx)

// ...
}
```

Users in this scenario should look to version bundles as soon as possible to
allow them to use a v1 SDK instead.

0 comments on commit 74f4637

Please sign in to comment.