Logic for preparising an MLv2 query for JSON serialization (for the REST API or app DB). Removes things like QP-specific keys added during preprocessing. | (ns metabase.lib.serialize (:require [malli.core :as mc] [malli.transform :as mtx] [metabase.lib.schema :as lib.schema] [metabase.util.malli.registry :as mr])) |
(defn- encoder [schema] (mr/cached ::encoder schema (fn [] (mc/encoder schema (mtx/transformer {:name :serialize}))))) | |
Prepare | (defn prepare-for-serialization ([x] (prepare-for-serialization ::lib.schema/query x)) ([schema x] ((encoder schema) x))) |