8000 docs/website/scripts: Eval pre-1.0 policies in v0 compatibility mode · open-policy-agent/opa@bb10c56 · GitHub
[go: up one dir, main page]

Skip to content

Commit bb10c56

Browse files
docs/website/scripts: Eval pre-1.0 policies in v0 compatibility mode
Signed-off-by: Ashutosh Narkar <anarkar4387@gmail.com>
1 parent c91c895 commit bb10c56

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

docs/website/scripts/live-blocks/src/preprocess/localEval.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,13 @@ export default async function localEval(groups, groupName, opaVersion) {
6969
// Returns 1st a function that consumes a string for the output format you want and produces an array of arguments and 2nd a map of module file names to strings that should be replaced in error messages. May throw a user-friendly error.
7070
async function prepEval(groups, groupName, opaVersion) {
7171
const {module, package: pkg, query, input, included} = getGroupData(groups, groupName)
72-
const base = ['eval', '--fail', '--v1-compatible'] // Fail on undefined
72+
const base = ['eval', '--fail'] // Fail on undefined
73+
74+
// eval pre-1.0 policies in v0 compatible mode.
75+
if (semver.valid(opaVersion) && semver.satisfies(semver.coerce(opaVersion), '<1.0.0')) {
76+
base.push('--v0-compatible')
77+
}
78+
7379
const rest = []
7480
const moduleFilenameMap = {}
7581

0 commit comments

Comments
 (0)
0