From c48a1bef3c68e9f736efe6b025ffcfac23da46ac Mon Sep 17 00:00:00 2001 From: PixieDust Date: Sun, 29 Dec 2024 07:38:51 +0000 Subject: [PATCH 1/3] Make json structure uniform In `opamndiff` we have a similar structure but simply `version_left` and `version_right`. https://git.robur.coop/robur/builder-web/src/branch/main/opamdiff/opamdiff.ml#L284-L286 --- lib/utils.ml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/utils.ml b/lib/utils.ml index 76f7031..190ef75 100644 --- a/lib/utils.ml +++ b/lib/utils.ml @@ -1,4 +1,3 @@ - module String_map = struct include Map.Make(String) @@ -16,8 +15,8 @@ let diff_map_to_json (left, right, different_versions) = `List (List.map (fun (name, version1, version2) -> `Assoc [ ("name", `String name); - ("version_in_left", `String version1); - ("version_in_right", `String version2) + ("version_left", `String version1); + ("version_right", `String version2) ] ) lst) in -- 2.47.1 From 161a8e713bdf96bde276abe1e74a256c2b060985 Mon Sep 17 00:00:00 2001 From: PixieDust Date: Mon, 30 Dec 2024 14:05:23 +0000 Subject: [PATCH 2/3] update builder_web Make json fileds uniform --- lib/builder_web.ml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/builder_web.ml b/lib/builder_web.ml index e33ca5c..d4d3b36 100644 --- a/lib/builder_web.ml +++ b/lib/builder_web.ml @@ -621,7 +621,7 @@ let routes ~datadir ~cachedir ~configdir ~expired_jobs = let json_response = `Assoc [ "left", `Assoc [ - "job_name", `String job_left; + "job", `String job_left; "uuid", `String (Uuidm.to_string build_left.uuid); "platform", `String build_left.platform; "start_time", `String (Ptime.to_rfc3339 build_left.start); @@ -630,8 +630,8 @@ let routes ~datadir ~cachedir ~configdir ~expired_jobs = "main_binary_size", file_size_json build_left_file_size; ]; "right", `Assoc [ - "job_name", `String job_right; - "build", `String (Uuidm.to_string build_right.uuid); + "job", `String job_right; + "uuid", `String (Uuidm.to_string build_right.uuid); "platform", `String build_right.platform; "start_time", `String (Ptime.to_rfc3339 build_right.start); "finish_time", `String (Ptime.to_rfc3339 build_right.finish); -- 2.47.1 From 0261f89022015e212ef0e7e2c6f45a1120d67a9d Mon Sep 17 00:00:00 2001 From: PizieDust Date: Mon, 6 Jan 2025 16:00:00 +0100 Subject: [PATCH 3/3] uniform naming --- lib/builder_web.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/builder_web.ml b/lib/builder_web.ml index d4d3b36..de2a7c1 100644 --- a/lib/builder_web.ml +++ b/lib/builder_web.ml @@ -411,7 +411,7 @@ let routes ~datadir ~cachedir ~configdir ~expired_jobs = if is_accept_json req then let json_response = `Assoc [ - "job_name", `String job_name; + "job", `String job_name; "uuid", `String (Uuidm.to_string build.uuid); "platform", `String build.platform; "start_time", `String (Ptime.to_rfc3339 build.start); -- 2.47.1