v0.4.0 - Upgrade to Rego v0.65.0
This minor version release updates rego-cpp
to use the latest version of Trieste and also brings it into line with OPA Rego v0.65.0, while fixing many bugs and adding some quality of life improvements.
New Features
- Updated the supported version of Rego to v0.65.0.
json.marshal_with_options
numbers.range_step
rego.v1
import and behaviour, plus a set of tests inregov1.yaml
- The interpreter now returns more than one
Result
when appropriate, and separates out theBindings
andTerms
. - The output of
rego
is now JSON instead of plain text - Added
regoOutputSize
,regoExpressions
,regoBindingsAtIndex
, andregoExpressionsAtIndex
to the C API - Updated the Python and Rust wrappers to use the new API
- Updated to latest version of Trieste
- Uses Trieste's YAML and JSON parsers and emitters
- Uses Trieste's more robust Unicode support
- Passes broken up into a
Reader
, which parses Rego files, and aRewriter
which performs unification - Added the
encoding
andgraphs
builtins - Added
set_log_level_from_string
andsetLogLevelFromString
to make it easier to set the log level. All executables now use this option.
Improvements
- The Interpreter caches intermediate versions of all modules, reducing query execution time
- All of the early passes have been rewritten and are more efficient, resulting in reduced parsing time
- The reduction of the input passes (and their restriction to a single file) along with other optimizations to header files has resulted in reduced compile times
- The
rego_fuzzer
xecutable allows for more fine-grained fuzzing and testing of the Rego toolchain - Multiple bug fixes
Deprecation
- The
regoSetInputJSON
method is a misnomer, as the input does not strictly need to be JSON. This has been replaced with an (otherwise identical) function calledregoSetInputTerm
which does the same thing, and theJSON
version has been deprecated.
Breaking Changes
- Output of
rego
tool has changed. Any downstream tooling that was parsing that will need to be updated to parse the JSON. rego::wf_result
has changed. Any tooling that was using the output node directly will need to be updated- the
add_*
methods onInterpreter
, as they now perform parsing, now produce either anullptr
if successful or an errorNode
.
Downstream consumers that were checking the boolean return value will need to be updated. Behavior in the C API is unchanged, but
there will now be detailed parse/compile errors when an individual module etc. fails to compile. - The
rego_trieste
executable has been replaced by the newrego_fuzzer
executable
New Test Coverage
base64builtins
base64urlbuiltins
hexbuiltins
jsonbuiltins
reachable
urlbuiltins