From aa6b3e603b3ee8e70b5a2e5625711b5da082d076 Mon Sep 17 00:00:00 2001 From: John Estabrook Date: Sat, 5 Apr 2025 23:09:49 -0500 Subject: T7321: add validate_tree for use by load config --- src/session.ml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/session.ml b/src/session.ml index 602ab14..8aeffb3 100644 --- a/src/session.ml +++ b/src/session.ml @@ -69,6 +69,21 @@ let validate w _s path = RT.validate_path D.(w.dirs.validators) w.reference_tree path with RT.Validation_error x -> raise (Session_error x) +let validate_tree w' t = + let validate_path w out path = + let res = + try + RT.validate_path D.(w.dirs.validators) w.reference_tree path; + out + with RT.Validation_error x -> out ^ x + in res + in + let paths = CT.value_paths_of_tree t in + let out = List.fold_left (validate_path w') "" paths in + match out with + | "" -> () + | _ -> raise (Session_error out) + let split_path w _s path = RT.split_path w.reference_tree path -- cgit v1.2.3