Path to this page:
Subject: CVS commit: pkgsrc/devel/opa
From: Leonardo Taccari
Date: 2023-09-06 11:24:49
Message id: 20230906092449.ACD41FBDB@cvs.NetBSD.org
Log Message:
opa: Update to 0.56.0
Changes:
v0.56.0
-------
This release contains a mix of new features, bugfixes and a new builtin
function.
### Support for General References in Rule Heads (Experimental)
A new experimental feature in OPA is support for general refs in rule
heads. Where a general ref is a reference with variables at arbitrary
locations.
```rego
package example
import future.keywords
# Converting a flat list of users to a mapping by "role" and then \
"id".
users_by_role[role][id] := user if {
some user in data.users
id := user.id
role := user.role
}
# Explicit "admin" key override to the above mapping.
users_by_role.admin[id] := user if {
some user in data.admins
id := user.id
}
# Leaf entries can be multi-value.
users_by_country[country] contains user.id if {
some user in data.users
country := user.country
}
```
General refs are currently not supported by the OPA planner, making
this feature unsupported for Wasm and IR.
Note: this feature is disabled by default, and needs to be enabled by
setting the `EXPERIMENTAL_GENERAL_RULE_REFS` environment variable (once
the feature is complete - supports Wasm and IR - this requirement will
be dropped).
### New Built-In Function: `numbers.range_step`
Similar to the `numbers.range` built-in function, `numbers.range_step`
returns an array of numbers in a given range. The new built-in function
also allows you to control the _step between each entry_.
### Breaking changes
Since its introduction in 0.34.0, the `--exit-zero-on-skipped` option
always made the `opa test` command return an exit code 0. When used, it
now returns the exit code 0 only if no failed tests were found.
Test runs on existing projects using `--exit-zero-on-skipped` will fail
if any failed tests were inhibited by this behavior.
Files: