Closed
Description
Rules can be written in the form <var> = <ground term>
. This is useful for defining constants; it would be nice if we could do the same with terms containing refs. Currently, the parser will return an error because it deems the term as being non-ground (since references have not been resolved yet).
One solution would be to update the parser to allow non-ground terms. If the user did include a variable in the value and that variable was not eventually resolved, the compiler should catch the error when performing the safety checks on the head.
Example parse error:
torin:~$ opa run test.rego
test.rego:7: expected rule (annotations_versioned = {
"metadata": {
"annotations": annotations,
"resourceVersion": object.metadata.resourceVersion
}
} must be declared inside a rule)
Example input:
package io.k8s
import object
annotations = {}
annotations_versioned = {
"metadata": {
"annotations": annotations,
"resourceVersion": object.metadata.resourceVersion
}
}
Metadata
Assignees
Labels
No labels
Activity