From fbf63b98c30a8cd67dd44f38b96a77fa2c053c42 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Tue, 8 Jul 2025 08:50:43 +0200 Subject: [PATCH] :sparkles: Reuse file data checkers on file validate ns --- common/src/app/common/files/validate.cljc | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/common/src/app/common/files/validate.cljc b/common/src/app/common/files/validate.cljc index 5bdb410669..0fe15a067c 100644 --- a/common/src/app/common/files/validate.cljc +++ b/common/src/app/common/files/validate.cljc @@ -650,26 +650,12 @@ (check-component component file) (deref *errors*))) -(def ^:private valid-fdata? - "Structural validation of file data using defined schema" - (sm/lazy-validator ::ctf/data)) - -(def ^:private get-fdata-explain - "Get schema explain data for file data" - (sm/lazy-explainer ::ctf/data)) - (defn validate-file-schema! "Validates the file itself, without external dependencies, it performs the schema checking and some semantical validation of the content." - [{:keys [id data] :as file}] - (when-not (valid-fdata? data) - (ex/raise :type :validation - :code :schema-validation - :hint (str/ffmt "invalid file data structure found on file '%'" id) - :file-id id - ::sm/explain (get-fdata-explain data))) - file) + [file] + (update file :data ctf/check-file-data)) (defn validate-file! "Validate full referential integrity and semantic coherence on file data.