From 853c3fdb1581320994ff120ec652e3c1b5daa39d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eduardo=20Garc=C3=ADa=20Maleta?= Date: Fri, 16 Feb 2024 04:08:41 -0500 Subject: [PATCH] (ood-gen) Remove option from Release.t.is_latest and Release.t.is_lts (#2055) --- src/ocamlorg_data/data.mli | 4 ++-- tool/ood-gen/lib/release.ml | 15 +++++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/ocamlorg_data/data.mli b/src/ocamlorg_data/data.mli index bd18557b62..85ab9cd676 100644 --- a/src/ocamlorg_data/data.mli +++ b/src/ocamlorg_data/data.mli @@ -392,8 +392,8 @@ module Release : sig kind : kind; version : string; date : string; - is_latest : bool option; - is_lts : bool option; + is_latest : bool; + is_lts : bool; intro_md : string; intro_html : string; highlights_md : string; diff --git a/tool/ood-gen/lib/release.ml b/tool/ood-gen/lib/release.ml index 3b21f00477..4ac12d0270 100644 --- a/tool/ood-gen/lib/release.ml +++ b/tool/ood-gen/lib/release.ml @@ -23,8 +23,8 @@ type t = { kind : Kind.t; version : string; date : string; - is_latest : bool option; - is_lts : bool option; + is_latest : bool; + is_lts : bool; intro_md : string; intro_html : string; highlights_md : string; @@ -34,6 +34,7 @@ type t = { } [@@deriving stable_record ~version:metadata ~add:[ intro; highlights ] + ~modify:[ is_latest; is_lts ] ~remove: [ intro_md; intro_html; highlights_md; highlights_html; body_md; body_html; @@ -50,6 +51,8 @@ let of_metadata m = (Cmarkit.Doc.of_string ~strict:true m.highlights |> Hilite.Md.transform |> Cmarkit_html.of_doc ~safe:false) + ~modify_is_latest:(Option.value ~default:false) + ~modify_is_lts:(Option.value ~default:false) let sort_by_decreasing_version x y = let to_list s = List.map int_of_string_opt @@ String.split_on_char '.' s in @@ -72,7 +75,7 @@ let all () = let template () = let all = all () in let latest = - try List.find (fun r -> r.is_latest = Some true) all + try List.find (fun r -> r.is_latest) all with Not_found -> raise (Invalid_argument @@ -80,7 +83,7 @@ let template () = true") in let lts = - try List.find (fun r -> r.is_lts = Some true) all + try List.find (fun r -> r.is_lts) all with Not_found -> raise (Invalid_argument @@ -94,8 +97,8 @@ type t = { kind : kind ; version : string ; date : string - ; is_latest: bool option - ; is_lts: bool option + ; is_latest: bool + ; is_lts: bool ; intro_md : string ; intro_html : string ; highlights_md : string