Something went wrong. Try again.
ocaml
Something went wrong. Try again.
1.2 kB · 43 lines
OCaml
at pp-ast
1234567891011121314151617181920212223242526272829303132333435363738394041424344(* * SPDX-FileCopyrightText: 2024 The Forester Project Contributors * SPDX-FileCopyrightText: 2026 The Forester Project Contributors * * SPDX-License-Identifier: GPL-3.0-or-later *)
type t = { metas: Jsont.json Map.Make(String).t; route: string; tags: string list; taxon: string option; title: string option; uri: string;}
let make metas route tags taxon title uri = {metas; route; tags; taxon; title; uri}
let metas t = t.metaslet route t = t.routelet tags t = t.tagslet taxon t = t.taxonlet title t = t.titlelet uri t = t.uri
let string_null_is_none = let null = Jsont.null None in let enc = function None -> null | _ -> Jsont.(option string) in Jsont.any ~dec_null:null ~dec_string:Jsont.(option string) ~enc ()
let jsont = Jsont.( Object.( map ~kind:"tree" make |> mem "metas" (as_string_map ~kind:"metas" json) ~enc:metas |> mem "route" string ~enc:route |> mem "tags" (list string) ~enc:tags |> mem "taxon" string_null_is_none ~enc:taxon |> mem "title" string_null_is_none ~enc:title |> mem "uri" string ~enc:uri |> finish))
let forest_jsont = Jsont.list jsont