OCaml Claude SDK using Eio and Jsont
1(*---------------------------------------------------------------------------
2 Copyright (c) 2025 Anil Madhavapeddy <anil@recoil.org>. All rights reserved.
3 SPDX-License-Identifier: ISC
4 ---------------------------------------------------------------------------*)
5
6(** Unknown fields for preserving extra JSON object members during
7 round-tripping.
8
9 This module provides an opaque type for storing unknown JSON fields as an
10 association list. This is useful for preserving fields that are not part of
11 the defined schema but should be maintained when reading and writing JSON.
12*)
13
14type t
15(** The opaque type of unknown fields, stored as an association list of field
16 names to JSON values. *)
17
18val empty : t
19(** [empty] is an empty set of unknown fields. *)
20
21val is_empty : t -> bool
22(** [is_empty t] returns [true] if there are no unknown fields stored in [t]. *)
23
24val of_assoc : (string * Jsont.json) list -> t
25(** [of_assoc assoc] creates unknown fields from an association list. *)
26
27val to_assoc : t -> (string * Jsont.json) list
28(** [to_assoc t] returns the association list of unknown fields. *)
29
30val jsont : t Jsont.t
31(** [jsont] is a codec for encoding and decoding unknown fields to/from JSON. *)
32
33val mems : (t, Jsont.json, Jsont.mem list) Jsont.Object.Mems.map
34(** [mems] is a mems codec for use with [Jsont.Object.keep_unknown]. *)