We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The REST API doesn't allow callers to load dependent modules one-by-one:
test1.rego:
package ex import request.req1 x :- req1 > 1
test2.rego:
package ex y :- x with request.req1 as 1000
Example:
torin:~$ curl -X PUT localhost:8181/v1/policies/test1 --data-binary @test1.rego { "ID": "test1", "Module": { "Package": { "Path": [ { "Type": "var", "Value": "data" }, { "Type": "string", "Value": "ex" } ] }, "Imports": null, "Rules": [ { "Name": "x", "Value": { "Type": "boolean", "Value": true }, "Body": [ { "Index": 0, "Terms": [ { "Type": "var", "Value": "gt" }, { "Type": "ref", "Value": [ { "Type": "var", "Value": "request" }, { "Type": "string", "Value": "req1" } ] }, { "Type": "number", "Value": 1 } ] } ] } ] } }torin:~$ curl -X PUT localhost:8181/v1/policies/test1 --data-binary @test2.rego { "Code": 400, "Message": "error(s) occurred while compiling module(s), see Errors", "Errors": [ { "Code": 2, "Location": { "File": "test1", "Row": 3, "Col": 1 }, "Message": "y: x is unsafe (variable x must appear in the output position of at least one non-negated expression)" } ] }
However, if we run OPA and pass the modules via the command line, everything works fine:
Run OPA:
./opa_darwin_amd64 run -s --v=3 --logtostderr=1 ~/test1.rego ~/test2.rego
List policies:
torin:~$ curl localhost:8181/v1/policies --silent | jq '.[].ID' "/Users/torin/test1.rego" "/Users/torin/test2.rego"
Query for data:
torin:~$ curl localhost:8181/v1/data {"ex":{"y":true}}
The text was updated successfully, but these errors were encountered:
Oops. The second PUT was overwriting the first--as a result this behaviour was expected.
Sorry, something went wrong.
No branches or pull requests
The REST API doesn't allow callers to load dependent modules one-by-one:
test1.rego:
test2.rego:
Example:
However, if we run OPA and pass the modules via the command line, everything works fine:
Run OPA:
List policies:
Query for data:
The text was updated successfully, but these errors were encountered: