-
Notifications
You must be signed in to change notification settings - Fork 296
Expand file tree
/
Copy pathschematest.ml
More file actions
28 lines (24 loc) · 841 Bytes
/
schematest.ml
File metadata and controls
28 lines (24 loc) · 841 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
let hash x = Digest.string x |> Digest.to_hex
(* BEWARE: if this changes, check that schema has been bumped accordingly in
ocaml/idl/datamodel_common.ml, usually schema_minor_vsn *)
let last_known_schema_hash = "949e3d80390be274490c213b57f69aad"
let current_schema_hash : string =
let open Datamodel_types in
let hash_of_obj x =
List.map rpc_of_content x.contents
|> List.map Jsonrpc.to_string
|> String.concat ""
|> hash
in
Datamodel.all_system |> List.map hash_of_obj |> String.concat ":" |> hash
let () =
if last_known_schema_hash <> current_schema_hash then (
Printf.eprintf
{|
New schema hash ('%s') doesn't match the last known one. Please bump the
datamodel schema versions if necessary, and update 'last_known_schema_hash'
in file %s.
|}
current_schema_hash __FILE__ ;
exit 1
)