Declarative JSON data manipulation for OCaml
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.

+13 -25
+5 -6
fuzz/fuzz_json.ml
··· 25 25 (** [Json.Codec.Value.t] - must not crash on arbitrary input. *) 26 26 let test_json_crash buf = 27 27 let buf = truncate buf in 28 - match Json.of_string Json.Codec.Value.t buf with 29 - | Ok _ | Error _ -> () 28 + match Json.Value.of_string buf with Ok _ | Error _ -> () 30 29 31 30 (** Skip-parse implication: if [Json.Codec.Value.t] accepts, [Json.Codec.ignore] 32 31 must accept. *) 33 32 let test_skip_implication buf = 34 33 let buf = truncate buf in 35 - match Json.of_string Json.Codec.Value.t buf with 34 + match Json.Value.of_string buf with 36 35 | Error _ -> () 37 36 | Ok _ -> ( 38 37 match Json.of_string Json.Codec.ignore buf with ··· 51 50 | Ok v -> ( 52 51 let s = Json.Value.to_string v in 53 52 match Json.Value.of_string s with 54 - | Error e -> failf "roundtrip: re-decode failed on %S: %a" s Json.Error.pp e 55 - | Ok v' -> 56 - if not (Json.equal v v') then failf "roundtrip: value changed") 53 + | Error e -> 54 + failf "roundtrip: re-decode failed on %S: %a" s Json.Error.pp e 55 + | Ok v' -> if not (Json.equal v v') then failf "roundtrip: value changed") 57 56 58 57 let suite = 59 58 ( "json",
+1 -5
lib/error.ml
··· 22 22 Fmt.pf ppf "Expected %a but found %a" Fmt.code exp Sort.pp fnd) 23 23 | _ -> None) 24 24 25 - type t = Loc.Error.t = { 26 - ctx : Loc.Context.t; 27 - meta : Loc.Meta.t; 28 - kind : kind; 29 - } 25 + type t = Loc.Error.t = { ctx : Loc.Context.t; meta : Loc.Meta.t; kind : kind } 30 26 31 27 let kind_to_string = Loc.Error.kind_to_string 32 28 let v = Loc.Error.v
+1 -5
lib/error.mli
··· 16 16 (** [kind_to_string k] is a human-readable rendering of [k], using the printers 17 17 registered with {!Loc.Error.register_kind_printer}. *) 18 18 19 - type t = Loc.Error.t = { 20 - ctx : Loc.Context.t; 21 - meta : Loc.Meta.t; 22 - kind : kind; 23 - } 19 + type t = Loc.Error.t = { ctx : Loc.Context.t; meta : Loc.Meta.t; kind : kind } 24 20 (** The type for errors: a context, a meta and a kind. *) 25 21 26 22 val v : ctx:Loc.Context.t -> meta:Loc.Meta.t -> kind -> t
+5 -4
lib/json.ml
··· 1649 1649 loop Ast.empty_object (update_mem ~absent n t) is 1650 1650 | [] -> t 1651 1651 | s :: is -> 1652 - loop Ast.empty_object (update_mem ~absent (step_as_mem s) t) is 1652 + loop Ast.empty_object 1653 + (update_mem ~absent (step_as_mem s) t) 1654 + is 1653 1655 in 1654 1656 match i with 1655 1657 | Path.Nth (n, _) -> ··· 1657 1659 | Path.Mem (n, _) -> 1658 1660 loop Ast.empty_object (update_mem ~absent n t) is 1659 1661 | s -> 1660 - loop Ast.empty_object 1661 - (update_mem ~absent (step_as_mem s) t) 1662 - is)) 1662 + loop Ast.empty_object (update_mem ~absent (step_as_mem s) t) is) 1663 + ) 1663 1664 1664 1665 let null_value : Ast.t = Ast.Null ((), Meta.none) 1665 1666
+1 -5
lib/json.mli
··· 89 89 90 90 (** {1:errors Errors} *) 91 91 92 - type t = Loc.Error.t = { 93 - ctx : Context.t; 94 - meta : Meta.t; 95 - kind : kind; 96 - } 92 + type t = Loc.Error.t = { ctx : Context.t; meta : Meta.t; kind : kind } 97 93 (** The type for errors. *) 98 94 99 95 val v : ctx:Context.t -> meta:Meta.t -> kind -> t