Native OCaml Rego/OPA policy engine
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

follow loc record shape + Json.to_string plain: xtce, qemu, space-block, prune, rego, paseto, runc, monitor, json

- xtce: Xml.Value.element is now Xml.Value.t; Xml.Value.of_string returns
Xml.Error.t, convert to string at failwith.
- qemu bin + prune + space-block: drop stale Json.Error.to_string on
string-typed errors.
- rego data_error_of_json_error: Loc.Error.t is now a record; read e.meta.
- rego Value.of_json_string / to_json_string: use Json.Value.{of,to}_string
shorthand (no codec arg needed for the generic AST).
- paseto v3_encrypt: encode_claims now returns plain string (Json.to_string
is plain), drop the Ok/Error match.
- runc Command.t, Command.container: drop unused [sw] and [bundle] fields.
Command.create no longer needs ~sw — Runc.Command.create dropped it too.
- monitor Process.create still uses [sw] (passed to Eio.Process.spawn),
so keep it in the module type S signature.
- json fuzz: use Json.Value.of_string shorthand.

+6 -14
+1 -1
lib/dune
··· 1 1 (library 2 2 (name rego) 3 3 (public_name rego) 4 - (libraries fmt logs json json.bytesrw astring re sedlex menhirLib) 4 + (libraries fmt logs json astring re sedlex menhirLib) 5 5 (preprocess 6 6 (pps sedlex.ppx))) 7 7
+2 -5
lib/rego.ml
··· 43 43 | Type_error s -> Fmt.pf ppf "type error: %s" s 44 44 45 45 let data_error_of_json_error (e : Json.Error.t) = 46 - let _ctx, meta, _kind = e in 47 - let tl = Json.Meta.textloc meta in 48 - let loc = 49 - if Loc.is_none tl then None else Some (Fmt.str "%a" Loc.pp tl) 50 - in 46 + let tl = Json.Meta.textloc e.meta in 47 + let loc = if Loc.is_none tl then None else Some (Fmt.str "%a" Loc.pp tl) in 51 48 Data_error { reason = Json.Error.to_string e; loc } 52 49 53 50 (** {1 Parsing} *)
+2 -7
lib/value.ml
··· 114 114 Json.Object (mems, none) 115 115 | Undefined -> Json.Null ((), none) 116 116 117 - let to_json_string v = 118 - match 119 - Json_bytesrw.encode_string ~format:Json.Minify Json.json (to_json v) 120 - with 121 - | Ok s -> s 122 - | Error e -> Fmt.str "<error: %s>" e 117 + let to_json_string v = Json.Value.to_string ~format:Json.Minify (to_json v) 123 118 124 119 let of_json_string s = 125 - match Json_bytesrw.decode_string Json.json s with 120 + match Json.Value.of_string s with 126 121 | Ok j -> Ok (of_json j) 127 122 | Error e -> Error e 128 123
+1 -1
test/test_rego.ml
··· 194 194 let json_str = Rego.Value.to_json_string v in 195 195 match Rego.Value.of_json_string json_str with 196 196 | Ok v2 -> Alcotest.(check bool) "roundtrip" true (Rego.Value.equal v v2) 197 - | Error e -> Alcotest.failf "json parse: %s" e 197 + | Error e -> Alcotest.failf "json parse: %a" Json.Error.pp e 198 198 199 199 (* ── Test suite ──────────────��─────────────────────────────────────────── *) 200 200